Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4591 in orxonox.OLD


Ignore:
Timestamp:
Jun 10, 2005, 6:21:25 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: restructure class_list.h so it supports inheritance-diagram

Location:
orxonox/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/orxonox.kdevelop

    r4564 r4591  
    2727      <envvars/>
    2828      <runarguments>
    29         <orxonox></orxonox>
     29        <orxonox/>
    3030      </runarguments>
    3131    </run>
     
    156156    </groups>
    157157    <tree>
    158       <hidepatterns>*.o,*.lo,CVS</hidepatterns>
     158      <hidepatterns>*.o,*.a,Makefile.in,Makefile,*~</hidepatterns>
    159159      <hidenonprojectfiles>false</hidenonprojectfiles>
    160160    </tree>
  • orxonox/trunk/src/defs/class_list.h

    r4571 r4591  
     1/*
     2   orxonox - the future of 3D-vertical-scrollers
     3
     4   Copyright (C) 2004 orx
     5
     6   This program is free software; you can redistribute it and/or modify
     7   it under the terms of the GNU General Public License as published by
     8   the Free Software Foundation; either version 2, or (at your option)
     9   any later version.
     10
     11### File Specific:
     12   main-programmer: Patrick Boenzli
     13   co-programmer: Benjamin Grauer
     14
     15*/
     16
    117/*!
    218    \file class_list.h
    319    \brief list of orxonox classes
    420
    5     this is used by the ObjectManager to identify and load important classes
     21    this File is used to identify an Object with its class and also with its subclasses.
     22    this is also used by the ObjectManager to identify and load important classes
    623*/
    724
     
    1128
    1229//! list of all classes to be loadable in via the ObjectManager
    13 typedef enum classList
     30/**
     31 * inheritance is done in the following way: Classes are identified by
     32 * a HEX-number eg: 0x12345678
     33 * The number has 8x16 entries.
     34 * The first two: 1,2 superclass identifiers to
     35 * The second three are for subclasses with inheritance
     36 * These two may not be the same in any way,
     37 * eg. the bits may not intersect (no 1, 2 and a 3; 1,2 and 4 would be ok)
     38 * The last three entries are for any classes in existence eg. SkyBox and so on
     39 *
     40 * \todo complete this List
     41*/
     42typedef enum ClassID
    1443{
    15   CL_ORXONOX,
     44  // superclasses
     45  CL_MASK_SUPERCLASS      =    0xff000000,
     46  CL_BASE_OBJECT          =    0x01000000,
     47  CL_PARENT_NODE          =    0x02000000,
     48  CL_WORLD_ENTITY         =    0x04000000,
     49  CL_STORY_ENTITY         =    0x08000000,
    1650
    17   CL_PARENT,
    18   CL_NULL_PARENT,
    19   CL_CAMERA,
    20   CL_CAMERA_TARGET,
    21   CL_PILOT_PARENT,
     51  // subsuper-classes
     52  CL_PLAYER               =    0x00001000,
     53  CL_NPC                  =    0x00002000,
     54  CL_POWER_UP             =    0x00004000,
     55  CL_FIELD                =    0x00008000,
     56  CL_PROJECTILE           =    0x00010000,
     57  CL_WEAPON               =    0x00020000,
    2258
    23   CL_WORLD_ENTITY,
    24   CL_ENVIRONEMENT,
    25   CL_NPC,
    26   CL_PLAYER,
    27   CL_POWER_UP,
    28   CL_PROJECTILE,
    29   CL_SATELLITE,
    30   CL_SKYBOX,
    31   CL_SKYSPHERE,
    32   CL_TERRAIN,
    33   CL_TEST_BULLET,
    34   CL_TEST_ENTITY,
    35   CL_TEST_GUN,
    36   CL_WEAPON,
     59
     60  // singleton classes (range from 0x00000001 to 0x000000ff)
     61  CL_MASK_SINGLETON       =    0x0000003f,
     62  CL_ORXONOX              =    0x00000001,
     63  CL_NULL_PARENT          =    0x00000002,
     64  CL_PILOT_PARENT         =    0x00000003,
     65
     66  CL_OBJECT_MANAGER       =    0x00000004,
     67  CL_RESOURCE_MANAGER     =    0x00000005,
     68  CL_GARBAGE_COLLECTOR    =    0x00000006,
     69  CL_GAME_LOADER          =    0x00000007,
     70  CL_GRAPHICS_ENGINE      =    0x00000008,
     71  CL_TEXT_ENGINE          =    0x00000009,
     72  CL_LIGHT_MANAGER        =    0x0000000a,
     73  CL_EVENT_HANDLER        =    0x0000000b,
     74  CL_PHYSICS_ENGINE       =    0x0000000c,
     75  CL_CD_ENGINE            =    0x0000000d,
     76  CL_PARTICLE_ENGINE      =    0x0000000e,
     77  CL_SOUND_ENGINE         =    0x0000000f,
     78  CL_ANIMATION_PLAYER     =    0x00000010,
     79  CL_TRACK_MANAGER        =    0x00000011,
     80  CL_TRACK_NODE           =    0x00000012,
     81  CL_STATE                =    0x00000013,
     82  CL_FRAMEWORK            =    0x00000014,
     83
     84
     85
     86  // story entities (range from 0x00000101 to 0x000001ff)
     87  CL_CAMPAIGN             =    0x00000101,
     88  CL_WORLD                =    0x00000102,
     89
     90  // world entities (range from 0x00000201 to 0x000005ff)
     91  CL_CAMERA               =    0x00000201,
     92  CL_CAMERA_TARGET        =    0x00000202,
     93
     94  CL_ENVIRONEMENT         =    0x00000203,
     95  CL_SATELLITE            =    0x00000204,
     96  CL_SKYBOX               =    0x00000205,
     97  CL_SKYSPHERE            =    0x00000206,
     98  CL_TERRAIN              =    0x00000207,
     99  CL_TEST_BULLET          =    0x00000208,
     100  CL_TEST_ENTITY          =    0x00000209,
     101  CL_TEST_GUN             =    0x0000020a,
     102
    37103  CL_CHARACTER_ATTRIBUTES,
    38104
    39   CL_STORY_ENTITY,
    40   CL_CAMPAIGN,
    41   CL_WORLD,
    42   CL_TRACK_MANAGER,
    43   CL_TRACK_NODE,
    44105
    45106  CL_ANIMATION,
    46107  CL_ANIMATION3D,
    47   CL_ANIMATION_PLAYER,
    48108
    49109  CL_ARRAY,
    50   CL_BASE_OBJECT,
    51110  CL_CURVE,
    52111  CL_VECTOR,
     
    57116  CL_LOAD_PARAM,
    58117
    59   CL_OBJECT_MANAGER,
    60   CL_RESOURCE_MANAGER,
    61   CL_GARBAGE_COLLECTOR,
    62   CL_GAME_LOADER,
    63   CL_COMMAND_NODE,
    64118
    65119  CL_EVENT,
    66   CL_EVENT_HANDLER,
    67120  CL_EVENT_LISTENER,
    68121  CL_KEY_MAPPER,
    69122
    70   CL_GRAPHICS_ENGINE,
    71   CL_TEXT_ENGINE,
    72123  CL_TEXT,
    73124  CL_GLMENU_IMAGE_SCREEN,
    74125  CL_LIGHT,
    75   CL_LIGHT_MANAGER,
    76126  CL_MATERIAL,
    77127  CL_MD2Model,
     
    81131
    82132  CL_PARTICLE_EMITTER,
    83   CL_PARTICLE_ENGINE,
    84133  CL_PARTICLE_SYSTEM,
    85134
    86   CL_CD_ENGINE,
    87135  CL_COLLISION,
    88136  CL_BV_TREE,
     
    94142  CL_BOUNDING_SPHERE,
    95143
    96 
    97144  CL_NUMBER
    98145};
  • orxonox/trunk/src/lib/lang/base_object.cc

    r4470 r4591  
    11
    22
    3 /* 
     3/*
    44   orxonox - the future of 3D-vertical-scrollers
    55
     
    3030{
    3131  this->className = NULL;
    32   this->id = -1;
     32  this->classID = CL_BASE_OBJECT;
    3333  this->finalized = false;
    3434
     
    4242   \brief standard deconstructor
    4343*/
    44 BaseObject::~BaseObject () 
     44BaseObject::~BaseObject ()
    4545{
    4646  //  delete []this->className;
     
    5757  // name setup
    5858  LoadParam<BaseObject>(root, "name", this, &BaseObject::setName)
    59     .describe("the name of the Object at hand");
     59  .describe("the name of the Object at hand");
    6060}
    6161
     
    6565   \param className the class name
    6666*/
    67 void BaseObject::setClassID(int id, const char* className)
     67void BaseObject::setClassID(long classID, const char* className)
    6868{
    69   this->id = id;
    70   this->className = className;
     69  this->setClassID(classID);
     70  this->setClassName(className);
    7171}
    7272
     
    7676   \param id a number for the class from class_list.h enumeration
    7777*/
    78 void BaseObject::setClassID (int id)
     78void BaseObject::setClassID (long classID)
    7979{
    80   this->id = id;
     80  this->classID = classID;
    8181}
    8282
     
    106106
    107107/**
    108   \brief set the name of the node
    109 
    110   for debug purposes realy usefull, not used to work properly
    111 */
    112 void BaseObject::setName (const char* newName)
     108  \brief set the name of the Object
     109 */
     110void BaseObject::setName (const char* objectName)
    113111{
    114112  if (this->objectName)
    115113    delete []this->objectName;
    116   if (newName)
     114  if (objectName)
    117115    {
    118       this->objectName = new char[strlen(newName)+1];
    119       strcpy(this->objectName, newName);
     116      this->objectName = new char[strlen(objectName)+1];
     117      strcpy(this->objectName, objectName);
    120118    }
    121   else 
     119  else
    122120    this->objectName = NULL;
    123121}
  • orxonox/trunk/src/lib/lang/base_object.h

    r4539 r4591  
    1 /*! 
     1/*!
    22    \file base_object.h
    33    \brief Definition of the base object class.
     
    3030  void setName (const char* newName);
    3131  /** \brief returns the Name of this Object */
    32   const char* getName (void)const { return this->objectName; };
     32  inline const char* getName (void)const { return this->objectName; };
    3333
    3434  /** \returns the className of the corresponding Object */
    35   inline const char* getClassName(void) const { return this->className;};
     35  inline const char* getClassName(void) const { return this->className; };
    3636  /** \returns the classID of the corresponding Object */
    37   inline int getClassID(void) const { return this->id; }
     37  inline int getClassID(void) const { return this->classID; }
    3838
    3939  //  bool isA (char* className);
     
    4444
    4545 protected:
    46   void setClassID(int id);
     46  void setClassID(long classID);
    4747  void setClassName(const char* className);
    48   void setClassID(int id, const char* className);
     48  void setClassID(long classID, const char* className);
    4949
    5050  /** \brief this finalizes an object and makes it ready to be garbage collected */
     
    5252
    5353 private:
    54   const char*    className;        //!< the name of the class
    55   int            id;               //!< this is the id from the class_list.h enumeration
     54  const char*    className;        //!< the name of the class
     55  long           classID;          //!< this is the id from the class_list.h enumeration
     56  char*          objectName;       //!< The name of this object
     57
    5658  bool           finalized;        //!< is true if the object is ready to be garbage collected
    57 
    58   char*          objectName;       //!< The name of this object               
    5959};
    6060
  • orxonox/trunk/src/util/object_manager.h

    r4519 r4591  
    1 /*! 
     1/*!
    22    \file object_manager.h
    33    \brief this manager will ceep track of the objects  in the world
    4    
     4
    55    This is specially designed to:
    66    - Give an interface to the world data
     
    2525
    2626#include "class_list.h"
    27  
     27
    2828
    2929class WorldEntity;
     
    3333//! This defines the "template" macro function for cache(...)
    3434#define mCache( Class ) \
    35  cache(classList index, int number, Class * copyObject)        \
     35 cache(ClassID index, int number, Class * copyObject)        \
    3636{                                                              \
    3737  this->managedObjectList[index] = new tList<BaseObject>(); \
     
    5151  /** \returns a Pointer to the only object of this Class */
    5252  inline static ObjectManager* getInstance(void) { if (!singletonRef) singletonRef = new ObjectManager();  return singletonRef; };
    53  
     53
    5454  /** a class handled by the objectManage */
    5555  void mCache(Projectile);
Note: See TracChangeset for help on using the changeset viewer.