Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4592 in orxonox.OLD for orxonox/trunk/src/lib/lang/base_object.cc


Ignore:
Timestamp:
Jun 10, 2005, 7:17:22 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: derivations work.
now the only thing to do is specify all the classes, and DO it CLEAN.

@patrick: is it ok, how i treated your ObjectManager??

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/lang/base_object.cc

    r4591 r4592  
    7878void BaseObject::setClassID (long classID)
    7979{
    80   this->classID = classID;
     80  this->classID |= classID;
    8181}
    8282
     
    9191}
    9292
    93 
    94 /*
    95    \brief sets the class identifiers
    96    \param a number for the class from class_list.h enumeration
    97    \param the class name
    98 
    99 bool BaseObject::isA (char* className)
    100 {
    101   if( this->className == className)
    102     return false;
    103   return true;
    104 }
    105 */
    106 
    10793/**
    10894  \brief set the name of the Object
    10995 */
    110 void BaseObject::setName (const char* objectName)
     96             void BaseObject::setName (const char* objectName)
    11197{
    11298  if (this->objectName)
    11399    delete []this->objectName;
    114100  if (objectName)
    115     {
    116       this->objectName = new char[strlen(objectName)+1];
    117       strcpy(this->objectName, objectName);
    118     }
     101  {
     102    this->objectName = new char[strlen(objectName)+1];
     103    strcpy(this->objectName, objectName);
     104  }
    119105  else
    120106    this->objectName = NULL;
    121107}
     108
     109
     110/**
     111   \brief checks if the class is a classID
     112   \param classID the Identifier to check for
     113   \returns true if it is, false otherwise
     114*/
     115bool BaseObject::isA (ClassID classID)
     116{
     117  if( this->classID & classID)
     118    return true;
     119  return false;
     120}
     121
     122/**
     123 * @brief displays everything this class is
     124 */
     125void BaseObject::whatIs(void) const
     126{
     127  PRINT(0)("object %s: ", this->getName() );
     128  if (this->classID & CL_MASK_SUPERCLASS)
     129  {
     130    PRINT(0)("is a derived Class from: \n");
     131    if (this->classID & CL_BASE_OBJECT)
     132      PRINT(0)("BaseObject, ");
     133    if (this->classID & CL_PARENT_NODE)
     134      PRINT(0)("ParentNode, ");
     135    if (this->classID & CL_WORLD_ENTITY)
     136      PRINT(0)("WorldEntity, ");
     137    if (this->classID & CL_PHYSICS_INTERFACE)
     138      PRINT(0)("PhysicsInterface, ");
     139    if (this->classID & CL_EVENT_LISTENER)
     140      PRINT(0)("EventListener, ");
     141    if (this->classID & CL_STORY_ENTITY)
     142      PRINT(0)("StoryEntity, ");
     143  }
     144  printf("\n");
     145}
Note: See TracChangeset for help on using the changeset viewer.