#include <descriptions-manager.h>
Classes | |
struct | NodeDescription |
Potentially partial Descriptions of nodes along with their reception status. More... | |
Public Member Functions | |
const TargetDescription *const | getDescription (unsigned nodeId, bool *ok=0) const |
Return the description of a node and set ok to true, if provided; if invalid, return 0 and set ok to false. | |
unsigned | getNodeId (const std::wstring &name, unsigned preferedId=0, bool *ok=0) const |
Return the id of the node corresponding to name and set ok to true, if provided; if invalid, return 0xFFFFFFFF and set ok to false. If several nodes have this name, either return preferedId if it exists otherwise return the first found. | |
std::wstring | getNodeName (unsigned nodeId) const |
Return the name corresponding to a node identifier; if invalid, return the empty string. | |
unsigned | getVariablePos (unsigned nodeId, const std::wstring &name, bool *ok=0) const |
Return the position of a variable and set ok to true, if provided; if invalid, return 0xFFFFFFFF and set ok to false. | |
unsigned | getVariableSize (unsigned nodeId, const std::wstring &name, bool *ok=0) const |
Return the length of a variable and set ok to true, if provided; if invalid, return 0xFFFFFFFF and set ok to false. | |
void | processMessage (const Message *message) |
Process a message and reconstruct descriptions if relevant. | |
void | reset () |
Reset all descriptions, for instance when a network was disconnected and is reconnected. | |
virtual | ~DescriptionsManager () |
Virtual destructor. | |
Protected Types | |
typedef std::map< unsigned, NodeDescription > | NodesDescriptionsMap |
Map from nodes id to nodes descriptions. | |
Protected Member Functions | |
void | checkIfNodeDescriptionComplete (unsigned id, const NodeDescription &description) |
Check if a node description has been fully received, and if so, call the nodeDescriptionReceived() virtual function. | |
virtual void | nodeDescriptionReceived (unsigned nodeId) |
Virtual function that is called when a node description has been fully received. | |
virtual void | nodeProtocolVersionMismatch (const std::wstring &nodeName, uint16 protocolVersion) |
Virtual function that is called when a version mismatches. | |
Protected Attributes | |
NodesDescriptionsMap | nodesDescriptions |
all known nodes descriptions |
This helper class builds complete descriptions out of multiple message parts. For now, it does not support the disconnection of a whole network nor the update of the description of any node
Definition at line 34 of file descriptions-manager.h.
typedef std::map<unsigned, NodeDescription> Aseba::DescriptionsManager::NodesDescriptionsMap [protected] |
Map from nodes id to nodes descriptions.
Definition at line 48 of file descriptions-manager.h.
virtual Aseba::DescriptionsManager::~DescriptionsManager | ( | ) | [inline, virtual] |
Virtual destructor.
Definition at line 53 of file descriptions-manager.h.
void Aseba::DescriptionsManager::checkIfNodeDescriptionComplete | ( | unsigned | id, |
const NodeDescription & | description | ||
) | [protected] |
Check if a node description has been fully received, and if so, call the nodeDescriptionReceived() virtual function.
Definition at line 142 of file descriptions-manager.cpp.
const TargetDescription *const Aseba::DescriptionsManager::getDescription | ( | unsigned | nodeId, |
bool * | ok = 0 |
||
) | const |
Return the description of a node and set ok to true, if provided; if invalid, return 0 and set ok to false.
Definition at line 198 of file descriptions-manager.cpp.
unsigned Aseba::DescriptionsManager::getNodeId | ( | const std::wstring & | name, |
unsigned | preferedId = 0 , |
||
bool * | ok = 0 |
||
) | const |
Return the id of the node corresponding to name and set ok to true, if provided; if invalid, return 0xFFFFFFFF and set ok to false. If several nodes have this name, either return preferedId if it exists otherwise return the first found.
Definition at line 167 of file descriptions-manager.cpp.
std::wstring Aseba::DescriptionsManager::getNodeName | ( | unsigned | nodeId | ) | const |
Return the name corresponding to a node identifier; if invalid, return the empty string.
Definition at line 154 of file descriptions-manager.cpp.
unsigned Aseba::DescriptionsManager::getVariablePos | ( | unsigned | nodeId, |
const std::wstring & | name, | ||
bool * | ok = 0 |
||
) | const |
Return the position of a variable and set ok to true, if provided; if invalid, return 0xFFFFFFFF and set ok to false.
Definition at line 215 of file descriptions-manager.cpp.
unsigned Aseba::DescriptionsManager::getVariableSize | ( | unsigned | nodeId, |
const std::wstring & | name, | ||
bool * | ok = 0 |
||
) | const |
Return the length of a variable and set ok to true, if provided; if invalid, return 0xFFFFFFFF and set ok to false.
Definition at line 241 of file descriptions-manager.cpp.
virtual void Aseba::DescriptionsManager::nodeDescriptionReceived | ( | unsigned | nodeId | ) | [inline, protected, virtual] |
Virtual function that is called when a node description has been fully received.
Reimplemented in Aseba::SignalingDescriptionsManager, and Aseba::AsebaNetworkInterface.
Definition at line 82 of file descriptions-manager.h.
virtual void Aseba::DescriptionsManager::nodeProtocolVersionMismatch | ( | const std::wstring & | nodeName, |
uint16 | protocolVersion | ||
) | [inline, protected, virtual] |
Virtual function that is called when a version mismatches.
Definition at line 79 of file descriptions-manager.h.
void Aseba::DescriptionsManager::processMessage | ( | const Message * | message | ) |
Process a message and reconstruct descriptions if relevant.
Definition at line 44 of file descriptions-manager.cpp.
void Aseba::DescriptionsManager::reset | ( | ) |
Reset all descriptions, for instance when a network was disconnected and is reconnected.
Definition at line 265 of file descriptions-manager.cpp.
all known nodes descriptions
Definition at line 49 of file descriptions-manager.h.