Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3543 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Mar 14, 2005, 10:14:41 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: some more classes now destroy themselves via virtual-destructors and call to predecessing destroy-function
also made
#include "stdincl.h" out of unnecessary h-files, so we got faster compile time.

Location:
orxonox/trunk/src
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/camera.cc

    r3537 r3543  
    5151Camera::~Camera ()
    5252{
     53  this->destroy();
     54}
     55
     56/**
     57   \brief deletes all allocated memory
     58*/
     59void Camera::destroy(void)
     60{
     61  this->bound = NULL;
     62  this->world = NULL;
     63
     64  static_cast<WorldEntity*>(this)->destroy();
    5365}
    5466
     
    275287
    276288
    277 /**
    278    \brief destroy, reset the camera so that it doesn't perform anything anymore
    279 
    280 */
    281 void Camera::destroy()
    282 {
    283   this->bound = NULL;
    284   this->world = NULL;
    285 }
  • orxonox/trunk/src/camera.h

    r3365 r3543  
    77#define _CAMERA_H
    88
    9 #include "stdincl.h"
    109#include "world_entity.h"
    11 
    1210
    1311class World;
     
    5654 public:
    5755  Camera (World* world);
    58   ~Camera ();
     56  virtual ~Camera ();
     57  void destroy(void);
    5958 
    6059  void timeSlice (Uint32 deltaT);
    6160  void apply ();
    6261  void bind (WorldEntity* entity);
    63   void destroy();
    6462
    6563  void setWorld(World* world); 
  • orxonox/trunk/src/glmenu/glmenu_imagescreen.cc

    r3536 r3543  
    1919#include "glmenu_imagescreen.h"
    2020
     21#include "stdincl.h"
    2122#include "material.h"
    2223
     
    2728GLMenuImageScreen* GLMenuImageScreen::getInstance()
    2829{
    29   if( singletonRef == NULL)
     30  if(!singletonRef)
    3031    singletonRef = new GLMenuImageScreen ();
    3132  return singletonRef;
     
    4546/**
    4647   \brief standard deconstructor
     48*/
     49GLMenuImageScreen::~GLMenuImageScreen()
     50{
     51  this->destroy();
     52}
     53
     54/**
     55   \brief deletes all alocated Memory and also deletes everything from the Class this one is erived from
    4756
    4857   \todo this deconstructor is not jet implemented - do it
    4958*/
    50 GLMenuImageScreen::~GLMenuImageScreen()
     59void GLMenuImageScreen::destroy(void)
    5160{
    5261  if (backMat)
    5362    delete backMat;
    54 }
    55 
     63
     64  static_cast<BaseObject*>(this)->destroy();
     65}
    5666
    5767/**
  • orxonox/trunk/src/glmenu/glmenu_imagescreen.h

    r3476 r3543  
    88#define _GLMENU_IMAGESCREEN_H
    99
    10 #include "stdincl.h"
    11 class Texture;
     10#include "base_object.h"
     11
    1212class Material;
    1313
     
    1919 public:
    2020  ~GLMenuImageScreen ();
     21  void destroy(void);
    2122
    2223  static GLMenuImageScreen* getInstance();
  • orxonox/trunk/src/keynames.cc

    r3230 r3543  
    1515
    1616#include "keynames.h"
     17
     18#include "stdincl.h"
    1719
    1820#include <string.h>
  • orxonox/trunk/src/keynames.h

    r3230 r3543  
    77#ifndef _KEYNAMES_H
    88#define _KEYNAMES_H
    9 
    10 
    11 #ifdef __WIN32__
    12 #include <windows.h>
    13 #endif
    14 
    15 #ifndef __APPLE__
    16 #include <SDL/SDL.h>
    17 #else
    18 #include <SDL.h>
    19 #endif
    209
    2110/**
  • orxonox/trunk/src/lib/coord/null_parent.cc

    r3533 r3543  
    2626NullParent* NullParent::getInstance ()
    2727{
    28   if( singletonRef == NULL)
     28  if(!singletonRef)
    2929    singletonRef = new NullParent ();
    3030  return singletonRef;
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3537 r3543  
    2222
    2323#include "p_node.h"
     24
    2425#include "null_parent.h"
     26#include "vector.h"
    2527
    2628using namespace std;
  • orxonox/trunk/src/lib/coord/p_node.h

    r3537 r3543  
    2222#define _P_NODE_H
    2323
    24 #include "stdincl.h"
     24#include "base_object.h"
    2525
    26 
     26// FORWARD DEFINITION \\
    2727class PNode; /* forward decleration, so that parentEntry has access to PNode */
     28class Quaternion;
     29class Vector;
    2830
    2931//! enumeration for the different translation-binding-types
  • orxonox/trunk/src/light.cc

    r3453 r3543  
    5252Light::~Light ()
    5353{
     54  this->destroy();
     55}
     56
     57
     58/**
     59   \brief frees all alocated memory
     60
     61   and in this case also deletes the lightSources and GL_LIGHTING
     62*/
     63void Light::destroy(void)
     64{
    5465  glDisable(GL_LIGHTING);
    5566 
     
    5869  delete lights;
    5970  Light::singletonRef = NULL;
    60 }
     71
     72  static_cast<WorldEntity*>(this)->destroy();
     73}
     74
    6175
    6276/**
  • orxonox/trunk/src/light.h

    r3453 r3543  
    6060 public:
    6161  static Light* getInstance();
    62   ~Light(void);
     62  virtual ~Light(void);
     63  void destroy(void);
     64
    6365
    6466  // set Attributes
  • orxonox/trunk/src/orxonox.cc

    r3526 r3543  
    4848Orxonox::~Orxonox ()
    4949{
     50  this->destroy();
     51}
     52
     53/**
     54   \brief destroys orxonox. Frees al memory and so on.
     55*/
     56void Orxonox::destroy(void)
     57{
    5058  Orxonox::singletonRef = NULL;
    5159  if( world != NULL) delete world;
     
    5361  if( localcamera != NULL) delete localcamera;
    5462  if( resources != NULL) delete resources;
    55 }
    56 
     63
     64 
     65}
    5766
    5867/** \brief this is a singleton class to prevent duplicates */
  • orxonox/trunk/src/orxonox.h

    r3449 r3543  
    2424  static Orxonox* singletonRef;
    2525  Orxonox ();
    26   ~Orxonox ();
    27  
     26  virtual ~Orxonox ();
     27  void destroy(void);
     28
    2829  char configfilename[256];   //!< Filename of the configuration-file.
    2930  World* world;               //!< Reference to the current running world.
  • orxonox/trunk/src/proto_class.cc

    r3365 r3543  
    1919#include "proto_class.h"
    2020
     21#include "stdincl.h" // maybe
    2122
    2223using namespace std;
     
    3536/**
    3637   \brief standard deconstructor
    37    \todo this deconstructor is not jet implemented - do it
    3838
    3939*/
    40 ProtoClass::~ProtoClass () {}
     40ProtoClass::~ProtoClass ()
     41{
     42  this->destroy();
     43}
    4144
     45/**
     46   \brief deletes all data and also deletes all data from the class this is derived from
     47*/
     48ProtoClass::~destroy(void)
     49{
     50  // delete what has to be deleted here
     51  static_cast<BaseObject*>(this)->destroy();
     52}
    4253
    4354/**
  • orxonox/trunk/src/proto_class.h

    r3365 r3543  
    1111#define _PROTO_CLASS_H
    1212
    13 #include "stdincl.h"
     13#include "what realy has to be included"
     14#include "base_object.h"
     15
     16// FORWARD DEFINITION \\
     17class someClassWeNeed;
     18
    1419
    1520/*class Test;*/ /* forward definition of class Test (without including it here!)*/
     
    2227
    2328 public:
    24   ProtoClass ();
    25   ~ProtoClass ();
     29  ProtoClass();
     30  virtual ~ProtoClass();
     31  void destroy(void)
    2632
    2733  bool doNonSense (int nothing);
  • orxonox/trunk/src/story_entities/world.cc

    r3539 r3543  
    258258
    259259            //localCamera->setParent(TrackNode::getInstance());
    260             this->localPlayer->addChild (this->localCamera);
     260            TrackNode::getInstance()->addChild (this->localCamera);
    261261            //Vector* cameraOffset = new Vector (0, 5, -10);
    262262            Vector* cameraOffset = new Vector (-10, 5, 0);
  • orxonox/trunk/src/track_manager.cc

    r3540 r3543  
    223223/**
    224224   \brief standard destructor
    225 
    226225*/
    227226TrackManager::~TrackManager(void)
     227{
     228  this->destroy();
     229}
     230
     231/**
     232   \brief deletes all alocated Memory and also deletes everything from the Class this one is erived from
     233*/
     234void TrackManager::destroy(void)
    228235{
    229236  PRINTF(3)("Destruct TrackManager\n");
     
    234241  // we do not have a TrackManager anymore
    235242  singletonRef = NULL;
    236 }
    237 
     243 
     244  static_cast<BaseObject*>(this)->destroy();
     245}
     246
     247//! Singleton Reference to TrackManager
    238248TrackManager* TrackManager::singletonRef = NULL;
    239249
     
    663673
    664674      Vector v(0.0, 1.0, 0.0);
    665       Quaternion q(-1.57, v);
     675      Quaternion q(-PI/2, v);
    666676      //this->relDirection = this->relDirection * q;
    667677      quat = quat * q;
  • orxonox/trunk/src/track_manager.h

    r3527 r3543  
    121121 
    122122 public:
    123   ~TrackManager(void);
     123  virtual ~TrackManager(void);
     124  void destroy(void);
    124125  static TrackManager* getInstance(void);
    125126
Note: See TracChangeset for help on using the changeset viewer.