Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4519 in orxonox.OLD for orxonox/trunk/src/util


Ignore:
Timestamp:
Jun 6, 2005, 2:36:04 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: changed all getInstances into inline functions to save some (minor) time

Location:
orxonox/trunk/src/util
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/collision_detection/cd_engine.cc

    r4511 r4519  
    3636
    3737/**
    38    \returns a Pointer to this Class
    39 */
    40 CDEngine* CDEngine::getInstance(void)
    41 {
    42   if (!CDEngine::singletonRef)
    43     CDEngine::singletonRef = new CDEngine();
    44   return CDEngine::singletonRef;
    45 }
    46 
    47 /**
    4838   \brief standard deconstructor
    4939
  • orxonox/trunk/src/util/collision_detection/cd_engine.h

    r4511 r4519  
    1515
    1616 public:
    17   static CDEngine* getInstance(void);
    1817  virtual ~CDEngine(void);
     18  /** \returns a Pointer to the only object of this Class */
     19  inline static CDEngine* getInstance(void) { if (!singletonRef) singletonRef = new CDEngine();  return singletonRef; };
    1920
    2021 private:
  • orxonox/trunk/src/util/garbage_collector.cc

    r4485 r4519  
    4848  // delete what has to be deleted here
    4949}
    50 
    51 
    52 /**
    53    \brief this returns the singleton reference this this class
    54    \returns singleton reference
    55 */
    56 GarbageCollector* GarbageCollector::getInstance()
    57 {
    58   if( singletonRef == NULL)
    59     singletonRef = new GarbageCollector();
    60   return singletonRef;
    61 }
    62 
    6350
    6451/**
  • orxonox/trunk/src/util/garbage_collector.h

    r4485 r4519  
    2222
    2323 public:
    24   GarbageCollector();
    2524  virtual ~GarbageCollector();
    26   static GarbageCollector* getInstance();
     25  /** \returns a Pointer to the only object of this Class */
     26  inline static GarbageCollector* getInstance(void) { if (!singletonRef) singletonRef = new GarbageCollector();  return singletonRef; };
    2727
    2828  void setCollectionDelay(float delay);
     
    3434
    3535 private:
     36  GarbageCollector();
     37
     38 private:
    3639  static GarbageCollector*    singletonRef;           //!< The reference to this class (singleton)
    3740  float                       delay;                  //!< this is the delay to wait until collection
  • orxonox/trunk/src/util/object_manager.cc

    r4485 r4519  
    4444*/
    4545ObjectManager* ObjectManager::singletonRef = NULL;
    46 
    47 /**
    48    \returns a Pointer to this Class
    49 */
    50 ObjectManager* ObjectManager::getInstance(void)
    51 {
    52   if (!ObjectManager::singletonRef)
    53     ObjectManager::singletonRef = new ObjectManager();
    54   return ObjectManager::singletonRef;
    55 }
    56 
    5746
    5847/**
  • orxonox/trunk/src/util/object_manager.h

    r4485 r4519  
    4848
    4949 public:
    50   static ObjectManager* getInstance(void);
    5150  virtual ~ObjectManager(void);
     51  /** \returns a Pointer to the only object of this Class */
     52  inline static ObjectManager* getInstance(void) { if (!singletonRef) singletonRef = new ObjectManager();  return singletonRef; };
    5253 
    5354  /** a class handled by the objectManage */
  • orxonox/trunk/src/util/resource_manager.cc

    r4504 r4519  
    4646   this->imageDirs = new tList<char>();
    4747   this->resourceList = new tList<Resource>();
    48 }
    49 
    50 /**
    51    \returns the Instance to this ResourceManager
    52 */
    53 ResourceManager* ResourceManager::getInstance(void)
    54 {
    55   if (!ResourceManager::singletonRef)
    56     ResourceManager::singletonRef = new ResourceManager();
    57   return ResourceManager::singletonRef;
    5848}
    5949
  • orxonox/trunk/src/util/resource_manager.h

    r4465 r4519  
    7474 public:
    7575  virtual ~ResourceManager();
    76 
    77   static ResourceManager* getInstance();
     76  /** \returns a Pointer to the only object of this Class */
     77  inline static ResourceManager* getInstance(void) { if (!singletonRef) singletonRef = new ResourceManager();  return singletonRef; };
    7878
    7979  bool setDataDir(const char* dataDir);
Note: See TracChangeset for help on using the changeset viewer.