[Orxonox-commit 314] r2943 - branches/netp2/src/network
scheusso at orxonox.net
scheusso at orxonox.net
Thu Apr 30 14:54:44 CEST 2009
Author: scheusso
Date: 2009-04-30 14:54:44 +0200 (Thu, 30 Apr 2009)
New Revision: 2943
Modified:
branches/netp2/src/network/NetworkFunction.h
Log:
fixed a problem with copying function pointers
Modified: branches/netp2/src/network/NetworkFunction.h
===================================================================
--- branches/netp2/src/network/NetworkFunction.h 2009-04-30 12:12:57 UTC (rev 2942)
+++ branches/netp2/src/network/NetworkFunction.h 2009-04-30 12:54:44 UTC (rev 2943)
@@ -66,7 +66,7 @@
-class NetworkFunctionBase: virtual public OrxonoxClass {
+class _NetworkExport NetworkFunctionBase: virtual public OrxonoxClass {
public:
NetworkFunctionBase(std::string name);
~NetworkFunctionBase();
@@ -155,7 +155,7 @@
template<class T> inline void copyPtr( T ptr, NetworkFunctionPointer& destptr)
{
- memset(&destptr, 0, sizeof(ptr));
+ memset((uint8_t*)&destptr + sizeof(T), 0, sizeof(NetworkFunctionPointer)-sizeof(T));
T p2 = ptr;
memcpy( &destptr, &p2, sizeof(T) );
// for(unsigned int i=0; i<(sizeof(T)-1/4)+1; i++)
@@ -166,6 +166,7 @@
{
NetworkFunctionPointer destptr;
copyPtr( ptr, destptr );
+ COUT(0) << "-==================== destptr: " << destptr.pointer[0] << ", " << destptr.pointer[1] << endl;
new NetworkFunctionStatic( createFunctor(ptr), name, destptr );
return 0;
}
@@ -186,7 +187,7 @@
{ \
NetworkFunctionPointer p1; \
copyPtr( functionPointer, p1 ); \
- FunctionCallManager::addCallStatic(NetworkMemberFunctionBase::getFunction(p1)->getNetworkID(), __VA_ARGS__); \
+ FunctionCallManager::addCallStatic(NetworkFunctionStatic::getFunction(p1)->getNetworkID(), __VA_ARGS__); \
}
#define callMemberNetworkFunction( functionPointer, objectID, ...) \
{ \
More information about the Orxonox-commit
mailing list