Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/objecthierarchy/src/orxonox/objects/test2.cc @ 453

Last change on this file since 453 was 375, checked in by landauf, 17 years ago

added a "Tickable"-interface
added a "Timer"-class

File size: 2.6 KB
Line 
1#include "test1.h"
2#include "test2.h"
3#include "test3.h"
4
5namespace orxonox
6{
7    CreateFactory(Test2);
8
9    Test2::Test2()
10    {
11        RegisterObject(Test2);
12
13        this->usefullClass1_ = Class(Test1);
14        this->usefullClass2_ = Class(Test2);
15        this->usefullClass3_ = Class(Test3);
16
17        timer1.setTimer(1, true, this, &Test2::timerFunction1);
18        timer2.setTimer(5, true, this, &Test2::timerFunction2);
19        timer3.setTimer(10, false, this, &Test2::timerFunction3);
20    }
21
22    Test2::~Test2()
23    {
24    }
25
26    void Test2::timerFunction1()
27    {
28        std::cout << "Test2: 1 Sekunde\n";
29    }
30
31    void Test2::timerFunction2()
32    {
33        std::cout << "Test2: 5 Sekunden\n";
34    }
35
36    void Test2::timerFunction3()
37    {
38        std::cout << "Test2: 10 Sekunden sind um!\n";
39    }
40
41    bool Test2::usefullClass1isA(Identifier* identifier)
42    {
43        return this->usefullClass1_->isA(identifier);
44    }
45
46    bool Test2::usefullClass2isA(Identifier* identifier)
47    {
48        return this->usefullClass2_->isA(identifier);
49    }
50
51    bool Test2::usefullClass3isA(Identifier* identifier)
52    {
53        return this->usefullClass3_.isA(identifier);
54    }
55
56    void Test2::setUsefullClass1(Identifier* identifier)
57    {
58        std::cout << "\n";
59        std::cout << "Test2: usefullClass1->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << "\n";
60        std::cout << "Test2: usefullClass1->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << "\n";
61        std::cout << "Test2: usefullClass1->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << "\n";
62        this->usefullClass1_ = identifier;
63    }
64
65    void Test2::setUsefullClass2(Identifier* identifier)
66    {
67        std::cout << "\n";
68        std::cout << "Test2: usefullClass2->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << "\n";
69        std::cout << "Test2: usefullClass2->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << "\n";
70        std::cout << "Test2: usefullClass2->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << "\n";
71        this->usefullClass2_ = identifier;
72    }
73
74    void Test2::setUsefullClassOfTypeTest3(Identifier* identifier)
75    {
76        std::cout << "\n";
77        std::cout << "Test2: usefullClass3->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << "\n";
78        std::cout << "Test2: usefullClass3->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << "\n";
79        std::cout << "Test2: usefullClass3->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << "\n";
80        this->usefullClass3_ = identifier;
81    }
82}
Note: See TracBrowser for help on using the repository browser.