Changeset 4293 in orxonox.OLD for orxonox/branches/physics/src/util
- Timestamp:
- May 26, 2005, 10:34:14 AM (20 years ago)
- Location:
- orxonox/branches/physics/src/util
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/util/state.cc
r4289 r4293 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 14 */ … … 16 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY 17 17 18 #include " proto_singleton.h"18 #include "state.h" 19 19 20 20 using namespace std; … … 24 24 \brief standard constructor 25 25 */ 26 ProtoSingleton::ProtoSingleton()26 State::State () 27 27 { 28 this->setClassName (" ProtoSingleton");28 this->setClassName ("State"); 29 29 30 this->camera = NULL; 31 this->cameraTarget = NULL; 30 32 } 31 33 … … 33 35 \brief the singleton reference to this class 34 36 */ 35 ProtoSingleton* ProtoSingleton::singletonRef = NULL;37 State* State::singletonRef = NULL; 36 38 37 39 /** 38 40 \returns a Pointer to this Class 39 41 */ 40 ProtoSingleton* ProtoSingleton::getInstance(void)42 State* State::getInstance(void) 41 43 { 42 if (! ProtoSingleton::singletonRef)43 ProtoSingleton::singletonRef = new ProtoSingleton();44 return ProtoSingleton::singletonRef;44 if (!State::singletonRef) 45 State::singletonRef = new State(); 46 return State::singletonRef; 45 47 } 46 48 … … 49 51 50 52 */ 51 ProtoSingleton::~ProtoSingleton()53 State::~State () 52 54 { 53 ProtoSingleton::singletonRef = NULL;55 State::singletonRef = NULL; 54 56 55 57 } 58 59 /** 60 \sets camera and target of the current Camera 61 */ 62 void State::setCamera(const PNode* camera, const PNode* cameraTarget) 63 { 64 this->camera = camera; 65 this->cameraTarget = cameraTarget; 66 } -
orxonox/branches/physics/src/util/state.h
r4289 r4293 1 1 /*! 2 2 \file proto_singleton.h 3 \brief Definition of the ...singleton Class3 \brief Definition of the States-singleton Class 4 4 5 5 */ 6 6 7 #ifndef _ PROTO_SINGLETON_H8 #define _ PROTO_SINGLETON_H7 #ifndef _STATE_H 8 #define _STATE_H 9 9 10 10 #include "base_object.h" 11 11 12 12 // FORWARD DEFINITION 13 class PNode; 13 14 14 //! A default singleton class.15 class ProtoSingleton: public BaseObject {15 //! A Singleton class, that handles some states about orxonox's objects 16 class State : public BaseObject { 16 17 17 18 public: 18 static ProtoSingleton* getInstance(void); 19 virtual ~ProtoSingleton(void); 19 static State* getInstance(void); 20 virtual ~State(void); 21 22 void setCamera(const PNode* camera, const PNode* cameraTarget); 23 const PNode* getCamera(void) const { return this->camera; }; 24 const PNode* getCameraTarget(void) const { return this->cameraTarget; }; 20 25 21 26 private: 22 ProtoSingleton(void); 23 static ProtoSingleton* singletonRef; 27 State(void); 28 static State* singletonRef; 29 30 const PNode* camera; 31 const PNode* cameraTarget; 24 32 }; 25 33 26 #endif /* _ PROTO_SINGLETON_H */34 #endif /* _STATE_H */
Note: See TracChangeset
for help on using the changeset viewer.