Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/lang/new_class_id.cc @ 9853

Last change on this file since 9853 was 9681, checked in by bensch, 18 years ago

cleanup

File size: 2.5 KB
RevLine 
[4744]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
[9659]4   Copyright (C) 2006 orx
[1853]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.
[1855]10
11   ### File Specific:
[9659]12   main-programmer: Benjamin Grauer
[1855]13   co-programmer: ...
[1853]14*/
15
[3955]16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
[1853]17
[9659]18#include "new_class_id.h"
19#include <cassert>
[9678]20#include "debug.h"
[1853]21
[9659]22///////////////////////////////////////////////////////////
23//// CLASS ID definiton. //////////////////////////////////
24///////////////////////////////////////////////////////////
[3245]25/**
[9659]26 * @brief standard constructor
27 */
28NewClassID::NewClassID ()
[9660]29{}
[1853]30
31
[3245]32/**
[9659]33 * @brief standard deconstructor
34 */
35NewClassID::~NewClassID ()
[3543]36{
[9673]37  ClassList::iterator it;
[9672]38  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
[9674]39  {
[9672]40    (*it)._objectList->unregisterObject((*it)._iterator);
[9674]41    delete (*it)._iterator;
42  }
[3543]43}
[9659]44
45
[9678]46/**
47 * @brief Seeks in the Inheritance if it matches objectList.
48 * @param objectList The ObjectList this should be a member of (by Pointer-comparison).
49 * @return True if found, false if not.
50 */
51bool NewClassID::isA(const NewObjectListBase& objectList) const
52{
53  ClassList::const_iterator it;
54  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
55    if ((*it)._objectList == &objectList)
56      return true;
57  return false;
58}
59
60/**
61 * @brief Seeks in the Inheritance if it matches objectList.
62 * @param classID The ClassID of the class this should be a member of.
63 * @return True if found, false if not.
64 */
65bool NewClassID::isA(int classID) const
66{
67  ClassList::const_iterator it;
68  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
69    if (*(*it)._objectList == classID)
70      return true;
71  return false;
72}
73
74/**
75 * @brief Seeks in the Inheritance if it matches objectList.
76 * @param className The ClassName of the class this should be a member of.
77 * @return True if found, false if not.
78 */
79bool NewClassID::isA(const std::string& className) const
80{
81  ClassList::const_iterator it;
82  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
83    if (*(*it)._objectList == className)
84      return true;
85  return false;
86}
87
88
89void NewClassID::listInheritance() const
90{
91  PRINT(0)("Listing inheritance diagram for ....: ");
92  ClassList::const_iterator it;
93  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
[9680]94    PRINT(0)(" -> %s(id:%d)", (*it)._objectList->name().c_str(), (*it)._objectList->id());
[9678]95  PRINT(0)("\n");
96
97}
Note: See TracBrowser for help on using the repository browser.