Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2015, 2:41:57 PM (6 years ago)
Author:
landauf
Message:

refactored the interface of NetworkFunctionManager: maps are better encapsulated now

File:
1 edited

Legend:

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

    r10474 r10475  
    3232namespace orxonox
    3333{
    34     NetworkFunctionBase::NetworkFunctionBase(const std::string& name, const NetworkFunctionPointer& p)
     34    NetworkFunctionBase::NetworkFunctionBase(const std::string& name, const NetworkFunctionPointer& pointer)
    3535    {
    3636        static uint32_t networkID = 0;
    3737        this->networkID_ = networkID++;
    38 
    3938        this->name_ = name;
    40         NetworkFunctionManager::getInstance().getNameMap()[name] = this;
    41         NetworkFunctionManager::getInstance().getFunctorMap()[p] = this;
    42         NetworkFunctionManager::getInstance().getIdMap()[this->getNetworkID()] = this;
     39        this->pointer_ = pointer;
     40        NetworkFunctionManager::getInstance().registerFunction(this);
    4341    }
    4442
    4543    void NetworkFunctionBase::setNetworkID(uint32_t id)
    4644    {
    47         NetworkFunctionManager::getInstance().getIdMap().erase(this->networkID_);  // remove old id
     45        NetworkFunctionManager::getInstance().unregisterFunction(this); // unregister with old id
    4846        this->networkID_ = id;
    49         NetworkFunctionManager::getInstance().getIdMap()[this->networkID_] = this; // add new id
     47        NetworkFunctionManager::getInstance().registerFunction(this);   // register with new id
    5048    }
    5149}
Note: See TracChangeset for help on using the changeset viewer.