- Timestamp:
- Aug 28, 2008, 11:50:53 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/orxonox/objects/ParticleProjectile.cc
r1610 r1676 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" 35 //#include "util/FastDelegate.h" 36 //using namespace fastdelegate; 37 35 38 namespace orxonox 36 39 { 37 40 CreateFactory(ParticleProjectile); 41 42 struct FunctionPointerViewer 43 { 44 void* ptr1_; 45 void* ptr2_; 46 47 void view() 48 { 49 std::cout << ptr1_ << "." << ptr2_ << std::endl; 50 } 51 }; 52 53 union FunctionPointerViewer1 54 { 55 FunctionPointerViewer viewer_; 56 void (Projectile::*function_) (); 57 }; 58 59 union FunctionPointerViewer2 60 { 61 FunctionPointerViewer viewer_; 62 void (BillboardProjectile::*function_) (); 63 }; 64 65 union FunctionPointerViewer3 66 { 67 FunctionPointerViewer viewer_; 68 void (ParticleProjectile::*function_) (); 69 }; 38 70 39 71 ParticleProjectile::ParticleProjectile(SpaceShip* owner) : BillboardProjectile(owner) … … 54 86 55 87 this->setConfigValues(); 88 /* 89 FunctionPointerViewer1 fpw1; 90 fpw1.function_ = &Projectile::testfunction; 91 FunctionPointerViewer2 fpw2; 92 fpw2.function_ = &BillboardProjectile::testfunction; 93 FunctionPointerViewer3 fpw3; 94 fpw3.function_ = &ParticleProjectile::testfunction; 95 96 std::cout << sizeof(void (Projectile::*) ()) << std::endl; 97 fpw1.viewer_.view(); 98 fpw2.viewer_.view(); 99 fpw3.viewer_.view(); 100 101 { 102 std::cout << "1:" << std::endl; 103 FastDelegate0<> delegate1(this, &ParticleProjectile::testfunction); 104 delegate1(); 105 FastDelegate0<> delegate2((BillboardProjectile*)this, &BillboardProjectile::testfunction); 106 delegate2(); 107 FastDelegate0<> delegate3(this, &Projectile::testfunction); 108 delegate3(); 109 } 110 { 111 std::cout << "2:" << std::endl; 112 BillboardProjectile temp; 113 // FastDelegate0<> delegate1(&temp, &ParticleProjectile::testfunction); 114 // delegate1(); 115 FastDelegate0<> delegate2(&temp, &BillboardProjectile::testfunction); 116 delegate2(); 117 FastDelegate0<> delegate3(&temp, &Projectile::testfunction); 118 delegate3(); 119 } 120 std::cout << "done" << std::endl; 121 122 std::cout << "0:" << std::endl; 123 this->Projectile::testfunction(); 124 this->BillboardProjectile::testfunction(); 125 this->ParticleProjectile::testfunction(); 126 this->testfunction(); 127 128 std::cout << "1:" << std::endl; 129 (this->*fpw1.function_)(); 130 std::cout << "2:" << std::endl; 131 (this->*fpw2.function_)(); 132 std::cout << "3:" << std::endl; 133 (this->*fpw3.function_)(); 134 std::cout << "done" << std::endl; 135 */ 136 std::cout << "c:\n"; 137 SUPER(ParticleProjectile, testfunction); 138 std::cout << "d:\n"; 139 140 std::cout << "e:\n"; 141 this->testfunction(); 142 std::cout << "f:\n"; 143 144 // (*((ClassIdentifier<SuperDummy>*)this->getIdentifier())->superFunctionCaller_testfunction_)(this); 56 145 } 57 146 … … 72 161 this->particles_->setEnabled(this->isVisible()); 73 162 } 163 164 void ParticleProjectile::testfunction() { SUPER(ParticleProjectile, testfunction); std::cout << "3 -> " << std::endl; } 74 165 }
Note: See TracChangeset
for help on using the changeset viewer.