Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 26, 2005, 3:28:39 PM (19 years ago)
Author:
bensch
Message:

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

File:
1 moved

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/util/resource_manager.h

    r3645 r3655  
    11/*!
    2     \file proto_class.h
    3     \brief Definition of the proto class template, used quickly start work
    4     \todo Example: this shows how to use simply add a Marker that here has to be done something.
     2    \file resource_manager.h
     3    \brief The Resource Manager checks if a file/resource is loaded.
    54
    6     The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
    7     It is an example for the CODING-CONVENTION, and a starting-point for every class.
     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.
    89*/
    910
    10 #ifndef _PROTO_CLASS_H
    11 #define _PROTO_CLASS_H
     11#ifndef _RESOURCE_MANAGER_H
     12#define _RESOURCE_MANAGER_H
    1213
    13 #include "what realy has to be included"
    1414#include "base_object.h"
    1515
    1616// FORWARD DEFINITION \\
    17 class someClassWeNeed;
    1817
    1918
    20 /*class Test;*/ /* forward definition of class Test (without including it here!)*/
     19enum ResourceType {OBJ, WAV, MP3, OGG, IMAGE};
    2120
    22 //! A default class that aids you to start creating a new class
     21//! The ResourceManager is a class, that decides if a file/resource should be loaded
    2322/**
    24    here can be some longer description of this class
     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.
    2529*/
    26 class ProtoClass : public BaseObject {
     30class ResourceManager : public BaseObject
     31{
     32 public:
     33  static ResourceManager* getInstance();
     34  virtual ~ResourceManager();
    2735
    28  public:
    29   ProtoClass();
    30   virtual ~ProtoClass();
    31 
    32   bool doNonSense (int nothing);
     36  bool setDataDir(char* dataDir);
     37  static void* load(const char* fileName);
     38  static void* load(const char* fileName, ResourceType type);
    3339
    3440 private:
    35   int nonSense;  //!< doxygen tag here like this for all the variables - delete this variable if you use this
     41  ResourceManager();
     42  static ResourceManager* singletonRef;
    3643
     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); 
    3762};
    3863
    39 #endif /* _PROTO_CLASS_H */
     64#endif /* _RESOURCE_MANAGER_H */
Note: See TracChangeset for help on using the changeset viewer.