Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10470


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

NetworkFunctionBase doesn't have to inherit from Listable: there's a list of all instances stored in NetworkFunctionManager stored anyway

Location:
code/branches/core7/src/libraries/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/network/NetworkFunction.cc

    r10468 r10470  
    2929#include "NetworkFunction.h"
    3030#include "NetworkFunctionManager.h"
    31 #include "core/CoreIncludes.h"
    3231
    3332namespace orxonox
     
    3635  std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_;
    3736
    38   // no suitable factory for NetworkFunctionBase (and children), so we declare it abstract
    39   RegisterAbstractClass(NetworkFunctionBase).inheritsFrom<Listable>();
    40   RegisterAbstractClass(NetworkFunctionStatic).inheritsFrom<NetworkFunctionBase>();
    41   RegisterAbstractClass(NetworkMemberFunctionBase).inheritsFrom<NetworkFunctionBase>();
    42 
    4337  NetworkFunctionBase::NetworkFunctionBase(const std::string& name)
    4438  {
    45       RegisterObject(NetworkFunctionBase);
    46 
    4739    static uint32_t networkID = 0;
    4840    this->networkID_ = networkID++;
     
    5951    NetworkFunctionBase(name)
    6052  {
    61     RegisterObject(NetworkFunctionStatic);
    62 
    6353    this->functor_ = functor;
    6454    NetworkFunctionStatic::getFunctorMap()[p] = this;
     
    8272    NetworkFunctionBase(name)
    8373  {
    84     RegisterObject(NetworkMemberFunctionBase);
    85 
    8674    this->functorMap_[p] = this;
    8775    this->idMap_[ this->getNetworkID() ] = this;
  • code/branches/core7/src/libraries/network/NetworkFunction.h

    r10469 r10470  
    3737#include <string>
    3838
    39 #include "core/object/Listable.h"
    40 #include "core/class/Identifier.h"
    4139#include "core/command/Functor.h"
    4240#include "FunctionCallManager.h"
     
    6967
    7068
    71 class _NetworkExport NetworkFunctionBase: virtual public Listable {
     69class _NetworkExport NetworkFunctionBase {
    7270  public:
    7371    NetworkFunctionBase(const std::string& name);
    74     ~NetworkFunctionBase();
     72    virtual ~NetworkFunctionBase();
    7573
    7674    virtual void        setNetworkID(uint32_t id)       { this->networkID_ = id; }
  • code/branches/core7/src/libraries/network/packet/FunctionIDs.cc

    r10468 r10470  
    5656
    5757  //calculate total needed size (for all strings and integers)
    58   ObjectList<NetworkFunctionBase>::iterator it;
    59   for(it = ObjectList<NetworkFunctionBase>::begin(); it; ++it)
     58  std::map<std::string, NetworkFunctionBase*>& map = NetworkFunctionManager::getNameMap();
     59  std::map<std::string, NetworkFunctionBase*>::iterator it;
     60  for (it = map.begin(); it != map.end(); ++it)
    6061  {
    61     const std::string& functionname = it->getName();
    62     networkID = it->getNetworkID();
     62    const std::string& functionname = it->second->getName();
     63    networkID = it->second->getNetworkID();
    6364    // now push the network id and the classname to the stack
    6465    tempQueue.push( std::pair<unsigned int, std::string>(networkID, functionname) );
Note: See TracChangeset for help on using the changeset viewer.