Last change
on this file since 9770 was
9758,
checked in by bensch, 18 years ago
|
orxonox/new_class_id: moved the Particle-engine
|
File size:
1.7 KB
|
Line | |
---|
1 | /*! |
---|
2 | * @file resource.h |
---|
3 | * @brief Definition of a Resource. |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _RESOURCE_H |
---|
7 | #define _RESOURCE_H |
---|
8 | |
---|
9 | #include "base_object.h" |
---|
10 | #include "multi_type.h" |
---|
11 | #include <string> |
---|
12 | #include <vector> |
---|
13 | #include <set> |
---|
14 | |
---|
15 | //! A Resource is an Object, that can be loaded from Disk |
---|
16 | /** |
---|
17 | * |
---|
18 | */ |
---|
19 | class Resource : virtual public BaseObject |
---|
20 | { |
---|
21 | ObjectListDeclaration(Resource); |
---|
22 | public: |
---|
23 | class KeepLevel |
---|
24 | { |
---|
25 | public: |
---|
26 | void setKeepLevelName(unsigned int level, const std::string& name) |
---|
27 | { |
---|
28 | if (_keepLevelName.size() <= level) |
---|
29 | _keepLevelName.resize(level+1); |
---|
30 | _keepLevelName[level] = name; |
---|
31 | } |
---|
32 | private: |
---|
33 | std::vector<std::string> _keepLevelName; |
---|
34 | }; |
---|
35 | |
---|
36 | |
---|
37 | class Type |
---|
38 | { |
---|
39 | public: |
---|
40 | Type(const ClassID& classID) : _classID(classID) { }; |
---|
41 | |
---|
42 | void addExtension(const std::string& extension); |
---|
43 | |
---|
44 | private: |
---|
45 | const ClassID& _classID; |
---|
46 | std::vector<std::string> _resourcePaths; |
---|
47 | std::vector<std::string> _resourceSubPaths; |
---|
48 | std::vector<std::string> _fileExtensions; |
---|
49 | }; |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | public: |
---|
54 | Resource(const std::string& fileName); |
---|
55 | virtual ~Resource(); |
---|
56 | |
---|
57 | virtual bool load(std::string& fileName, const MultiType& param1, const MultiType& param2); |
---|
58 | virtual bool reload(); |
---|
59 | virtual bool unload(); |
---|
60 | |
---|
61 | |
---|
62 | private: |
---|
63 | std::string _fileName; |
---|
64 | MultiType _parameters[3]; //!< The Parameters given to this Resource. |
---|
65 | Resource::KeepLevel _keepLevel; //!< The Priority of this resource. (can only be increased, so noone else will delete this) |
---|
66 | |
---|
67 | |
---|
68 | static std::vector<Resource::Type> _resourceTypes; |
---|
69 | |
---|
70 | //! GLOBALS |
---|
71 | static std::string _mainGlobalPath; |
---|
72 | static std::vector<std::string> _globalPaths; |
---|
73 | }; |
---|
74 | |
---|
75 | #endif /* _RESOURCE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.