Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ASEBA_DESCRIPTIONS_MANAGER_H
00022 #define ASEBA_DESCRIPTIONS_MANAGER_H
00023
00024 #include "msg.h"
00025 #include <string>
00026
00027 namespace Aseba
00028 {
00031
00034 class DescriptionsManager
00035 {
00036 protected:
00038 struct NodeDescription: public TargetDescription
00039 {
00040 NodeDescription();
00041 NodeDescription(const TargetDescription& targetDescription);
00042
00043 unsigned namedVariablesReceptionCounter;
00044 unsigned localEventsReceptionCounter;
00045 unsigned nativeFunctionReceptionCounter;
00046 };
00048 typedef std::map<unsigned, NodeDescription> NodesDescriptionsMap;
00049 NodesDescriptionsMap nodesDescriptions;
00050
00051 public:
00053 virtual ~DescriptionsManager() {}
00054
00056 void processMessage(const Message* message);
00057
00059 std::wstring getNodeName(unsigned nodeId) const;
00061 unsigned getNodeId(const std::wstring& name, unsigned preferedId = 0, bool *ok = 0) const;
00063 const TargetDescription * const getDescription(unsigned nodeId, bool *ok = 0) const;
00065 unsigned getVariablePos(unsigned nodeId, const std::wstring& name, bool *ok = 0) const;
00067 unsigned getVariableSize(unsigned nodeId, const std::wstring& name, bool *ok = 0) const;
00069 void reset();
00070
00071
00072
00073
00074 protected:
00076 void checkIfNodeDescriptionComplete(unsigned id, const NodeDescription& description);
00077
00079 virtual void nodeProtocolVersionMismatch(const std::wstring &nodeName, uint16 protocolVersion) { }
00080
00082 virtual void nodeDescriptionReceived(unsigned nodeId) { }
00083 };
00084
00086 }
00087
00088 #endif