Changeset 2948 for code/branches/netp2/src
- Timestamp:
- May 1, 2009, 11:34:14 PM (16 years ago)
- Location:
- code/branches/netp2/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp2/src/network/Client.cc
r2773 r2948 47 47 #include "core/CoreIncludes.h" 48 48 #include "packet/Packet.h" 49 #include "FunctionCallManager.h" 49 50 50 51 // #include "packet/Acknowledgement.h" … … 149 150 // gs gets automatically deleted by enet callback 150 151 } 152 FunctionCallManager::sendCalls(); 151 153 } 152 154 ENetEvent *event; -
code/branches/netp2/src/network/NetworkFunction.cc
r2944 r2948 70 70 NetworkFunctionStatic::~NetworkFunctionStatic() 71 71 { 72 delete this->functor_; 72 73 } 73 74 -
code/branches/netp2/src/network/NetworkFunction.h
r2944 r2948 38 38 #include "util/MultiType.h" 39 39 #include "synchronisable/Synchronisable.h" 40 #include "OrxonoxConfig.h" 40 41 #include "FunctionCallManager.h" 41 42 … … 158 159 { 159 160 } 160 161 template <class T> NetworkMemberFunction<T>::~NetworkMemberFunction() 162 { 163 delete this->functor_; 164 } 161 165 162 166 template<class T> inline void copyPtr( T ptr, NetworkFunctionPointer& destptr) … … 173 177 NetworkFunctionPointer destptr; 174 178 copyPtr( ptr, destptr ); 175 COUT(0) << "-==================== destptr: " << destptr.pointer[0] << ", " << destptr.pointer[1] << endl;176 179 new NetworkFunctionStatic( createFunctor(ptr), name, destptr ); 177 180 return 0; … … 182 185 NetworkFunctionPointer destptr; 183 186 copyPtr( ptr, destptr ); 184 new NetworkMemberFunction<T>( new FunctorMember<T>(ptr), name, destptr );187 new NetworkMemberFunction<T>( createFunctor(ptr), name, destptr ); 185 188 return 0; 186 189 } 187 190 188 #define registerStaticNetworkFunction( functionPointer, name ) \ 189 void* NETWORK_FUNCTION_name##a = registerStaticNetworkFunctionFct( functionPointer, name ); 190 #define registerMemberNetworkFunction( functionPointer, class, name ) \ 191 void* NETWORK_FUNCTION_class##name##a = registerMemberNetworkFunction<class>( functionPointer, name ); 191 #define registerStaticNetworkFunction( functionPointer ) \ 192 static void* MACRO_CONCATENATE( NETWORK_FUNCTION_, __LINE__ ) = registerStaticNetworkFunctionFct( functionPointer, #functionPointer ); 193 #define registerMemberNetworkFunction( class, function ) \ 194 static void* MACRO_CONCATENATE( NETWORK_FUNCTION_##class, __LINE__ ) = registerMemberNetworkFunctionFct<class>( &class::function, #class "_" #function); 195 // call it with functionPointer, clientID, args 192 196 #define callStaticNetworkFunction( functionPointer, ...) \ 193 197 { \ … … 196 200 FunctionCallManager::addCallStatic(NetworkFunctionStatic::getFunction(p1)->getNetworkID(), __VA_ARGS__); \ 197 201 } 198 #define callMemberNetworkFunction( functionPointer, objectID, ...) \ 202 // call it with class, function, objectID, clientID, args 203 #define callMemberNetworkFunction( class, function, objectID, ...) \ 199 204 { \ 200 205 NetworkFunctionPointer p1; \ 201 copyPtr( functionPointer, p1 ); \202 FunctionCallManager::addCallMember(NetworkMemberFunctionBase::getFunction(p1)->getNetworkID(), objectID, __VA_ARGS__) \206 copyPtr( &class::function, p1 ); \ 207 FunctionCallManager::addCallMember(NetworkMemberFunctionBase::getFunction(p1)->getNetworkID(), objectID, __VA_ARGS__); \ 203 208 } 204 209 -
code/branches/netp2/src/orxonox/objects/Test.cc
r2944 r2948 49 49 // NetworkFunctionBase* NETWORK_FUNCTION_TEST_C = new NetworkFunctionStatic( createFunctor(&Test::printV1), "bla", NETWORK_FUNCTION_POINTER ); 50 50 51 registerStaticNetworkFunction( &Test::printV1, "printV1" ); 51 registerStaticNetworkFunction( &Test::printV1 ); 52 registerMemberNetworkFunction( Test, checkU1 ); 52 53 53 54 Test* Test::instance_ = 0; … … 101 102 } 102 103 104 void Test::tick(float dt) 105 { 106 if(!Core::isMaster()) 107 callMemberNetworkFunction( Test, checkU1, this->getObjectID(), 0 ); 108 // callMemberNetworkFunction( &Test::printV1, this->getObjectID(), 0); 109 } 110 103 111 void Test::checkU1(){ COUT(1) << "U1 changed: " << u1 << std::endl; } 104 112 void Test::checkU2(){ COUT(1) << "U2 changed: " << u2 << std::endl; } -
code/branches/netp2/src/orxonox/objects/Test.h
r2944 r2948 33 33 #include "core/BaseObject.h" 34 34 #include "network/synchronisable/Synchronisable.h" 35 #include "Tickable.h" 35 36 36 37 … … 41 42 namespace orxonox 42 43 { 43 class _OrxonoxExport Test: public BaseObject, public Synchronisable 44 class _OrxonoxExport Test: public BaseObject, public Synchronisable, public Tickable 44 45 { 45 46 public: … … 51 52 52 53 static void call(unsigned int clientID); 54 virtual void tick(float dt); 53 55 54 56
Note: See TracChangeset
for help on using the changeset viewer.