Changeset 10468
- Timestamp:
- May 25, 2015, 12:13:27 PM (10 years ago)
- Location:
- code/branches/core7/src
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/network/CMakeLists.txt
r8858 r10468 34 34 MasterServerComm.cc 35 35 NetworkFunction.cc 36 NetworkFunctionManager.cc 36 37 Host.cc 37 38 Server.cc … … 61 62 NetworkChatListener.h 62 63 NetworkFunction.h 64 NetworkFunctionManager.h 63 65 NetworkPrecompiledHeaders.h 64 66 NetworkPrereqs.h -
code/branches/core7/src/libraries/network/NetworkFunction.cc
r10362 r10468 28 28 29 29 #include "NetworkFunction.h" 30 #include "NetworkFunctionManager.h" 30 31 #include "core/CoreIncludes.h" 31 32 32 33 namespace orxonox 33 34 { 34 std::map<uint32_t, bool> NetworkFunctionBase::isStaticMap_;35 36 35 std::map<NetworkFunctionPointer, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::functorMap_; 37 36 std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_; … … 50 49 51 50 this->name_ = name; 52 NetworkFunction Base::getNameMap()[name] = this;51 NetworkFunctionManager::getNameMap()[name] = this; 53 52 } 54 53 NetworkFunctionBase::~NetworkFunctionBase() 55 54 { 56 }57 58 59 void NetworkFunctionBase::destroyAllNetworkFunctions()60 {61 std::map<std::string, NetworkFunctionBase*>& map = NetworkFunctionBase::getNameMap();62 std::map<std::string, NetworkFunctionBase*>::iterator it;63 for( it=map.begin(); it!=map.end(); ++it )64 delete it->second;65 }66 67 68 /*static*/ std::map<std::string, NetworkFunctionBase*>& NetworkFunctionBase::getNameMap()69 {70 static std::map<std::string, NetworkFunctionBase*> nameMap_;71 return nameMap_;72 55 } 73 56 -
code/branches/core7/src/libraries/network/NetworkFunction.h
r10465 r10468 77 77 inline uint32_t getNetworkID() const { return this->networkID_; } 78 78 inline const std::string& getName() const { return name_; } 79 static inline bool isStatic( uint32_t networkID ) { return isStaticMap_[networkID]; } 80 81 static inline void setNetworkID(const std::string& name, uint32_t id) 82 { 83 std::map<std::string, NetworkFunctionBase*>& map = NetworkFunctionBase::getNameMap(); 84 assert( map.find(name)!=map.end() ); 85 map[name]->setNetworkID(id); 86 } 87 88 static void destroyAllNetworkFunctions(); 89 90 protected: 91 static std::map<uint32_t, bool> isStaticMap_; 92 93 private: 94 static std::map<std::string, NetworkFunctionBase*>& getNameMap(); 79 80 private: 95 81 uint32_t networkID_; 96 82 std::string name_; -
code/branches/core7/src/libraries/network/packet/FunctionIDs.cc
r9667 r10468 37 37 #include "core/object/ObjectList.h" 38 38 #include "network/NetworkFunction.h" 39 #include "network/NetworkFunctionManager.h" 39 40 40 41 namespace orxonox { … … 138 139 functionname = temp+2*sizeof(uint32_t); 139 140 orxout(internal_info, context::packets) << "processing functionid: " << networkID << " name: " << functionname << endl; 140 NetworkFunction Base::setNetworkID((const char*)functionname, networkID);141 NetworkFunctionManager::setNetworkID((const char*)functionname, networkID); 141 142 temp += 2*sizeof(uint32_t) + stringsize; 142 143 } -
code/branches/core7/src/orxonox/gamestates/GSRoot.cc
r10465 r10468 35 35 #include "core/command/ConsoleCommandIncludes.h" 36 36 #include "network/NetworkFunctionIncludes.h" 37 #include "network/NetworkFunctionManager.h" 37 38 #include "tools/Timer.h" 38 39 #include "tools/interfaces/Tickable.h" … … 68 69 GSRoot::~GSRoot() 69 70 { 70 NetworkFunction Base::destroyAllNetworkFunctions();71 NetworkFunctionManager::destroyAllNetworkFunctions(); 71 72 } 72 73
Note: See TracChangeset
for help on using the changeset viewer.