Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2015, 2:41:57 PM (9 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/NetworkFunctionManager.h

    r10474 r10475  
    3434#include <cassert>
    3535#include <map>
     36#include <set>
    3637
    3738namespace orxonox
     
    4243            static NetworkFunctionManager& getInstance();
    4344
    44             void setNetworkID(const std::string& name, uint32_t id);
     45            void registerFunction(NetworkFunctionBase* function);
     46            void unregisterFunction(NetworkFunctionBase* function);
     47
    4548            void destroyAllNetworkFunctions();
    4649
    47             inline std::map<std::string, NetworkFunctionBase*>& getNameMap()
    48                 { return nameMap_; }
    49             inline std::map<NetworkFunctionPointer, NetworkFunctionBase*>& getFunctorMap()
    50                 { return functorMap_; }
    51             inline std::map<uint32_t, NetworkFunctionBase*>& getIdMap()
    52                 { return idMap_; }
     50            inline const std::set<NetworkFunctionBase*>& getAllFunctions()
     51                { return functions_; }
    5352
    54             NetworkFunctionBase* getFunction(const NetworkFunctionPointer& p);
    55             NetworkFunctionBase* getFunction(uint32_t id);
     53            NetworkFunctionBase* getFunctionByName(const std::string& name);
     54            NetworkFunctionBase* getFunctionByFunctionPointer(const NetworkFunctionPointer& p);
     55            NetworkFunctionBase* getFunctionByNetworkId(uint32_t id);
    5656
    5757        private:
     58            std::set<NetworkFunctionBase*> functions_;
    5859            std::map<std::string, NetworkFunctionBase*> nameMap_;
    5960            std::map<NetworkFunctionPointer, NetworkFunctionBase*> functorMap_;
Note: See TracChangeset for help on using the changeset viewer.