Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

new_class_id: more doxy-tags, and some default values

File size: 2.6 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    /** @brief deletes the Instance if it exists. */
22    inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; };
23
24
25    void setMainGlobalPath(const Directory& directory);
26    void addGlobalPath(const Directory& directory);
27
28    bool addResourcePath(const std::string& resourceName, const std::string& pathName);
29    bool addResourceSubPath(const std::string& resourceName, const std::string& pathName);
30    void registerType(Resources::Type* type);
31    void unregisterType(Resources::Type* type);
32
33    unsigned int addKeepLevelName(const std::string& keepLevelName);
34    unsigned int getKeepLevelID(const std::string& keepLevelName) const;
35    const std::string& getKeepLevelName(unsigned int keepLevelID) const;
36
37    /** @returns the Types of Resources */
38    const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; };
39    /** @returns the main global search Path */
40    const Directory& mainGlobalPath() const { return _mainGlobalPath; };
41    /** @returns all global paths without mainGlobalPath */
42    const std::vector<Directory>& globalPaths() const { return _globalPaths; };
43
44
45    bool checkFileInMainPath(const File& fileInside);
46
47    bool unloadAllByKeepLevel(const Resources::KeepLevel& keepLevel);
48
49    void debug() const;
50
51    // utility functions for handling files in and around the data-directory
52    static std::string getFullName(const std::string& fileName);
53    static bool isInDataDir(const std::string& fileName);
54  private:
55    NewResourceManager();
56    virtual ~NewResourceManager();
57
58  private:
59    static NewResourceManager*         _singletonRef;       //!< singleton Reference
60
61    Directory                          _mainGlobalPath;     //!< The main include directory (default at "./")
62    std::vector<Directory>             _globalPaths;        //!< Additional Global include directories.
63
64    std::vector<Resources::Type*>      _resourceTypes;      //!< A Vector of all the stored ResourceTypes @see Resources::Type
65    std::vector<std::string>           _keepLevelNames;     //!< Names of KeepLevels @see Resources::KeepLevel
66  };
67
68}
69
70#endif /* _RESOURCE_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.