Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
00001 // Copyright 2006-2011 by Kat'Oun 00002 00003 #ifndef _RESOURCE_H_ 00004 #define _RESOURCE_H_ 00005 00006 #include <EngineConfig.h> 00007 #include <core/Types.h> 00008 #include <engine/Object.h> 00009 #include <resource/ResourceDefines.h> 00010 00011 #include <string> 00012 00013 namespace resource 00014 { 00015 00016 class DataStream; 00017 class Serializer; 00018 class ResourceManager; 00019 struct ResourceEvent; 00020 class ResourceEventReceiver; 00021 00037 class ENGINE_PUBLIC_EXPORT Resource: public engine::Object 00038 { 00039 friend class Serializer; 00040 friend class ResourceManager; 00041 00042 public: 00043 00044 Resource(const std::string& name, Serializer* serializer = NULL); 00045 virtual ~Resource(); 00046 00048 const ResourceType& getResourceType() const; 00049 00050 const std::string& getFilename() const; 00051 00052 const ResourceState& getState() const; 00053 00055 u32 getSize(); 00056 00057 bool load(); 00058 00059 void unload(); 00060 00061 bool reload(); 00062 00063 void addResourceEventReceiver(ResourceEventReceiver* newEventReceiver); 00064 void removeResourceEventReceiver(ResourceEventReceiver* oldEventReceiver); 00065 00066 protected: 00067 00068 ResourceType mResourceType; 00069 00070 void initProperties(); 00071 00072 virtual void updateImpl(f32 elapsedTime); 00073 00074 virtual bool loadImpl(); 00075 virtual void unloadImpl(); 00076 00077 std::string mFilename; 00078 DataStream* mDataStream; 00079 Serializer* mSerializer; 00080 ResourceState mState; 00081 u32 mSize; 00082 00083 ResourceEvent* mResourceEvent; 00084 std::list<ResourceEventReceiver*> mResourceEventReceivers; 00085 std::list<ResourceEventReceiver*> mAlreadyLoadedEventReceivers; 00086 00088 void fireLoaded(); 00090 void fireUnloaded(); 00091 }; 00092 00093 }// end namespace resource 00094 00095 #endif
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:05 by
Doxygen
(1.7.4)
|