UGDK
src/ugdk/base/resourcecontainer.h
Go to the documentation of this file.
00001 #ifndef UGDK_BASE_RESOURCECONTAINER_H_
00002 #define UGDK_BASE_RESOURCECONTAINER_H_
00003 
00004 #include <string>
00005 
00006 namespace ugdk {
00007 namespace base {
00008 
00009 class ResourceContainerBase {
00010   protected: ResourceContainerBase() {}
00011   public:    virtual ~ResourceContainerBase() {}
00012 };
00013 
00014 template <class T>
00015 class ResourceContainer : public ResourceContainerBase {
00016   protected: ResourceContainer() {}
00017   public:
00018     virtual ~ResourceContainer() {}
00019 
00020     virtual void Insert( const std::string& tag, T val) = 0;
00021     virtual void Replace(const std::string& tag, T val) = 0;
00022     virtual bool Exists( const std::string& tag) const = 0;
00023     virtual T&   Find(   const std::string& tag) = 0;
00024     virtual T&   Load(   const std::string& filepath, const std::string& tag) = 0;
00025 };
00026 
00027 template <class T>
00028 class ResourceContainer<T*> : public ResourceContainerBase {
00029   protected: ResourceContainer() {}
00030   public:
00031     virtual ~ResourceContainer() {}
00032 
00033     virtual void Insert( const std::string& tag, T* val) = 0;
00034     virtual void Replace(const std::string& tag, T* val) = 0;
00035     virtual bool Exists( const std::string& tag) const = 0;
00036     virtual T*   Find(   const std::string& tag) = 0;
00037     virtual T*   Load(   const std::string& filepath, const std::string& tag) = 0;
00038 };
00039 
00040 } // namespace base
00041 } // namespace ugdk
00042 
00043 #endif // UGDK_BASE_RESOURCECONTAINER_H_
00044 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines