Changeset 1684 for code/branches/core3/src/orxonox/objects/Projectile.h
- Timestamp:
- Aug 31, 2008, 4:32:31 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/orxonox/objects/Projectile.h
r1683 r1684 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include "core/Super.h" 34 35 #include "WorldEntity.h" 35 36 #include "tools/Timer.h" 36 #undef SUPER_INTRUSIVE37 #include "core/Super.h"38 37 39 38 namespace orxonox 40 39 { 41 class _OrxonoxExport Projectile : public WorldEntity 40 class TESTTESTTEST12 41 { 42 public: 43 TESTTESTTEST12() { this->setMyValue(10); } 44 45 private: 46 void setMyValue(int value) { this->value1_ = value; } 47 48 int value1_; 49 int value2_; 50 Identifier* identifier_; 51 }; 52 53 class TESTTESTTEST22 54 { 55 public: 56 TESTTESTTEST22() { this->setMyValue(10); } 57 58 private: 59 void setMyValue(int value) { this->value1_ = value; } 60 61 int value1_; 62 int value2_; 63 double value3_; 64 char value4_; 65 bool value5_; 66 Identifier* identifier1_; 67 Identifier* identifier2_; 68 }; 69 70 class TESTTESTTEST32 : virtual public TESTTESTTEST12 71 { 72 public: 73 TESTTESTTEST32() { this->setMyOtherValue(10); } 74 75 private: 76 void setMyOtherValue(int value) { this->value3_ = value; } 77 78 int value3_; 79 TESTTESTTEST22* test_; 80 }; 81 82 class _OrxonoxExport Projectile : public TESTTESTTEST22, public TESTTESTTEST32, virtual public TESTTESTTEST12, public WorldEntity 42 83 { 43 84 public: … … 68 109 }; 69 110 70 // Partially specialized template (templatehack is now specialized too) 71 template <class T> 72 struct SuperFunctionCondition<0, 0, T> 73 { 74 // Checks if class U isA baseclass and sets the functionpointer if the check returned true 75 static void check() 76 { 77 std::cout << "check superfunction \"testfunction\" in " << ClassIdentifier<T>::getIdentifier()->getName() << std::endl; 78 79 T* temp = 0; 80 SuperFunctionCondition<0, 0, T>::apply(temp); 81 82 std::cout << "done" << std::endl; 83 84 // Calls the condition of the next super-function 85 SuperFunctionCondition<0 + 1, 0, T>::check(); 86 } 87 88 static void apply(void* temp) 89 { 90 std::cout << ClassIdentifier<T>::getIdentifier()->getName() << " is not a Projectile" << std::endl; 91 // nop 92 } 93 94 static void apply(Projectile* temp) 95 { 96 std::cout << ClassIdentifier<T>::getIdentifier()->getName() << " is a Projectile" << std::endl; 97 ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); 98 99 // Iterate through all children and assign the caller 100 for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) 101 { 102 if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_testfunction_) 103 { 104 std::cout << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << std::endl; 105 ((ClassIdentifier<T>*)(*it))->superFunctionCaller_testfunction_ = new SuperFunctionClassCaller_testfunction<T>; 106 } 107 } 108 } 109 }; 111 SUPER_FUNCTION(0, Projectile, testfunction, false); 110 112 } 111 113
Note: See TracChangeset
for help on using the changeset viewer.