Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/new_class_id: almost killed off the old ResourceManager

File size: 2.7 KB
RevLine 
[4597]1/*!
[9790]2 * @file new_resource_manager.h
3 */
[3329]4
[9790]5#ifndef _NEW_RESOURCE_MANAGER_H
6#define _NEW_RESOURCE_MANAGER_H
[4534]7
[9790]8#include "resource.h"
[8330]9#include "filesys/file.h"
[9790]10#include "filesys/directory.h"
[7661]11
[9800]12namespace Resources
[4597]13{
[9800]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; };
[9802]21    /** @brief deletes the Instance if it exists. */
22    inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; };
[1853]23
[9791]24
[9800]25    void setMainGlobalPath(const Directory& directory);
26    void addGlobalPath(const Directory& directory);
[9791]27
[9800]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);
[9791]32
[9800]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;
[9791]36
[9802]37    /** @returns the Types of Resources */
38    const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; };
39    /** @returns the main global search Path */
[9800]40    const Directory& mainGlobalPath() const { return _mainGlobalPath; };
41    /** @returns all global paths without mainGlobalPath */
42    const std::vector<Directory>& globalPaths() const { return _globalPaths; };
[9791]43
44
[9800]45    bool checkFileInMainPath(const File& fileInside);
[9833]46    std::string prependAbsoluteMainPath(const std::string& fileName);
[6640]47
[9800]48    bool unloadAllByKeepLevel(const Resources::KeepLevel& keepLevel);
[6640]49
[9800]50    void debug() const;
[3245]51
[9800]52    // utility functions for handling files in and around the data-directory
53    static std::string getFullName(const std::string& fileName);
54    static bool isInDataDir(const std::string& fileName);
55  private:
56    NewResourceManager();
57    virtual ~NewResourceManager();
[3245]58
[9800]59  private:
60    static NewResourceManager*         _singletonRef;       //!< singleton Reference
[3672]61
[9802]62    Directory                          _mainGlobalPath;     //!< The main include directory (default at "./")
63    std::vector<Directory>             _globalPaths;        //!< Additional Global include directories.
[9791]64
[9802]65    std::vector<Resources::Type*>      _resourceTypes;      //!< A Vector of all the stored ResourceTypes @see Resources::Type
66    std::vector<std::string>           _keepLevelNames;     //!< Names of KeepLevels @see Resources::KeepLevel
[9800]67  };
[1853]68
[9800]69}
70
[3655]71#endif /* _RESOURCE_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.