Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/util/resource_manager.h @ 3655

Last change on this file since 3655 was 3655, checked in by bensch, 19 years ago

orxonox/trunk: moved protoclass to folder proto
added protosingleton
added resourceManager
modiefied some stuff to work better

File size: 1.6 KB
Line 
1/*!
2    \file resource_manager.h
3    \brief The Resource Manager checks if a file/resource is loaded.
4
5    If a file/resource was already loaded the resourceManager will
6    return a void pointer to the desired resource.
7    Otherwise it will instruct the coresponding resource-loader to load,
8    and receive a pointer to it.
9*/
10
11#ifndef _RESOURCE_MANAGER_H
12#define _RESOURCE_MANAGER_H
13
14#include "base_object.h"
15
16// FORWARD DEFINITION \\
17
18
19enum ResourceType {OBJ, WAV, MP3, OGG, IMAGE};
20
21//! The ResourceManager is a class, that decides if a file/resource should be loaded
22/**
23   If a file/resource was already loaded the resourceManager will
24   return a void pointer to the desired resource.
25   Otherwise it will instruct the corresponding resource-loader to load,
26   and receive the pointer to it.
27
28   It does it by looking, if a desired file has already been loaded.
29*/
30class ResourceManager : public BaseObject
31{
32 public:
33  static ResourceManager* getInstance();
34  virtual ~ResourceManager();
35
36  bool setDataDir(char* dataDir);
37  static void* load(const char* fileName);
38  static void* load(const char* fileName, ResourceType type);
39
40 private:
41  ResourceManager();
42  static ResourceManager* singletonRef;
43
44
45  struct file;
46  struct folder
47  {
48    char* name;
49    folder** subfolders;             //!<
50    file** files;                    //!< Files in the directory
51  };
52  struct file
53  {
54    char* name;                      //!< exact Name of a file
55    void* pointer;
56  };
57
58  char* dataDir;                     //!< The main data directory
59
60  static bool isDir(const char* directory);
61  static bool isFile(const char* directory); 
62};
63
64#endif /* _RESOURCE_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.