Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/util/loading/new_resource_manager.h @ 9800

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

namespaces

File size: 2.3 KB
Line 
1/*!
2 * @file new_resource_manager.h
3 */
4
5#ifndef _NEW_RESOURCE_MANAGER_H
6#define _NEW_RESOURCE_MANAGER_H
7
8#include "resource.h"
9#include "filesys/file.h"
10#include "filesys/directory.h"
11
12namespace Resources
13{
14
15  class NewResourceManager : public BaseObject
16  {
17    ObjectListDeclaration(NewResourceManager);
18  public:
19    /** @returns a Pointer to the only object of this Class */
20    inline static NewResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new NewResourceManager();  return _singletonRef; };
21  inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; };
22
23
24    void setMainGlobalPath(const Directory& directory);
25    void addGlobalPath(const Directory& directory);
26
27    bool addResourcePath(const std::string& resourceName, const std::string& pathName);
28    bool addResourceSubPath(const std::string& resourceName, const std::string& pathName);
29    void registerType(Resources::Type* type);
30    void unregisterType(Resources::Type* type);
31
32    unsigned int addKeepLevelName(const std::string& keepLevelName);
33    unsigned int getKeepLevelID(const std::string& keepLevelName) const;
34    const std::string& getKeepLevelName(unsigned int keepLevelID) const;
35
36  const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; };
37    const Directory& mainGlobalPath() const { return _mainGlobalPath; };
38    /** @returns all global paths without mainGlobalPath */
39    const std::vector<Directory>& globalPaths() const { return _globalPaths; };
40
41
42    bool checkFileInMainPath(const File& fileInside);
43
44    bool unloadAllByKeepLevel(const Resources::KeepLevel& keepLevel);
45
46    void debug() const;
47
48    // utility functions for handling files in and around the data-directory
49    static std::string getFullName(const std::string& fileName);
50    static bool isInDataDir(const std::string& fileName);
51  private:
52    NewResourceManager();
53    virtual ~NewResourceManager();
54
55  private:
56    static NewResourceManager*         _singletonRef;       //!< singleton Reference
57
58    std::vector<Resources::Type*>      _resourceTypes;
59    //! GLOBALS
60    Directory                          _mainGlobalPath;
61    std::vector<Directory>             _globalPaths;
62
63    std::vector<std::string>           _keepLevelNames;
64  };
65
66}
67
68#endif /* _RESOURCE_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.