Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

ResourceManager now cleans up too

File size: 2.1 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
[9790]12class NewResourceManager : public BaseObject
[4597]13{
[9794]14  ObjectListDeclaration(NewResourceManager);
[9684]15public:
[4836]16  /** @returns a Pointer to the only object of this Class */
[9791]17  inline static NewResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new NewResourceManager();  return _singletonRef; };
[9797]18  inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; };
[1853]19
[9791]20
21  void setMainGlobalPath(const Directory& directory);
22  void addGlobalPath(const Directory& directory);
23
24  bool addResourcePath(const std::string& resourceName, const std::string& pathName);
25  bool addResourceSubPath(const std::string& resourceName, const std::string& pathName);
26  void registerType(Resources::Type* type);
[9799]27  void unregisterType(Resources::Type* type);
[9791]28
[9798]29  unsigned int addKeepLevelName(const std::string& keepLevelName);
30  unsigned int getKeepLevelID(const std::string& keepLevelName) const;
[9799]31  const std::string& getKeepLevelName(unsigned int keepLevelID) const;
[9791]32
33  const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; };
34  const Directory& mainGlobalPath() const { return _mainGlobalPath; };
35  /** @returns all global paths without mainGlobalPath */
36  const std::vector<Directory>& globalPaths() const { return _globalPaths; };
37
38
[9795]39  bool checkFileInMainPath(const File& fileInside);
[6640]40
[9790]41  bool unloadAllByPriority();
[6640]42
[4746]43  void debug() const;
[3245]44
[5480]45  // utility functions for handling files in and around the data-directory
[7221]46  static std::string getFullName(const std::string& fileName);
47  static bool isInDataDir(const std::string& fileName);
[9684]48private:
[9790]49  NewResourceManager();
[9797]50  virtual ~NewResourceManager();
[3245]51
[9684]52private:
[9797]53  static NewResourceManager*         _singletonRef;       //!< singleton Reference
[3672]54
[9797]55  std::vector<Resources::Type*>      _resourceTypes;
[9791]56  //! GLOBALS
[9797]57  Directory                          _mainGlobalPath;
58  std::vector<Directory>             _globalPaths;
[9791]59
[9798]60  std::vector<std::string>           _keepLevelNames;
[1853]61};
62
[3655]63#endif /* _RESOURCE_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.