Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: nicer output

File size: 2.6 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2006 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: Benjamin Grauer
13   co-programmer: ...
14*/
15
16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
17
18#include "new_class_id.h"
19#include <cassert>
20#include "debug.h"
21
22///////////////////////////////////////////////////////////
23//// CLASS ID definiton. //////////////////////////////////
24///////////////////////////////////////////////////////////
25/**
26 * @brief standard constructor
27 */
28NewClassID::NewClassID ()
29{}
30
31
32/**
33 * @brief standard deconstructor
34 */
35NewClassID::~NewClassID ()
36{
37  //  assert(_objectList != NULL);
38  ClassList::iterator it;
39  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
40  {
41    (*it)._objectList->unregisterObject((*it)._iterator);
42    delete (*it)._iterator;
43  }
44  //_objectList->unregisterObject(this->_iterators);
45}
46
47
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(id:%d)", (*it)._objectList->name().c_str(), (*it)._objectList->id());
97  PRINT(0)("\n");
98
99}
Note: See TracBrowser for help on using the repository browser.