Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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/lib
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/event/event_handler.cc

    r4457 r4519  
    5555*/
    5656EventHandler* EventHandler::singletonRef = NULL;
    57 
    58 
    59 /**
    60    \returns a Pointer to this Class
    61 */
    62 EventHandler* EventHandler::getInstance(void)
    63 {
    64   if (!EventHandler::singletonRef)
    65     EventHandler::singletonRef = new EventHandler();
    66   return EventHandler::singletonRef;
    67 }
    6857
    6958
  • orxonox/trunk/src/lib/event/event_handler.h

    r4457 r4519  
    1919
    2020 public:
    21   static EventHandler* getInstance(void);
    2221  virtual ~EventHandler(void);
     22  /** \returns a Pointer to the only object of this Class */
     23  inline static EventHandler* getInstance(void) { if (!singletonRef) singletonRef = new EventHandler();  return singletonRef; };
    2324  void init();
    2425
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r4458 r4519  
    4747*/
    4848GraphicsEngine* GraphicsEngine::singletonRef = NULL;
    49 
    50 /**
    51    \returns A pointer to this GraphicsEngine
    52 */
    53 GraphicsEngine* GraphicsEngine::getInstance()
    54 {
    55   if (!GraphicsEngine::singletonRef)
    56     GraphicsEngine::singletonRef = new GraphicsEngine();
    57   return GraphicsEngine::singletonRef;
    58 }
    59 
    6049
    6150/**
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r4458 r4519  
    2525{
    2626 public:
    27   static GraphicsEngine* getInstance();
    2827  virtual ~GraphicsEngine();
     28  /** \returns a Pointer to the only object of this Class */
     29  inline static GraphicsEngine* getInstance(void) { if (!singletonRef) singletonRef = new GraphicsEngine();  return singletonRef; };
    2930
    3031  int initVideo();
  • orxonox/trunk/src/lib/graphics/light.cc

    r4471 r4519  
    251251*/
    252252LightManager* LightManager::singletonRef = NULL;
    253 
    254 
    255 /**
    256    \returns The Instance of the Lights
    257 */
    258 LightManager* LightManager::getInstance(void)
    259 {
    260   if (!singletonRef)
    261     LightManager::singletonRef = new LightManager();
    262   return singletonRef;
    263 }
    264 
    265253
    266254/**
  • orxonox/trunk/src/lib/graphics/light.h

    r4469 r4519  
    106106 public:
    107107  virtual ~LightManager(void);
    108   static LightManager* getInstance();
     108  /** \returns a Pointer to the only object of this Class */
     109  inline static LightManager* getInstance(void) { if (!singletonRef) singletonRef = new LightManager();  return singletonRef; };
    109110
    110111  // set Attributes
  • orxonox/trunk/src/lib/graphics/text_engine.cc

    r4518 r4519  
    814814
    815815/**
    816    \returns a Pointer to this Class
    817 */
    818 TextEngine* TextEngine::getInstance(void)
    819 {
    820   if (!TextEngine::singletonRef)
    821     TextEngine::singletonRef = new TextEngine();
    822   return TextEngine::singletonRef;
    823 }
    824 
    825 /**
    826816   \brief standard deconstructor
    827817
  • orxonox/trunk/src/lib/graphics/text_engine.h

    r4458 r4519  
    205205{
    206206 public:
    207   static TextEngine* getInstance(void);
    208207  virtual ~TextEngine(void);
     208  /** \returns a Pointer to the only object of this Class */
     209  inline static TextEngine* getInstance(void) { if (!singletonRef) singletonRef = new TextEngine();  return singletonRef; };
    209210
    210211  Text* createText(const char* fontFile,
  • orxonox/trunk/src/lib/particles/particle_engine.cc

    r4478 r4519  
    4343*/
    4444ParticleEngine* ParticleEngine::singletonRef = NULL;
    45 
    46 /**
    47    \returns a Pointer to this Class
    48 */
    49 ParticleEngine* ParticleEngine::getInstance(void)
    50 {
    51   if (!ParticleEngine::singletonRef)
    52     ParticleEngine::singletonRef = new ParticleEngine();
    53   return ParticleEngine::singletonRef;
    54 }
    5545
    5646/**
  • orxonox/trunk/src/lib/particles/particle_engine.h

    r4478 r4519  
    3030
    3131 public:
    32   static ParticleEngine* getInstance(void);
    3332  virtual ~ParticleEngine(void);
     33  /** \returns a Pointer to the only object of this Class */
     34  inline static ParticleEngine* getInstance(void) { if (!singletonRef) singletonRef = new ParticleEngine();  return singletonRef; };
    3435
    3536  void tick(float dt);
  • orxonox/trunk/src/lib/physics/physics_engine.cc

    r4396 r4519  
    4141*/
    4242PhysicsEngine* PhysicsEngine::singletonRef = NULL;
    43 
    44 /**
    45    \returns a Pointer to this Class
    46 */
    47 PhysicsEngine* PhysicsEngine::getInstance(void)
    48 {
    49   if (!PhysicsEngine::singletonRef)
    50     PhysicsEngine::singletonRef = new PhysicsEngine();
    51   return PhysicsEngine::singletonRef;
    52 }
    5343
    5444/**
  • orxonox/trunk/src/lib/physics/physics_engine.h

    r4394 r4519  
    2222
    2323 public:
    24   static PhysicsEngine* getInstance(void);
    2524  virtual ~PhysicsEngine(void);
     25  /** \returns a Pointer to the only object of this Class */
     26  inline static PhysicsEngine* getInstance(void) { if (!singletonRef) singletonRef = new PhysicsEngine();  return singletonRef; };
    2627
    2728  void addPhysicsInterface(PhysicsInterface* physicsInterface);
  • orxonox/trunk/src/lib/sound/sound_engine.cc

    r4506 r4519  
    174174*/
    175175SoundEngine* SoundEngine::singletonRef = NULL;
    176 
    177 /**
    178    \returns a Pointer to this Class
    179 */
    180 SoundEngine* SoundEngine::getInstance(void)
    181 {
    182   if (!SoundEngine::singletonRef)
    183     SoundEngine::singletonRef = new SoundEngine();
    184   return SoundEngine::singletonRef;
    185 }
    186176
    187177/**
  • orxonox/trunk/src/lib/sound/sound_engine.h

    r4506 r4519  
    7171
    7272 public:
    73   static SoundEngine* getInstance(void);
    7473  virtual ~SoundEngine(void);
     74  /** \returns a Pointer to the only object of this Class */
     75  inline static SoundEngine* getInstance(void) { if (!singletonRef) singletonRef = new SoundEngine();  return singletonRef; };
    7576
    7677  SoundSource* createSource(const char* fileName, PNode* sourceNode = NULL);
Note: See TracChangeset for help on using the changeset viewer.