Changeset 9714 in orxonox.OLD for branches/new_class_id/src/lib/util
- Timestamp:
- Sep 1, 2006, 7:50:24 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/loading/resource.h
r7195 r9714 10 10 #include "multi_type.h" 11 11 #include <string> 12 13 // FORWARD DECLARATION 14 15 16 17 //! An enumerator for different (UN)LOAD-types. 18 /** 19 * RP_NO: will be unloaded on request 20 * RP_LEVEL: will be unloaded at the end of a Level 21 * RP_CAMPAIGN: will be unloaded at the end of a Campaign 22 * RP_GAME: will be unloaded at the end of the whole Game (when closing orxonox) 23 */ 24 typedef enum ResourcePriority 25 { 26 RP_NO = 0, 27 RP_LEVEL = 1, 28 RP_CAMPAIGN = 2, 29 RP_GAME = 3 30 }; 31 32 12 #include <vector> 13 #include <set> 33 14 34 15 //! A Resource is an Object, that can be loaded from Disk … … 36 17 * 37 18 */ 38 class Resource : virtual public BaseObject { 19 class Resource : virtual public BaseObject 20 { 21 public: 22 class Priority 23 { 24 public: 25 void setPriorityName(unsigned int level, const std::string& name) 26 { 27 if (_priorityName.size() <= level) 28 _priorityName.resize(level+1); 29 _priorityName[level] = name; 30 } 31 private: 32 std::vector<std::string> _priorityName; 33 }; 39 34 40 public: 41 Resource(const std::string& fileName); 35 36 class Type 37 { 38 public: 39 Type(const NewClassID& classID) : _classID(classID) { }; 40 41 void addExtension(const std::string& extension); 42 43 private: 44 const NewClassID& _classID; 45 std::vector<std::string> _resourcePaths; 46 std::vector<std::string> _resourceSubPaths; 47 std::vector<std::string> _fileExtensions; 48 49 }; 50 51 52 public: 53 Resource(const std::string& fileName); 42 54 virtual ~Resource(); 43 55 … … 46 58 virtual bool unload(); 47 59 48 private:49 std::string fileName;50 60 51 unsigned int referenceCount; //!< How many times this Resource has been loaded. 52 /// TODO REMOVE THIS: ResourceType type; //!< ResourceType of this Resource. 53 ResourcePriority prio; //!< The Priority of this resource. (can only be increased, so noone else will delete this) 61 private: 54 62 55 MultiType param[3]; //!< The Parameters given to this Resource. 63 static std::vector<std::vector<std::string> > _resourcePaths; 64 65 static std::vector<std::string> _resourceClassNames; 66 67 //! GLOBALS 68 static std::string _mainGlobalPath; 69 static std::vector<std::string> _globalPaths; 70 71 std::string fileName; 72 73 unsigned int referenceCount; //!< How many times this Resource has been loaded. 74 /// TODO REMOVE THIS: ResourceType type; //!< ResourceType of this Resource. 75 ResourcePriority prio; //!< The Priority of this resource. (can only be increased, so noone else will delete this) 76 77 MultiType param[3]; //!< The Parameters given to this Resource. 56 78 }; 57 79
Note: See TracChangeset
for help on using the changeset viewer.