Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/util/loading/resource_manager.h @ 10569

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

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 3.5 KB
RevLine 
[4597]1/*!
[5039]2 * @file resource_manager.h
[9869]3 */
[3329]4
[3655]5#ifndef _RESOURCE_MANAGER_H
6#define _RESOURCE_MANAGER_H
[1853]7
[9869]8#include "resource.h"
[8330]9#include "filesys/file.h"
[9869]10#include "filesys/directory.h"
[7661]11
[9869]12namespace Resources
[4597]13{
[4462]14
[9869]15  class ResourceManager : public BaseObject
16  {
17    ObjectListDeclaration(ResourceManager);
18  public:
19    ///////////////////////
20    //// INSTANZIATION ////
21    /** @returns a Pointer to the only object of this Class */
22    inline static ResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new ResourceManager();  return _singletonRef; };
23    /** @brief deletes the Instance if it exists. */
24    inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; };
[3543]25
[9869]26    ////////////////////////
27    //// RESOURCE PATHS ////
28    void setMainGlobalPath(const Directory& directory);
29    void addGlobalPath(const Directory& directory);
[4597]30
[9869]31    bool addResourcePath(const std::string& resourceName, const std::string& pathName);
32    bool addResourceSubPath(const std::string& resourceName, const std::string& pathName);
33    void registerType(Resources::Type* type);
34    void unregisterType(Resources::Type* type);
[3790]35
[9869]36    /** @returns the main global search Path */
37    const Directory& mainGlobalPath() const { return _mainGlobalPath; };
38    /** @returns all global paths without mainGlobalPath */
39    const std::vector<Directory>& globalPaths() const { return _globalPaths; };
[3543]40
[9869]41    ////////////////////
42    //// KEEPLEVELS ////
43    unsigned int addKeepLevelName(const std::string& keepLevelName);
44    unsigned int getKeepLevelID(const std::string& keepLevelName) const;
45    const std::string& getKeepLevelName(unsigned int keepLevelID) const;
46    void setDefaultKeepLevel(const KeepLevel& keepLevel) { this->_defaultKeepLevel = keepLevel; };
47    const KeepLevel& defaultKeepLevel() const { return this->_defaultKeepLevel; };
[2036]48
[9869]49    //////////////////////////
50    //// GENERAL QUERIES ////
51    /** @returns the Types of Resources */
52    const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; };
[1853]53
[9869]54    bool checkFileInMainPath(const File& fileInside);
55    std::string prependAbsoluteMainPath(const std::string& fileName);
[4166]56
[9869]57    ////////////////////////////////////////
58    //// RESOURCE LOADING AND UNLOADING ////
59    void loadFromLoadString(const std::string& resourceTypeName, const std::string& loadString, const KeepLevel& keepLevel = KeepLevel());
60    void loadFromLoadStringHACK(const std::string& resourceTypeName, const std::string& loadString) { this->loadFromLoadString(resourceTypeName, loadString); };
[5480]61
[9869]62    void unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel);
63    void unloadAllBelowKeepLevelINT(unsigned int level) { unloadAllBelowKeepLevel(level); };
[6640]64
[9869]65    ///////////////
66    //// DEBUG ////
67    void debug() const;
[6640]68
[9869]69  private:
70    ResourceManager();
71    virtual ~ResourceManager();
[4597]72
[9869]73  private:
74    static ResourceManager*            _singletonRef;       //!< singleton Reference
[5994]75
[9869]76    Directory                          _mainGlobalPath;     //!< The main include directory (default at "./")
77    std::vector<Directory>             _globalPaths;        //!< Additional Global include directories.
[6648]78
[9869]79    std::vector<Resources::Type*>      _resourceTypes;      //!< A Vector of all the stored ResourceTypes @see Resources::Type
[3245]80
[9869]81    std::vector<std::string>           _keepLevelNames;     //!< Names of KeepLevels @see Resources::KeepLevel
82    KeepLevel                          _defaultKeepLevel;   //!< The default KeepLevel.
83  };
[4597]84
[9869]85}
[3983]86
[3655]87#endif /* _RESOURCE_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.