Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/lang/test_object_list.cc @ 9677

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

orxonox/trunk: much better ID nutrition

File size: 2.0 KB
Line 
1#include "new_class_id.h"
2#include "new_object_list.h"
3#include <iostream>
4
5#include <base_object.h>
6
7class NewBaseObject
8{
9public:
10  //   void setName(const std::string& name) { this->_objectName = name; };
11     const std::string& getName() const { return _objectName; };
12  //   bool operator==(const std::string& name) const { return _objectName == name; };
13
14  //  NewObjectListDeclaration(NewBaseObject);
15
16protected:
17  NewBaseObject(const std::string& objectName = "") : _objectName(objectName)
18  {
19    //    this->registerObject(this, objectList);
20  };
21  template<class T>
22  inline void registerObject(T* object, NewObjectList<T>& objectList) { _id.registerObject(object, objectList); };
23private:
24  NewClassID    _id;
25  std::string   _objectName;
26
27
28};
29//NewObjectListDefinition(NewBaseObject);
30
31
32class Test :
33      public   NewBaseObject
34//    ,
35//      public BaseObject
36{
37public:
38  Test();
39  ~Test();
40
41
42  NewObjectListDeclaration(Test);
43  //ObjectListDeclaration(Test);
44};
45NewObjectListDefinitionID(Test, 0);
46
47Test::Test()
48{
49  this->registerObject(this, Test::objectList);
50//  this->setClassID(CL_PARENT_NODE, "Test");
51  // std::cout << "Test()\n";
52};
53Test::~Test()
54{
55  //  std::cout << "~Test()\n";
56}
57
58class Bone : public BaseObject
59{
60public:
61  Bone()
62  {
63    //    this->registerObject(this, Bone::objectList);
64    //std::cout << "Bone()\n";
65  };
66  ~Bone()
67  {
68    //  std::cout << "~Bone()\n";
69  };
70  NewObjectListDeclaration(Bone);
71};
72NewObjectListDefinitionID(Bone, -1);
73
74int main()
75{
76  for (unsigned int i = 0; i < 20; ++i)
77  {
78    std::cout<< i << std::endl;
79    Test* test = new Test[10000];
80    // delete[]test;
81  }
82  //   char tmp[100];
83  //   for (unsigned int i = 0 ; i < 100; ++i)
84  //   {
85  //     sprintf(tmp, "Tmp_%d", i);
86  //     test[i].setName(tmp);
87  //   }
88  //   Test::objectList.debug();
89  //   //test->setName("Test-object");
90  //
91  //   std::cout << "Here is debug of all BaseObject\n";
92  //   BaseObject::objectList.debug();
93  // //   delete bone;
94  //   delete []test;
95  //   std::cout << "Again\n";
96  //   BaseObject::objectList.debug();
97
98}
99
Note: See TracBrowser for help on using the repository browser.