|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Specification of a message to post when a trigger fires (or a crank completes). More...
#include <Subscriptions.h>
Public Member Functions | |
| std::string | toXML () |
| Serialise as a <post ...>...</post> XML element including content children. | |
| bool | fromXML (const char *xml) |
| Parse from an XML string containing a <post .../> element. | |
| bool | fromXML (XMLNode &node) |
| Parse from an already-parsed <post> XML node, including its <content> children. | |
| bool | contentFromXML (XMLNode &node) |
Collect inline <content> entries (and contentkey/content attributes) from the XML node into the packed content buffer. | |
| uint32 | addContentToMsg (DataMessage *msg) |
Unpack the inline content entries into msg as typed user entries. | |
Public Attributes | |
| uint32 | to |
| Addressee component id (0 = publish to subscribers). | |
| PsyType | type |
| Type of the posted message. | |
| PsyContext | context |
| Context the post applies in. | |
| PsyContext | contextchange |
| Context switch the posted message announces (NOCONTEXT if none). | |
| uint32 | tag |
| Tag for the posted message. | |
| uint64 | ttl |
| Time-to-live of the posted message in microseconds. | |
| uint8 | policy |
| Delivery policy flags (e.g. | |
| uint32 | contentCount |
Number of inline content entries packed into content. | |
| char | name [MAXKEYNAMELEN+1] |
| Name of this post spec. | |
| char | content [MAXCONTENTLEN+1] |
| Packed content entries: "||T||key||value" repeated (T = S, I or F). | |
Specification of a message to post when a trigger fires (or a crank completes).
Describes the outgoing message: addressee, type, contexts, tag, ttl, policy, plus optional inline content entries. Content is packed into the fixed content buffer as a "||T||key||value" token list (T = S/I/F for string/integer/float) so the whole spec stays a flat fixed-size POD; addContentToMsg() unpacks it into a real DataMessage at post time.
Definition at line 270 of file Subscriptions.h.
|
inline |
Unpack the inline content entries into msg as typed user entries.
| msg | the message being posted (entries are set on it) |
Definition at line 380 of file Subscriptions.h.
References cmlabs::utils::Ascii2Float64(), cmlabs::utils::Ascii2Int64(), content, contentCount, cmlabs::DataMessage::setFloat(), cmlabs::DataMessage::setInt(), cmlabs::DataMessage::setString(), and cmlabs::utils::TextListSplit().
Referenced by cmlabs::PsyAPI::postOutputMessage(), and cmlabs::TriggerSpec::UnitTest().
|
inline |
Collect inline <content> entries (and contentkey/content attributes) from the XML node into the packed content buffer.
| node | the XML node. |
Definition at line 346 of file Subscriptions.h.
References content, contentCount, cmlabs::html::DecodeHTML(), cmlabs::XMLNode::getAttribute(), cmlabs::XMLNode::getChildNode(), MAXCONTENTLEN, cmlabs::XMLNode::nChildNode(), cmlabs::utils::strcpyavail(), stricmp, and cmlabs::utils::StringFormat().
Referenced by fromXML().
|
inline |
Parse from an XML string containing a <post .../> element.
| xml | XML text. |
Definition at line 319 of file Subscriptions.h.
References cmlabs::XMLResults::error, cmlabs::eXMLErrorNone, fromXML(), and cmlabs::XMLNode::isEmpty().
Referenced by fromXML(), and Java_com_cmlabs_cmsdk_cmsdkJNI_PostSpec_1fromXML_1_1SWIG_10().
|
inline |
Parse from an already-parsed <post> XML node, including its <content> children.
| node | the XML node. |
Definition at line 329 of file Subscriptions.h.
References cmlabs::utils::Ascii2Uint32(), cmlabs::utils::Ascii2Uint64(), contentFromXML(), context, contextchange, cmlabs::XMLNode::getAttribute(), MAXKEYNAMELEN, name, policy, cmlabs::utils::strcpyavail(), tag, to, ttl, and type.
|
inline |
Serialise as a <post ...>...</post> XML element including content children.
Definition at line 283 of file Subscriptions.h.
References content, contentCount, context, contextchange, cmlabs::html::EncodeHTML(), name, policy, cmlabs::utils::StringFormat(), tag, cmlabs::utils::TextListSplit(), to, ttl, and type.
Referenced by cmlabs::TriggerSpec::toXML(), and cmlabs::TriggerSpec::UnitTest().
| char cmlabs::PostSpec::content[MAXCONTENTLEN+1] |
Packed content entries: "||T||key||value" repeated (T = S, I or F).
Definition at line 281 of file Subscriptions.h.
Referenced by _wrap_PostSpec_content_set(), _wrap_PostSpec_content_set(), addContentToMsg(), contentFromXML(), Java_com_cmlabs_cmsdk_cmsdkJNI_PostSpec_1content_1set(), toXML(), and cmlabs::TriggerSpec::UnitTest().
| uint32 cmlabs::PostSpec::contentCount |
Number of inline content entries packed into content.
Definition at line 278 of file Subscriptions.h.
Referenced by addContentToMsg(), contentFromXML(), toXML(), and cmlabs::TriggerSpec::UnitTest().
| PsyContext cmlabs::PostSpec::context |
Context the post applies in.
Definition at line 273 of file Subscriptions.h.
| PsyContext cmlabs::PostSpec::contextchange |
Context switch the posted message announces (NOCONTEXT if none).
Definition at line 274 of file Subscriptions.h.
Referenced by fromXML(), cmlabs::PsyAPI::postOutputMessage(), and toXML().
| char cmlabs::PostSpec::name[MAXKEYNAMELEN+1] |
Name of this post spec.
Definition at line 279 of file Subscriptions.h.
Referenced by _wrap_PostSpec_name_set(), _wrap_PostSpec_name_set(), fromXML(), cmlabs::TriggerSpec::getPostSpec(), cmlabs::TriggerSpec::getPostSpecs(), Java_com_cmlabs_cmsdk_cmsdkJNI_PostSpec_1name_1set(), toXML(), and cmlabs::TriggerSpec::UnitTest().
| uint8 cmlabs::PostSpec::policy |
Delivery policy flags (e.g.
MESSAGE_NON_GUARANTEED).
Definition at line 277 of file Subscriptions.h.
Referenced by fromXML(), cmlabs::PsyAPI::postOutputMessage(), and toXML().
| uint32 cmlabs::PostSpec::tag |
Tag for the posted message.
Definition at line 275 of file Subscriptions.h.
Referenced by fromXML(), cmlabs::PsyAPI::postOutputMessage(), and toXML().
| uint32 cmlabs::PostSpec::to |
Addressee component id (0 = publish to subscribers).
Definition at line 271 of file Subscriptions.h.
Referenced by fromXML(), cmlabs::PsyAPI::postOutputMessage(), toXML(), and cmlabs::TriggerSpec::UnitTest().
| uint64 cmlabs::PostSpec::ttl |
Time-to-live of the posted message in microseconds.
Definition at line 276 of file Subscriptions.h.
Referenced by fromXML(), cmlabs::PsyAPI::postOutputMessage(), and toXML().
| PsyType cmlabs::PostSpec::type |
Type of the posted message.
Definition at line 272 of file Subscriptions.h.
Referenced by fromXML(), cmlabs::TriggerSpec::getPostSpec(), cmlabs::TriggerSpec::getPostSpecs(), cmlabs::PsyAPI::postOutputMessage(), toXML(), and cmlabs::TriggerSpec::UnitTest().