Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

cleaner deletion of NewResourceManager

File size: 1.9 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
12class NewResourceManager : public BaseObject
13{
14  ObjectListDeclaration(NewResourceManager);
15public:
16  /** @returns a Pointer to the only object of this Class */
17  inline static NewResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new NewResourceManager();  return _singletonRef; };
18  inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; };
19
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);
27
28  void addKeepLevel(unsigned int i, const std::string& keepLevel);
29
30  const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; };
31  const Directory& mainGlobalPath() const { return _mainGlobalPath; };
32  /** @returns all global paths without mainGlobalPath */
33  const std::vector<Directory>& globalPaths() const { return _globalPaths; };
34
35
36  bool checkFileInMainPath(const File& fileInside);
37
38  bool unloadAllByPriority();
39
40  void debug() const;
41
42  // utility functions for handling files in and around the data-directory
43  static std::string getFullName(const std::string& fileName);
44  static bool isInDataDir(const std::string& fileName);
45private:
46  NewResourceManager();
47  virtual ~NewResourceManager();
48
49private:
50  static NewResourceManager*         _singletonRef;       //!< singleton Reference
51
52  std::vector<Resources::Type*>      _resourceTypes;
53  //! GLOBALS
54  Directory                          _mainGlobalPath;
55  std::vector<Directory>             _globalPaths;
56
57  std::vector<Resources::KeepLevel>  _keepLevels;
58};
59
60#endif /* _RESOURCE_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.