Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4827 in orxonox.OLD for orxonox/trunk/src/util/state.h


Ignore:
Timestamp:
Jul 9, 2005, 12:48:50 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: state is no more singleton, but static class.
This is faster, and easier to handle, because one can just say State::getBLA() and not State::getInstance()→getBLA(); ——→>> less redundant

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/state.h

    r4746 r4827  
    1111// FORWARD DEFINITION
    1212class PNode;
     13class WorldEntity;
     14template<class T> class tList;
    1315
    1416//! A Singleton class, that handles some states about orxonox's objects
     
    1618
    1719 public:
    18   /** \returns a Pointer to the only object of this Class */
    19   inline static State* getInstance() { if (!singletonRef) singletonRef = new State();  return singletonRef; };
     20  // CAMERA //
     21  /** @param camera the PNode to the Camera, @param cameraTarget the PNode to the Camera's target */
     22  static void setCamera(const PNode* camera, const PNode* cameraTarget);
     23  /** @returns a Pointer to the PNode of the Camera */
     24  static inline const PNode* getCamera() { return State::camera; };
     25  /** @returns a Pointer to the CameraTarget */
     26  static inline const PNode* getCameraTarget() { return State::cameraTarget; };
    2027
    21   virtual ~State();
    22 
    23   void setCamera(const PNode* camera, const PNode* cameraTarget);
    24   /** \returns a Pointer to the PNode of the Camera */
    25   const PNode* getCamera() const { return this->camera; };
    26   /** \returns a Pointer to the CameraTarget */
    27   const PNode* getCameraTarget() const { return this->cameraTarget; };
     28  // WORLD_ENTITY_LIST //
     29  /** @param worldEntityList The World's List of WorldEntities */
     30  static inline void setWorldEntityList(tList<WorldEntity>* worldEntityList) { State::worldEntityList = worldEntityList; };
     31  /** @returns the List of WorldEntities */
     32  static inline tList<WorldEntity>* getWorldEntityList() { return State::worldEntityList; };
    2833
    2934 private:
    3035  State();
    31   static State*       singletonRef;       //!< a reference to this class
    3236
    33   const PNode*        camera;             //!< A reference to the camera
    34   const PNode*        cameraTarget;       //!< a reference to the cameraTarget
     37  static const PNode*           camera;             //!< A reference to the camera
     38  static const PNode*           cameraTarget;       //!< a reference to the cameraTarget
     39
     40  static tList<WorldEntity>*    worldEntityList;    //!< The List of the worldEntities
    3541};
    3642
Note: See TracChangeset for help on using the changeset viewer.