famouso::mw::nl::awds::NodeRepository Class Reference
A node repository for holding AWDS nodes and register nodes to subjects. More...
#include <NodeRepository.h>
Data Structures | |
class | attr_finder |
A function object for finding attributes and set the strictest to the result. | |
class | Subscriber |
A class for mapping attributes to a node. | |
Public Types | |
typedef NodeRepository | type |
typedef boost::shared_container_iterator < std::list< Node::type > > | NodeIterator |
typedef famouso::mw::Subject | SNN |
A famouso Subject. | |
Public Member Functions | |
Node::type | find (MAC &mac) |
Find a node by a given MAC address. If the node doesn't exists, it will be created. | |
std::pair< NodeIterator, NodeIterator > | find (SNN subject) |
Find all nodes registered to the given Subject wich match the required attributes. The attributes can be defined by publisher or subscriber. | |
FlowId | flowid (Node::type &node, SNN subject) |
Find the flow id for a node subscribed to a subject. | |
int | elapsed (Node::type &node, SNN subject) |
Find the elapsed seconds since a node subscribed to a subject. | |
template<class AttrSet > | |
void | find (Node::type &node, SNN subject, AttrSet &cas) |
Search the subscriber and publisher attributes defined by the given attribute set and set the strictest to the given set. | |
void | remove (Node::type &node) |
Remove a node from the repository. It will be removed from all subjects too. | |
void | remove (SNN &subject) |
Remove a subject from the repository. Clients registered to the given subject will be unregistered from it. | |
void | reg (Node::type &node, SNN &subject, Attributes::type &attribs) |
Register a node to a subject. | |
void | reg (SNN subject, Attributes::type &attribs) |
Register a subject to the repository. | |
void | unreg (Node::type &node) |
Unregister the given node from all known subjects. | |
void | unreg (Node::type &node, SNN subject) |
Unregister the given node from a subject. | |
void | update (Node::type &node, SNN subject, FlowId fId) |
Updates the flow id of a node registered to a subject. | |
Static Public Member Functions | |
static type & | getInstance () |
Get the only instance of the node repository. |
Detailed Description
A node repository for holding AWDS nodes and register nodes to subjects.
- Todo:
- We can't handle multiple publisher with same subject and different attributes. We use the attributes of latest announce for now.
Member Typedef Documentation
typedef boost::shared_container_iterator<std::list<Node::type> > famouso::mw::nl::awds::NodeRepository::NodeIterator |
A famouso Subject.
A node repository for holding AWDS nodes and register nodes to subjects.
- Todo:
- We can't handle multiple publisher with same subject and different attributes. We use the attributes of latest announce for now.
Member Function Documentation
int famouso::mw::nl::awds::NodeRepository::elapsed | ( | Node::type & | node, | |
SNN | subject | |||
) |
Find the elapsed seconds since a node subscribed to a subject.
- Parameters:
-
node The node to find the flow id of. subject The subject to find the flow id of.
- Returns:
- The found seconds or INT_MAX if not found.
Referenced by famouso::mw::nl::AWDSNL::deliver().
void famouso::mw::nl::awds::NodeRepository::find | ( | Node::type & | node, | |
SNN | subject, | |||
AttrSet & | cas | |||
) | [inline] |
Search the subscriber and publisher attributes defined by the given attribute set and set the strictest to the given set.
- Parameters:
-
node The node to find the attributes of. subject The subject to find the attributes of. cas The attributes set to save the found attributes.
- Template Parameters:
-
AttrSet The atttributes set type.
std::pair< NodeRepository::NodeIterator, NodeRepository::NodeIterator > famouso::mw::nl::awds::NodeRepository::find | ( | SNN | subject | ) |
Find all nodes registered to the given Subject wich match the required attributes. The attributes can be defined by publisher or subscriber.
- Parameters:
-
subject The subject to find nodes for.
- Returns:
- A list of nodes registered for the given subject. The list can be empty, if no node is registered or no node match the required attributes.
References famouso::mw::nl::awds::ComparableAttributeSet< AttrSet >::match().
Node::type famouso::mw::nl::awds::NodeRepository::find | ( | MAC & | mac | ) |
Find a node by a given MAC address. If the node doesn't exists, it will be created.
- Parameters:
-
mac The MAC address to find the node for.
- Returns:
- The node corresponding to the MAC address.
References famouso::mw::nl::awds::detail::Node< AttrSet >::create().
Referenced by famouso::mw::nl::AWDSNL::deliver().
FlowId famouso::mw::nl::awds::NodeRepository::flowid | ( | Node::type & | node, | |
SNN | subject | |||
) |
Find the flow id for a node subscribed to a subject.
- Parameters:
-
node The node to find the flow id of. subject The subject to find the flow id of.
- Returns:
- The found flow id or -1.
Referenced by famouso::mw::nl::AWDSNL::deliver().
NodeRepository & famouso::mw::nl::awds::NodeRepository::getInstance | ( | ) | [static] |
Get the only instance of the node repository.
- Returns:
- A reference to the only instance of the repository.
void famouso::mw::nl::awds::NodeRepository::reg | ( | SNN | subject, | |
Attributes::type & | attribs | |||
) |
Register a subject to the repository.
- Parameters:
-
subject The subject to register. attribs The attributes which the publisher requires.
void famouso::mw::nl::awds::NodeRepository::reg | ( | Node::type & | node, | |
SNN & | subject, | |||
Attributes::type & | attribs | |||
) |
Register a node to a subject.
- Parameters:
-
node The node to register. subject The subject to register. attribs The attributes which the subscriber requires.
- Todo:
- If the subject is not registered, this function should do nothing.
Referenced by famouso::mw::nl::AWDSNL::deliver().
void famouso::mw::nl::awds::NodeRepository::remove | ( | SNN & | subject | ) |
Remove a subject from the repository. Clients registered to the given subject will be unregistered from it.
- Parameters:
-
subject The subject to remove.
void famouso::mw::nl::awds::NodeRepository::remove | ( | Node::type & | node | ) |
Remove a node from the repository. It will be removed from all subjects too.
- Parameters:
-
node The node to remove.
References unreg().
void famouso::mw::nl::awds::NodeRepository::unreg | ( | Node::type & | node, | |
SNN | subject | |||
) |
Unregister the given node from a subject.
- Parameters:
-
node The node to unregister. subject The subject to unregister from.
void famouso::mw::nl::awds::NodeRepository::unreg | ( | Node::type & | node | ) |
Unregister the given node from all known subjects.
- Parameters:
-
node The node to unregister.
Referenced by famouso::mw::nl::AWDSNL::deliver(), and remove().
void famouso::mw::nl::awds::NodeRepository::update | ( | Node::type & | node, | |
SNN | subject, | |||
FlowId | fId | |||
) |
Updates the flow id of a node registered to a subject.
- Parameters:
-
node The node to update. subject The subject to update. fId The new flow id.
Referenced by famouso::mw::nl::AWDSNL::deliver().
The documentation for this class was generated from the following files:
- include/mw/nl/awds/NodeRepository.h
- src/mw/nl/awds/NodeRepository.cc