|
Open Model Railroad Network (OpenMRN)
|
A map that allows registration and lookup or per-node handler of a particular message ID. More...
#include <NodeHandlerMap.hxx>
Public Types | |
| typedef map_type::Iterator | iterator |
| Iterator type. | |
Public Member Functions | |
| NodeHandlerMapBase (size_t entries) | |
| Creates a map with. | |
| void | insert (void *node, uint32_t id, void *value) |
| Inserts a handler into the map. | |
| void | erase (void *node, uint32_t id, void *value) |
| Removes a handlerfrom this map. | |
| void * | lookup (void *node, uint32_t id) |
| Finds a handler for a particular node and particular messageID. | |
| iterator | begin () |
| iterator | end () |
Static Public Member Functions | |
| static pair< void *, uint32_t > | read_key (key_type key) |
| Decodes a compact key into a pair. | |
Private Types | |
| typedef uint64_t | key_type |
| Compacted payload type. | |
| typedef void * | value_type |
| Generic handler type that we'll keep. | |
| typedef StlMap< key_type, value_type > | map_type |
| Type of the storage object. | |
Private Member Functions | |
| key_type | make_key (void *node, uint32_t id) |
| Combines the node pointer and the message ID into a lookup key. | |
Private Attributes | |
| map_type | entries_ |
| The actual storage object. | |
A map that allows registration and lookup or per-node handler of a particular message ID.
Regular handlers are registered for a node and messsageID pair.
The map supports registering handlers for a message ID globally by supplying nullptr as the node. These will be returned for nodes that have no specific handler for that particular message ID.
Definition at line 61 of file NodeHandlerMap.hxx.
Iterator type.
Definition at line 134 of file NodeHandlerMap.hxx.
|
private |
Compacted payload type.
Definition at line 69 of file NodeHandlerMap.hxx.
|
private |
Type of the storage object.
Definition at line 74 of file NodeHandlerMap.hxx.
|
private |
Generic handler type that we'll keep.
Definition at line 72 of file NodeHandlerMap.hxx.
|
inline |
Definition at line 77 of file NodeHandlerMap.hxx.
|
inline |
|
inline |
Definition at line 136 of file NodeHandlerMap.hxx.
|
inline |
Definition at line 142 of file NodeHandlerMap.hxx.
|
inline |
Removes a handlerfrom this map.
| node | is the node to unregister handler for (nullptr for all nodes) |
| id | is the message ID for which to unregister for. |
| value | is the pointer to the handler. |
Definition at line 102 of file NodeHandlerMap.hxx.
|
inline |
Inserts a handler into the map.
| node | is the node for which to register the handler. |
| id | is the message ID for which to register. |
| value | is the handler to register. |
Definition at line 91 of file NodeHandlerMap.hxx.
|
inline |
Finds a handler for a particular node and particular messageID.
| node | what to look up for |
| id | is the message ID to look up |
Definition at line 116 of file NodeHandlerMap.hxx.
|
inlineprivate |
Combines the node pointer and the message ID into a lookup key.
Definition at line 162 of file NodeHandlerMap.hxx.
|
inlinestatic |
Decodes a compact key into a pair.
| key | is what to decode. |
Definition at line 149 of file NodeHandlerMap.hxx.
|
private |
The actual storage object.
Definition at line 175 of file NodeHandlerMap.hxx.