Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10468 for code


Ignore:
Timestamp:
May 25, 2015, 12:13:27 PM (9 years ago)
Author:
landauf
Message:

moved static content of NetworkFunctionBase to NetworkFunctionManager

Location:
code/branches/core7/src
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/network/CMakeLists.txt

    r8858 r10468  
    3434  MasterServerComm.cc
    3535  NetworkFunction.cc
     36  NetworkFunctionManager.cc
    3637  Host.cc
    3738  Server.cc
     
    6162  NetworkChatListener.h
    6263  NetworkFunction.h
     64  NetworkFunctionManager.h
    6365  NetworkPrecompiledHeaders.h
    6466  NetworkPrereqs.h
  • code/branches/core7/src/libraries/network/NetworkFunction.cc

    r10362 r10468  
    2828
    2929#include "NetworkFunction.h"
     30#include "NetworkFunctionManager.h"
    3031#include "core/CoreIncludes.h"
    3132
    3233namespace orxonox
    3334{
    34   std::map<uint32_t, bool> NetworkFunctionBase::isStaticMap_;
    35 
    3635  std::map<NetworkFunctionPointer, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::functorMap_;
    3736  std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_;
     
    5049
    5150    this->name_ = name;
    52     NetworkFunctionBase::getNameMap()[name] = this;
     51    NetworkFunctionManager::getNameMap()[name] = this;
    5352  }
    5453  NetworkFunctionBase::~NetworkFunctionBase()
    5554  {
    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_;
    7255  }
    7356
  • code/branches/core7/src/libraries/network/NetworkFunction.h

    r10465 r10468  
    7777    inline uint32_t     getNetworkID() const            { return this->networkID_; }
    7878    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:
    9581    uint32_t networkID_;
    9682    std::string name_;
  • code/branches/core7/src/libraries/network/packet/FunctionIDs.cc

    r9667 r10468  
    3737#include "core/object/ObjectList.h"
    3838#include "network/NetworkFunction.h"
     39#include "network/NetworkFunctionManager.h"
    3940
    4041namespace orxonox {
     
    138139    functionname = temp+2*sizeof(uint32_t);
    139140    orxout(internal_info, context::packets) << "processing functionid: " << networkID << " name: " << functionname << endl;
    140     NetworkFunctionBase::setNetworkID((const char*)functionname, networkID);
     141    NetworkFunctionManager::setNetworkID((const char*)functionname, networkID);
    141142    temp += 2*sizeof(uint32_t) + stringsize;
    142143  }
  • code/branches/core7/src/orxonox/gamestates/GSRoot.cc

    r10465 r10468  
    3535#include "core/command/ConsoleCommandIncludes.h"
    3636#include "network/NetworkFunctionIncludes.h"
     37#include "network/NetworkFunctionManager.h"
    3738#include "tools/Timer.h"
    3839#include "tools/interfaces/Tickable.h"
     
    6869    GSRoot::~GSRoot()
    6970    {
    70         NetworkFunctionBase::destroyAllNetworkFunctions();
     71        NetworkFunctionManager::destroyAllNetworkFunctions();
    7172    }
    7273
Note: See TracChangeset for help on using the changeset viewer.