|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Hierarchical message type identifier — the key used for publish/subscribe matching in Psyclone. More...
#include <Types.h>
Public Member Functions | |
| bool | isValid () |
| A type is valid if its root level is non-zero. | |
| bool | operator== (const PsyType &othertype) const |
| Exact byte-wise equality of all levels (wildcards NOT honoured; use matches() for that). | |
| bool | operator!= (const PsyType &othertype) const |
| Exact byte-wise inequality (wildcards NOT honoured). | |
| bool | operator< (const PsyType &othertype) const |
| Lexicographic level-by-level ordering, so PsyType can be used as a std::map/std::multimap key. | |
| bool | operator> (const PsyType &othertype) const |
| uint16 | operator[] (int i) const |
| bool | setLevel (int i, uint16 value) |
| Set an individual hierarchy level. | |
| bool | matches (PsyType &otherType) const |
| Wildcard-aware type matching used by the subscription system. | |
| std::string | toString () |
| Render as dotted decimal notation, e.g. "2.201.3"; empty string if invalid. | |
| std::string | toString (std::map< uint16, std::string > *subtypes) |
| Render as dotted notation, substituting readable names for level ids where available. | |
| bool | fromString (const char *text) |
| Parse dotted decimal notation (e.g. | |
Public Attributes | |
| uint16 | levels [PSYTYPELEVELS] |
| Hierarchy levels, most significant first; 0 terminates, 0xFFFF is a wildcard. | |
Hierarchical message type identifier — the key used for publish/subscribe matching in Psyclone.
A PsyType is a fixed array of 16 uint16 levels forming a dotted hierarchy, e.g. "2.201.3" is stored as levels = {2, 201, 3, 0, ...}. Level value 0 ends the hierarchy (a valid type must have levels[0] != 0) and the special value 0xFFFF acts as a wildcard in matches(). Subscriptions match message types via matches(), so a subscriber to "2.201.0xFFFF" receives all subtypes of "2.201".
|
inline |
Parse dotted decimal notation (e.g.
"2.201.3") into the level array. All levels are reset first.
| text | dotted type string |
Definition at line 233 of file Types.h.
References isValid(), levels, and PSYTYPELEVELS.
Referenced by cmlabs::TriggerSpec::UnitTest().
|
inline |
A type is valid if its root level is non-zero.
Definition at line 126 of file Types.h.
References levels.
Referenced by fromString(), and cmlabs::PsyAPI::postOutputMessage().
|
inline |
Wildcard-aware type matching used by the subscription system.
Two types match if every level is either equal or 0xFFFF on either side.
| otherType | the type to compare against |
Definition at line 173 of file Types.h.
References levels, and PSYTYPELEVELS.
|
inline |
|
inline |
Lexicographic level-by-level ordering, so PsyType can be used as a std::map/std::multimap key.
Definition at line 136 of file Types.h.
References levels, and PSYTYPELEVELS.
|
inline |
|
inline |
Definition at line 145 of file Types.h.
References levels, and PSYTYPELEVELS.
|
inline |
Definition at line 154 of file Types.h.
References levels, and PSYTYPELEVELS.
|
inline |
Set an individual hierarchy level.
| i | level index (0..PSYTYPELEVELS-1) |
| value | level value (0 terminates, 0xFFFF = wildcard) |
Definition at line 163 of file Types.h.
References levels, and PSYTYPELEVELS.
Referenced by cmlabs::TriggerSpec::UnitTest().
|
inline |
Render as dotted decimal notation, e.g. "2.201.3"; empty string if invalid.
Definition at line 195 of file Types.h.
References levels, and PSYTYPELEVELS.
Referenced by toString().
|
inline |
Render as dotted notation, substituting readable names for level ids where available.
| subtypes | map of level id → name; NULL falls back to numeric toString() |
Definition at line 208 of file Types.h.
References levels, PSYTYPELEVELS, and toString().
| uint16 PsyType::levels[PSYTYPELEVELS] |
Hierarchy levels, most significant first; 0 terminates, 0xFFFF is a wildcard.
Definition at line 124 of file Types.h.
Referenced by fromString(), isValid(), matches(), operator!=(), operator<(), operator==(), operator>(), operator[](), setLevel(), toString(), and toString().