Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9718 was 9718, checked in by bensch, 18 years ago

more thoughts on Resources, and soon going to adapt… i think i've got a clue :)

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 */
19class Resource : virtual public BaseObject
20{
21  ObjectListDeclaration(Resource);
22public:
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
51public:
52  Resource(const std::string& fileName);
53  virtual ~Resource();
54
55  virtual bool load(std::string& fileName, const MultiType& param1, const MultiType& param2);
56  virtual bool reload();
57  virtual bool unload();
58
59
60private:
61  std::string              _fileName;
62  MultiType                _parameters[3];          //!< The Parameters given to this Resource.
63  Resource::KeepLevel      _keepLevel;              //!< The Priority of this resource. (can only be increased, so noone else will delete this)
64
65
66  static std::vector<Resource::Type>     _resourceTypes;
67
68  //! GLOBALS
69  static std::string                     _mainGlobalPath;
70  static std::vector<std::string>        _globalPaths;
71};
72
73#endif /* _RESOURCE_H */
Note: See TracBrowser for help on using the repository browser.