Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9678 in orxonox.OLD for trunk/src/lib/lang/new_class_id.cc


Ignore:
Timestamp:
Aug 21, 2006, 11:59:18 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: implemented isA leafID and listInheritance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/lang/new_class_id.cc

    r9674 r9678  
    1818#include "new_class_id.h"
    1919#include <cassert>
     20#include "debug.h"
    2021
    2122///////////////////////////////////////////////////////////
     
    4546
    4647
     48/**
     49 * @brief Seeks in the Inheritance if it matches objectList.
     50 * @param objectList The ObjectList this should be a member of (by Pointer-comparison).
     51 * @return True if found, false if not.
     52 */
     53bool NewClassID::isA(const NewObjectListBase& objectList) const
     54{
     55  ClassList::const_iterator it;
     56  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
     57    if ((*it)._objectList == &objectList)
     58      return true;
     59  return false;
     60}
     61
     62/**
     63 * @brief Seeks in the Inheritance if it matches objectList.
     64 * @param classID The ClassID of the class this should be a member of.
     65 * @return True if found, false if not.
     66 */
     67bool NewClassID::isA(int classID) const
     68{
     69  ClassList::const_iterator it;
     70  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
     71    if (*(*it)._objectList == classID)
     72      return true;
     73  return false;
     74}
     75
     76/**
     77 * @brief Seeks in the Inheritance if it matches objectList.
     78 * @param className The ClassName of the class this should be a member of.
     79 * @return True if found, false if not.
     80 */
     81bool NewClassID::isA(const std::string& className) const
     82{
     83  ClassList::const_iterator it;
     84  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
     85    if (*(*it)._objectList == className)
     86      return true;
     87  return false;
     88}
     89
     90
     91void NewClassID::listInheritance() const
     92{
     93  PRINT(0)("Listing inheritance diagram for ....: ");
     94  ClassList::const_iterator it;
     95  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
     96    PRINT(0)(" -> %s", (*it)._objectList->name().c_str());
     97  PRINT(0)("\n");
     98
     99}
Note: See TracChangeset for help on using the changeset viewer.