Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4595 in orxonox.OLD for orxonox/trunk/src/lib


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

orxonox/trunk: better output

Location:
orxonox/trunk/src/lib/lang
Files:
2 edited

Legend:

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

    r4594 r4595  
    1919#include "base_object.h"
    2020#include "load_param.h"
     21#include "compiler.h"
    2122
    2223using namespace std;
     
    113114   \returns true if it is, false otherwise
    114115*/
    115 bool BaseObject::isA (ClassID classID)
     116bool BaseObject::isA (ClassID classID) const
    116117{
    117118  // if classID is a derivable object
    118   if (classID & CL_MASK_SUPER_CLASS || classID & CL_MASK_SUBSUPER_CLASS)
     119  if (likely(classID & CL_MASK_SUPER_CLASS || classID & CL_MASK_SUBSUPER_CLASS))
    119120  {
    120121    if( this->classID & classID)
     
    135136void BaseObject::whatIs(void) const
    136137{
    137   PRINT(0)("object %s: ", this->getName() );
     138  PRINT(0)("object %s of class %s: ", this->getName(), this->getClassName());
    138139  if (this->classID & CL_MASK_SUPER_CLASS)
    139140  {
    140     PRINT(0)("is a derived Class from: \n");
    141     if (this->classID & CL_BASE_OBJECT)
    142       PRINT(0)("BaseObject, ");
    143     if (this->classID & CL_PARENT_NODE)
    144       PRINT(0)("ParentNode, ");
    145     if (this->classID & CL_WORLD_ENTITY)
    146       PRINT(0)("WorldEntity, ");
    147     if (this->classID & CL_PHYSICS_INTERFACE)
    148       PRINT(0)("PhysicsInterface, ");
    149     if (this->classID & CL_EVENT_LISTENER)
    150       PRINT(0)("EventListener, ");
    151     if (this->classID & CL_STORY_ENTITY)
    152       PRINT(0)("StoryEntity, ");
     141    PRINT(0)("is a derived from the following superclasses:");
     142    if (this->isA(CL_BASE_OBJECT))
     143      PRINT(0)(" =BaseObject=");
     144    if (this->isA(CL_PARENT_NODE))
     145      PRINT(0)(" =PNode=");
     146    if (this->isA(CL_WORLD_ENTITY))
     147      PRINT(0)(" =WorldEntity=");
     148    if (this->isA(CL_PHYSICS_INTERFACE))
     149      PRINT(0)(" =PhysicsInterface=");
     150    if (this->isA(CL_EVENT_LISTENER))
     151      PRINT(0)(" =EventListener=");
     152    if (this->isA(CL_STORY_ENTITY))
     153      PRINT(0)(" =StoryEntity=");
     154    PRINT(0)("\n");
    153155  }
    154   printf("\n");
     156  // subsuper-classes
     157  if (this->classID & CL_MASK_SUBSUPER_CLASS)
     158  {
     159    PRINT(0)(" ->further derivations: ");
     160    if (this->isA(CL_PLAYER))
     161      PRINT(0)(" -Player-");
     162    if (this->isA(CL_NPC))
     163      PRINT(0)(" -NPC-");
     164    if (this->isA(CL_POWER_UP))
     165      PRINT(0)(" -PowerUp-");
     166    if (this->isA(CL_FIELD))
     167      PRINT(0)(" -Field-");
     168    if (this->isA(CL_PROJECTILE))
     169      PRINT(0)(" -Projectile-");
     170    if (this->isA(CL_WEAPON))
     171      PRINT(0)(" -Weapon-");
     172    PRINT(0)("\n");
     173  }
    155174}
  • orxonox/trunk/src/lib/lang/base_object.h

    r4592 r4595  
    3737  inline int getClassID(void) const { return this->classID; }
    3838
    39   bool isA (ClassID classID);
     39  bool isA (ClassID classID) const;
    4040  void whatIs(void) const;
    4141
Note: See TracChangeset for help on using the changeset viewer.