CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::QuerySpec Struct Reference

Specification of a query against a catalog/service/feed, attached to a TriggerSpec. More...

#include <Subscriptions.h>

Collaboration diagram for cmlabs::QuerySpec:
[legend]

Public Member Functions

std::string toXML ()
 Serialise as a <query .../> XML element.
bool fromXML (const char *xml)
 Parse from an XML string containing a <query .../> element.
bool fromXML (XMLNode &node)
 Parse from an already-parsed <query> XML node.

Public Attributes

uint32 source
 Component id of the source to query.
uint32 origin
 Restrict to data originating from this component id (0 = any).
uint64 maxage
 Maximum age of results in MICROSECONDS (XML gives ms; parser multiplies by 1000).
uint32 maxcount
 Maximum number of results to return (0 = unlimited).
PsyContext context
 Restrict to data matching this context.
bool binary
 Request results in binary form rather than text.
uint32 ipHost
 External source: IPv4 host (as uint32), 0 if not used.
uint16 ipPort
 External source: TCP/UDP port, 0 if not used.
char sourceName [MAXKEYNAMELEN+1]
 Name of the source component (alternative to numeric id).
char hostName [MAXKEYNAMELEN+1]
 External source: host name (alternative to ipHost).
char name [MAXKEYNAMELEN+1]
 Name of this query, used to reference its results in the crank.
char key [MAXKEYNAMELEN+1]
 Key to query on.
char value [MAXVALUENAMELEN+1]
 Value to match.
char type [MAXKEYNAMELEN+1]
 Requested data/content type.
char subdir [MAXKEYNAMELEN+1]
 Sub-directory/collection within the source.
char ext [MAXKEYNAMELEN+1]
 File extension / data format selector.
char operation [MAXKEYNAMELEN+1]
 Operation to perform (source-specific verb).

Detailed Description

Specification of a query against a catalog/service/feed, attached to a TriggerSpec.

When its trigger fires, the runtime executes this query against the named source component (or an external host/port) and delivers the results to the crank alongside the trigger message. Fixed-size POD stored back-to-back inside the TriggerSpec block.

Definition at line 126 of file Subscriptions.h.

Member Function Documentation

◆ fromXML() [1/2]

bool cmlabs::QuerySpec::fromXML ( const char * xml)
inline

Parse from an XML string containing a <query .../> element.

Parameters
xmlXML text.
Returns
true if all attributes were present and valid.

Definition at line 151 of file Subscriptions.h.

References cmlabs::XMLResults::error, cmlabs::eXMLErrorNone, fromXML(), and cmlabs::XMLNode::isEmpty().

Referenced by fromXML(), and Java_com_cmlabs_cmsdk_cmsdkJNI_QuerySpec_1fromXML_1_1SWIG_10().

◆ fromXML() [2/2]

bool cmlabs::QuerySpec::fromXML ( XMLNode & node)
inline

Parse from an already-parsed <query> XML node.

Parameters
nodethe XML node.
Returns
true if all attributes were present and valid.

Definition at line 161 of file Subscriptions.h.

References cmlabs::utils::Ascii2Uint32(), cmlabs::utils::Ascii2Uint64(), binary, context, ext, cmlabs::XMLNode::getAttribute(), hostName, ipHost, ipPort, key, maxage, maxcount, MAXKEYNAMELEN, MAXVALUENAMELEN, name, operation, origin, source, sourceName, cmlabs::utils::strcpyavail(), stricmp, subdir, type, and value.

◆ toXML()

std::string cmlabs::QuerySpec::toXML ( )
inline

Serialise as a <query .../> XML element.

Definition at line 145 of file Subscriptions.h.

References binary, ext, hostName, ipHost, ipPort, key, maxage, maxcount, name, operation, origin, source, sourceName, cmlabs::utils::StringFormat(), subdir, type, and value.

Referenced by cmlabs::TriggerSpec::toXML().

Member Data Documentation

◆ binary

bool cmlabs::QuerySpec::binary

Request results in binary form rather than text.

Definition at line 132 of file Subscriptions.h.

Referenced by fromXML(), cmlabs::PsyAPI::queryCatalog(), cmlabs::PsyAPI::queryCatalog(), and toXML().

◆ context

PsyContext cmlabs::QuerySpec::context

Restrict to data matching this context.

Definition at line 131 of file Subscriptions.h.

Referenced by fromXML().

◆ ext

◆ hostName

char cmlabs::QuerySpec::hostName[MAXKEYNAMELEN+1]

◆ ipHost

uint32 cmlabs::QuerySpec::ipHost

External source: IPv4 host (as uint32), 0 if not used.

Definition at line 133 of file Subscriptions.h.

Referenced by fromXML(), cmlabs::PsyAPI::queryCatalog(), cmlabs::PsyAPI::queryCatalog(), and toXML().

◆ ipPort

uint16 cmlabs::QuerySpec::ipPort

External source: TCP/UDP port, 0 if not used.

Definition at line 134 of file Subscriptions.h.

Referenced by fromXML(), cmlabs::PsyAPI::queryCatalog(), cmlabs::PsyAPI::queryCatalog(), and toXML().

◆ key

◆ maxage

uint64 cmlabs::QuerySpec::maxage

Maximum age of results in MICROSECONDS (XML gives ms; parser multiplies by 1000).

Definition at line 129 of file Subscriptions.h.

Referenced by fromXML(), and toXML().

◆ maxcount

uint32 cmlabs::QuerySpec::maxcount

Maximum number of results to return (0 = unlimited).

Definition at line 130 of file Subscriptions.h.

Referenced by fromXML(), and toXML().

◆ name

char cmlabs::QuerySpec::name[MAXKEYNAMELEN+1]

◆ operation

◆ origin

uint32 cmlabs::QuerySpec::origin

Restrict to data originating from this component id (0 = any).

Definition at line 128 of file Subscriptions.h.

Referenced by fromXML(), and toXML().

◆ source

uint32 cmlabs::QuerySpec::source

Component id of the source to query.

Definition at line 127 of file Subscriptions.h.

Referenced by fromXML(), cmlabs::PsyAPI::queryCatalog(), cmlabs::PsyAPI::queryCatalog(), and toXML().

◆ sourceName

char cmlabs::QuerySpec::sourceName[MAXKEYNAMELEN+1]

◆ subdir

◆ type

◆ value


The documentation for this struct was generated from the following file: