27 Node*
getNode(
const std::string& name,
bool create);
30 void prepare(
const std::string& name);
32 Contact query(
const std::string& name,
const std::string& category);
46 std::map<std::string, std::pair<Node*, bool>>
nodes_map;
67 for (
auto& n : nodes_map) {
68 if (n.second.first !=
nullptr) {
69 if (!n.second.second) {
70 delete n.second.first;
71 n.second.first =
nullptr;
80 if (dummy !=
nullptr) {
94 if (it != nodes_map.end()) {
95 node = it->second.first;
100 if (it == nodes_map.end()) {
101 nodes_map[nc.
getNodeName()] = std::make_pair(node,
false);
107 node = it->second.first;
124 if (node !=
nullptr) {
125 node->
add(contactable);
139 if (node !=
nullptr) {
140 node->
update(contactable);
161 Node* node = getNode(contactable.
getName(),
false);
162 if (node !=
nullptr) {
163 node->
remove(contactable);
174 for (
const auto& n : nodes_map) {
175 result = n.second.first->query(name, category);
189 for (
const auto& n : nodes_map) {
190 n.second.first->interrupt();
209 if (it != nodes_map.end()) {
210 result = it->second.first->where();
221 if (it != nodes_map.end()) {
230 nodes_map[name].second =
true;
241 if (active_name.empty()) {
242 dummy =
new Node(
"...");
250 yAssert(nodes_map.find(name) == nodes_map.end());
251 nodes_map[name] = std::make_pair(&node,
true);
258 nodes_map.erase(name);
275 mPriv->add(contactable);
280 mPriv->remove(contactable);
285 return mPriv->query(name, category);
295 return mPriv->enable(flag);
305 return mPriv->getParent(name);
310 return mPriv->getURI(name);
315 mPriv->prepare(name);
320 mPriv->update(contactable);
325 mPriv->setActiveName(name);
330 return mPriv->getActiveName();
335 return mPriv->requireActiveName();
340 mPriv->addExternalNode(name, node);
345 mPriv->removeExternalNode(name);
void prepare(const std::string &name)
prepare if it is not already been done, opens the port of the Node.
void update(Contactable &contactable)
update should update the contactable with new information.
void remove(Contactable &contactable) override
remove specified contactable from the list of contactables associated with this Node.
void add(Contactable &contactable) override
add a contactable to this node.
std::map< std::string, std::pair< Node *, bool > > nodes_map
void addExternalNode(const std::string &name, Node &node)
void add(Contactable &contactable)
void prepare(const std::string &name)
Contact query(const std::string &name, const std::string &category)
std::string getActiveName()
Contact getParent(const std::string &name)
Node * getNode(const std::string &name, bool create)
void removeExternalNode(const std::string &name)
Contact getURI(const std::string &name)
void remove(Contactable &contactable)
void setActiveName(const std::string &name)
void update(Contactable &contactable)
void removeExternalNode(const std::string &name)
removeExternalNode erase the node from the container.
void remove(Contactable &contactable) override
remove a Contactable from the Node specified in the contactable's name.
virtual Contact query(const std::string &name, const std::string &category="") override
query the list of Node to find a Contact with the specified name.
void addExternalNode(const std::string &name, Node &node)
addExternalNode adds a Node to this container.
Contact getURI(const std::string &name)
getURI queries the Node specified in the name parameter to get Contact information about the specifie...
std::string getActiveName()
getActiveName getter for the currently active node's name
bool enable(bool flag)
enable setter for the activity state of the container.
bool requireActiveName()
requireActiveName if there is no active node, creates a temporary one.
void clear()
clear empties the container
void add(Contactable &contactable) override
add a Contactable to the Node specified in the contactable name (see NestedContact....
void setActiveName(const std::string &name)
setActiveName setter for the currently active node
void prepare(const std::string &name)
prepare checks for the existence of the node specified in the name parameter.
void interrupt()
interrupt delegates interrupt call to all of the Node in this container.
virtual void update(Contactable &contactable)
update a Node information in this container.
Contact getParent(const std::string &name)
getParent get info about node associated with the specified port.
An interface to the operating system, including Port based communication.
The main, catch-all namespace for YARP.