Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/util/loading/resource.h @ 9714

Last change on this file since 9714 was 9714, checked in by bensch, 19 years ago

some thoughts on Resources

File size: 1.9 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 */
19class Resource : virtual public BaseObject
20{
21public:
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  };
34
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
52public:
53  Resource(const std::string& fileName);
54  virtual ~Resource();
55
56  virtual bool load(std::string& fileName, const MultiType& param1, const MultiType& param2);
57  virtual bool reload();
58  virtual bool unload();
59
60
61private:
62
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.
78};
79
80#endif /* _RESOURCE_H */
Note: See TracBrowser for help on using the repository browser.