[Orxonox-commit 5805] r10465 - in code/branches/core7/src: libraries/network modules/docking modules/notifications modules/objects modules/pickup orxonox orxonox/gamestates orxonox/infos orxonox/interfaces orxonox/worldentities

landauf at orxonox.net landauf at orxonox.net
Mon May 25 10:24:56 CEST 2015


Author: landauf
Date: 2015-05-25 10:24:56 +0200 (Mon, 25 May 2015)
New Revision: 10465

Added:
   code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h
Modified:
   code/branches/core7/src/libraries/network/NetworkFunction.h
   code/branches/core7/src/modules/docking/Dock.cc
   code/branches/core7/src/modules/notifications/NotificationDispatcher.cc
   code/branches/core7/src/modules/objects/Script.cc
   code/branches/core7/src/modules/pickup/PickupManager.cc
   code/branches/core7/src/orxonox/Test.cc
   code/branches/core7/src/orxonox/gamestates/GSRoot.cc
   code/branches/core7/src/orxonox/infos/GametypeInfo.cc
   code/branches/core7/src/orxonox/interfaces/NotificationListener.cc
   code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc
Log:
moved macro ans helperfunction from NetworkFunction.h to NetworkFunctionIncludes.h

Modified: code/branches/core7/src/libraries/network/NetworkFunction.h
===================================================================
--- code/branches/core7/src/libraries/network/NetworkFunction.h	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/libraries/network/NetworkFunction.h	2015-05-25 08:24:56 UTC (rev 10465)
@@ -35,8 +35,6 @@
 #include <cstring>
 #include <map>
 #include <string>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/static_assert.hpp>
 
 #include "core/object/Listable.h"
 #include "core/class/Identifier.h"
@@ -236,44 +234,6 @@
 //     *((uint32_t*)destptr+i) = p2>>32*i;
 }
 
-template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, const std::string& name )
-{
-  BOOST_STATIC_ASSERT( sizeof(T)<=sizeof(NetworkFunctionPointer) ); // if this fails your compiler uses bigger pointers for static functions than defined above
-  NetworkFunctionPointer destptr;
-  copyPtr( ptr, destptr );
-  new NetworkFunctionStatic( createFunctor(ptr), name, destptr );
-  return 0;
 }
 
-template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, const std::string& name )
-{
-  BOOST_STATIC_ASSERT( sizeof(PT)<=sizeof(NetworkFunctionPointer) ); // if this fails your compiler uses bigger pointers for a specific kind of member functions than defined above
-  NetworkFunctionPointer destptr;
-  copyPtr( ptr, destptr );
-  new NetworkMemberFunction<T>( createFunctor(ptr), name, destptr );
-  return 0;
-}
-
-#define registerStaticNetworkFunction( functionPointer ) \
-  static void* BOOST_PP_CAT( NETWORK_FUNCTION_, __UNIQUE_NUMBER__ ) = registerStaticNetworkFunctionFct( functionPointer, #functionPointer );
-#define registerMemberNetworkFunction( class, function ) \
-  static void* BOOST_PP_CAT( NETWORK_FUNCTION_##class, __UNIQUE_NUMBER__ ) = registerMemberNetworkFunctionFct<class>( &class::function, #class "_" #function);
-  // call it with functionPointer, clientID, args
-#define callStaticNetworkFunction( functionPointer, ...) \
-  { \
-    NetworkFunctionPointer p1; \
-    copyPtr( functionPointer, p1 ); \
-    FunctionCallManager::addCallStatic(NetworkFunctionStatic::getFunction(p1)->getNetworkID(), __VA_ARGS__); \
-  }
-  // call it with class, function, objectID, clientID, args
-#define callMemberNetworkFunction( class, function, objectID, ...) \
-  { \
-    NetworkFunctionPointer p1; \
-    copyPtr( &class::function, p1 ); \
-    FunctionCallManager::addCallMember(NetworkMemberFunctionBase::getFunction(p1)->getNetworkID(), objectID, __VA_ARGS__); \
-  }
-
-
-}
-
 #endif /* _NetworkFunction_H__ */

Added: code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h
===================================================================
--- code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h	                        (rev 0)
+++ code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h	2015-05-25 08:24:56 UTC (rev 10465)
@@ -0,0 +1,83 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      Fabian 'x3n' Landau
+ *
+ */
+
+#ifndef _NetworkFunctionIncludes_H__
+#define _NetworkFunctionIncludes_H__
+
+#include "NetworkPrereqs.h"
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/static_assert.hpp>
+
+#include "NetworkFunction.h"
+
+namespace orxonox
+{
+    #define registerStaticNetworkFunction( functionPointer ) \
+        static void* BOOST_PP_CAT( NETWORK_FUNCTION_, __UNIQUE_NUMBER__ ) = registerStaticNetworkFunctionFct( functionPointer, #functionPointer );
+
+    #define registerMemberNetworkFunction( class, function ) \
+        static void* BOOST_PP_CAT( NETWORK_FUNCTION_##class, __UNIQUE_NUMBER__ ) = registerMemberNetworkFunctionFct<class>( &class::function, #class "_" #function);
+
+    // call it with functionPointer, clientID, args
+    #define callStaticNetworkFunction( functionPointer, ...) \
+        { \
+            NetworkFunctionPointer p1; \
+            copyPtr( functionPointer, p1 ); \
+            FunctionCallManager::addCallStatic(NetworkFunctionStatic::getFunction(p1)->getNetworkID(), __VA_ARGS__); \
+        }
+
+    // call it with class, function, objectID, clientID, args
+    #define callMemberNetworkFunction( class, function, objectID, ...) \
+        { \
+            NetworkFunctionPointer p1; \
+            copyPtr( &class::function, p1 ); \
+            FunctionCallManager::addCallMember(NetworkMemberFunctionBase::getFunction(p1)->getNetworkID(), objectID, __VA_ARGS__); \
+        }
+
+    template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, const std::string& name )
+    {
+        BOOST_STATIC_ASSERT( sizeof(T)<=sizeof(NetworkFunctionPointer) ); // if this fails your compiler uses bigger pointers for static functions than defined above
+        NetworkFunctionPointer destptr;
+        copyPtr( ptr, destptr );
+        new NetworkFunctionStatic( createFunctor(ptr), name, destptr );
+        return 0;
+    }
+
+    template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, const std::string& name )
+    {
+        BOOST_STATIC_ASSERT( sizeof(PT)<=sizeof(NetworkFunctionPointer) ); // if this fails your compiler uses bigger pointers for a specific kind of member functions than defined above
+        NetworkFunctionPointer destptr;
+        copyPtr( ptr, destptr );
+        new NetworkMemberFunction<T>( createFunctor(ptr), name, destptr );
+        return 0;
+    }
+
+}
+
+#endif /* _NetworkFunctionIncludes_H__ */

Modified: code/branches/core7/src/modules/docking/Dock.cc
===================================================================
--- code/branches/core7/src/modules/docking/Dock.cc	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/modules/docking/Dock.cc	2015-05-25 08:24:56 UTC (rev 10465)
@@ -37,7 +37,7 @@
 #include "core/LuaState.h"
 #include "core/GUIManager.h"
 #include "core/command/ConsoleCommandIncludes.h"
-#include "network/NetworkFunction.h"
+#include "network/NetworkFunctionIncludes.h"
 
 #include "infos/HumanPlayer.h"
 #include "interfaces/PlayerTrigger.h"

Modified: code/branches/core7/src/modules/notifications/NotificationDispatcher.cc
===================================================================
--- code/branches/core7/src/modules/notifications/NotificationDispatcher.cc	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/modules/notifications/NotificationDispatcher.cc	2015-05-25 08:24:56 UTC (rev 10465)
@@ -36,7 +36,7 @@
 #include "core/CoreIncludes.h"
 #include "core/EventIncludes.h"
 #include "core/XMLPort.h"
-#include "network/NetworkFunction.h"
+#include "network/NetworkFunctionIncludes.h"
 #include "network/Host.h"
 
 #include "infos/PlayerInfo.h"

Modified: code/branches/core7/src/modules/objects/Script.cc
===================================================================
--- code/branches/core7/src/modules/objects/Script.cc	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/modules/objects/Script.cc	2015-05-25 08:24:56 UTC (rev 10465)
@@ -36,7 +36,7 @@
 #include "core/LuaState.h"
 #include "core/XMLPort.h"
 #include "network/Host.h"
-#include "network/NetworkFunction.h"
+#include "network/NetworkFunctionIncludes.h"
 
 #include "PlayerManager.h"
 #include "infos/PlayerInfo.h"

Modified: code/branches/core7/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/core7/src/modules/pickup/PickupManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/modules/pickup/PickupManager.cc	2015-05-25 08:24:56 UTC (rev 10465)
@@ -39,7 +39,7 @@
 #include "core/class/Identifier.h"
 #include "core/singleton/ScopedSingletonIncludes.h"
 #include "network/Host.h"
-#include "network/NetworkFunction.h"
+#include "network/NetworkFunctionIncludes.h"
 
 #include "infos/PlayerInfo.h"
 #include "interfaces/PickupCarrier.h"

Modified: code/branches/core7/src/orxonox/Test.cc
===================================================================
--- code/branches/core7/src/orxonox/Test.cc	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/orxonox/Test.cc	2015-05-25 08:24:56 UTC (rev 10465)
@@ -29,7 +29,7 @@
 #include "core/CoreIncludes.h"
 #include "core/config/ConfigValueIncludes.h"
 #include "core/command/ConsoleCommandIncludes.h"
-#include "network/NetworkFunction.h"
+#include "network/NetworkFunctionIncludes.h"
 #include "Test.h"
 #include "util/MultiType.h"
 

Modified: code/branches/core7/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/branches/core7/src/orxonox/gamestates/GSRoot.cc	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/orxonox/gamestates/GSRoot.cc	2015-05-25 08:24:56 UTC (rev 10465)
@@ -33,7 +33,7 @@
 #include "core/Game.h"
 #include "core/GameMode.h"
 #include "core/command/ConsoleCommandIncludes.h"
-#include "network/NetworkFunction.h"
+#include "network/NetworkFunctionIncludes.h"
 #include "tools/Timer.h"
 #include "tools/interfaces/Tickable.h"
 

Modified: code/branches/core7/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- code/branches/core7/src/orxonox/infos/GametypeInfo.cc	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/orxonox/infos/GametypeInfo.cc	2015-05-25 08:24:56 UTC (rev 10465)
@@ -36,7 +36,7 @@
 #include "core/CoreIncludes.h"
 #include "core/GameMode.h"
 #include "network/Host.h"
-#include "network/NetworkFunction.h"
+#include "network/NetworkFunctionIncludes.h"
 #include "util/Convert.h"
 
 #include "controllers/HumanController.h"

Modified: code/branches/core7/src/orxonox/interfaces/NotificationListener.cc
===================================================================
--- code/branches/core7/src/orxonox/interfaces/NotificationListener.cc	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/orxonox/interfaces/NotificationListener.cc	2015-05-25 08:24:56 UTC (rev 10465)
@@ -33,7 +33,7 @@
 
 #include "core/CoreIncludes.h"
 #include "network/Host.h"
-#include "network/NetworkFunction.h"
+#include "network/NetworkFunctionIncludes.h"
 #include "util/SubString.h"
 
 #include "interfaces/NotificationListener.h"

Modified: code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc	2015-05-24 22:13:34 UTC (rev 10464)
+++ code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc	2015-05-25 08:24:56 UTC (rev 10465)
@@ -35,7 +35,7 @@
 #include "core/config/ConfigValueIncludes.h"
 #include "core/GameMode.h"
 #include "core/XMLPort.h"
-#include "network/NetworkFunction.h"
+#include "network/NetworkFunctionIncludes.h"
 
 #include "Scene.h"
 #include "infos/PlayerInfo.h"




More information about the Orxonox-commit mailing list