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

A complete trigger definition: what fires a component's crank and what happens then. More...

#include <Subscriptions.h>

Collaboration diagram for cmlabs::TriggerSpec:
[legend]

Public Member Functions

bool reset (uint32 s=0)
 Zero the header and stamp size/cid.
FilterSpecgetFilterSpec (uint32 n)
RetrieveSpecgetRetrieveSpec (uint32 n)
RetrieveSpecgetRetrieveSpec (const char *name)
QuerySpecgetQuerySpec (uint32 n)
QuerySpecgetQuerySpec (const char *name)
std::list< PostSpec * > * getPostSpecs (const char *name)
std::list< PostSpec * > * getPostSpecs (PsyType type)
PostSpecgetPostSpec (const char *name)
PostSpecgetPostSpec (PsyType type)
PostSpecgetPostSpec (uint32 n)
SignalSpecgetSignalSpec (const char *name)
SignalSpecgetSignalSpec (PsyType type)
SignalSpecgetSignalSpec (uint32 n)
std::string toXML ()
 Serialise the whole trigger (with all attached specs) as XML.

Static Public Member Functions

static bool UnitTest ()
 Run the built-in self test.

Public Attributes

uint32 size
 Total block size in bytes including all tail specs.
uint32 cid
 Object id, TRIGGERDATA when valid.
uint32 id
 Unique id of this trigger.
uint32 componentID
 Id of the component owning the trigger.
uint32 interval
 Periodic trigger interval in ms (0 = message-triggered only).
uint32 from
 Only messages sent by this component id fire the trigger (0 = any).
uint32 to
 Only messages addressed to this component id fire the trigger (0 = any).
uint32 tag
 Only messages with this tag fire the trigger (0 = any).
uint32 delay
 Delay in ms between trigger match and crank execution.
uint8 grouppolicy
 Policy for distributing triggers within a group of components.
uint32 groupparam
 Parameter for the group policy.
uint16 crankID
 Id of the crank (processing function) to run when fired.
uint32 group
 Group id this trigger belongs to.
PsyType type
 Message type that fires the trigger (wildcards allowed).
PsyContext context
 Context in which the trigger is active.
PsyContext triggerContext
 Context the triggering message must match.
char name [MAXKEYNAMELEN+1]
 Trigger name.
uint16 filterCount
 Number of FilterSpecs in the tail.
uint16 retrieveCount
 Number of RetrieveSpecs in the tail.
uint16 queryCount
 Number of QuerySpecs in the tail.
uint16 postCount
 Number of PostSpecs in the tail.
uint16 signalCount
 Number of SignalSpecs in the tail.

Detailed Description

A complete trigger definition: what fires a component's crank and what happens then.

TriggerSpec is a variable-length flat binary object: the fixed header below is followed in the SAME allocation by filterCount FilterSpecs, then retrieveCount RetrieveSpecs, then queryCount QuerySpecs, then postCount PostSpecs, then signalCount SignalSpecs (see the get...Spec(n) accessors, which compute offsets into this tail). This layout lets a full trigger definition travel through shared memory as one block.

Warning
Binary contract — do not change field order/sizes, and keep the tail ordering (filters, retrieves, queries, posts, signals) in sync with the accessor offset arithmetic.

Definition at line 447 of file Subscriptions.h.

Member Function Documentation

◆ getFilterSpec()

FilterSpec * cmlabs::TriggerSpec::getFilterSpec ( uint32 n)
inline
Parameters
nfilter index.
Returns
pointer to the n'th FilterSpec in the tail, or NULL if out of range.

Definition at line 458 of file Subscriptions.h.

References filterCount.

◆ getPostSpec() [1/3]

PostSpec * cmlabs::TriggerSpec::getPostSpec ( const char * name)
Parameters
namepost name.
Returns
the first PostSpec with this name, or NULL.

Definition at line 82 of file Subscriptions.cpp.

References filterCount, cmlabs::PostSpec::name, name, postCount, queryCount, retrieveCount, and stricmp.

Referenced by toXML(), and UnitTest().

◆ getPostSpec() [2/3]

PostSpec * cmlabs::TriggerSpec::getPostSpec ( PsyType type)
Parameters
typepost type.
Returns
the first PostSpec with this type, or NULL.

Definition at line 99 of file Subscriptions.cpp.

References filterCount, postCount, queryCount, retrieveCount, cmlabs::PostSpec::type, and type.

◆ getPostSpec() [3/3]

PostSpec * cmlabs::TriggerSpec::getPostSpec ( uint32 n)
inline
Parameters
npost index.
Returns
pointer to the n'th PostSpec in the tail, or NULL if out of range.

Definition at line 489 of file Subscriptions.h.

References filterCount, postCount, queryCount, and retrieveCount.

◆ getPostSpecs() [1/2]

std::list< PostSpec * > * cmlabs::TriggerSpec::getPostSpecs ( const char * name)
Parameters
namepost name.
Returns
new list of matching PostSpecs (caller deletes the list, NOT the specs), or NULL.

Definition at line 46 of file Subscriptions.cpp.

References filterCount, cmlabs::PostSpec::name, name, postCount, queryCount, retrieveCount, and stricmp.

Referenced by UnitTest().

◆ getPostSpecs() [2/2]

std::list< PostSpec * > * cmlabs::TriggerSpec::getPostSpecs ( PsyType type)
Parameters
typepost type.
Returns
new list of matching PostSpecs (caller deletes the list, NOT the specs), or NULL.

Definition at line 63 of file Subscriptions.cpp.

References filterCount, postCount, queryCount, retrieveCount, cmlabs::PostSpec::type, and type.

◆ getQuerySpec() [1/2]

QuerySpec * cmlabs::TriggerSpec::getQuerySpec ( const char * name)
Parameters
namequery name.
Returns
the QuerySpec with this name, or NULL.

Definition at line 29 of file Subscriptions.cpp.

References filterCount, cmlabs::QuerySpec::name, name, queryCount, retrieveCount, and stricmp.

◆ getQuerySpec() [2/2]

QuerySpec * cmlabs::TriggerSpec::getQuerySpec ( uint32 n)
inline
Parameters
nquery index.
Returns
pointer to the n'th QuerySpec in the tail, or NULL if out of range.

Definition at line 472 of file Subscriptions.h.

References filterCount, queryCount, and retrieveCount.

Referenced by toXML(), and UnitTest().

◆ getRetrieveSpec() [1/2]

RetrieveSpec * cmlabs::TriggerSpec::getRetrieveSpec ( const char * name)
Parameters
nameretrieve name.
Returns
the RetrieveSpec with this name, or NULL.

Definition at line 13 of file Subscriptions.cpp.

References filterCount, cmlabs::RetrieveSpec::name, name, retrieveCount, and stricmp.

◆ getRetrieveSpec() [2/2]

RetrieveSpec * cmlabs::TriggerSpec::getRetrieveSpec ( uint32 n)
inline
Parameters
nretrieve index.
Returns
pointer to the n'th RetrieveSpec in the tail, or NULL if out of range.

Definition at line 464 of file Subscriptions.h.

References filterCount, and retrieveCount.

Referenced by toXML(), and UnitTest().

◆ getSignalSpec() [1/3]

SignalSpec * cmlabs::TriggerSpec::getSignalSpec ( const char * name)
Parameters
namesignal name.
Returns
the SignalSpec with this name, or NULL.

Definition at line 119 of file Subscriptions.cpp.

References filterCount, cmlabs::SignalSpec::name, name, postCount, queryCount, retrieveCount, signalCount, and stricmp.

Referenced by toXML(), and UnitTest().

◆ getSignalSpec() [2/3]

SignalSpec * cmlabs::TriggerSpec::getSignalSpec ( PsyType type)
Parameters
typesignal type.
Returns
the SignalSpec with this type, or NULL.

Definition at line 137 of file Subscriptions.cpp.

References filterCount, postCount, queryCount, retrieveCount, signalCount, cmlabs::SignalSpec::type, and type.

◆ getSignalSpec() [3/3]

SignalSpec * cmlabs::TriggerSpec::getSignalSpec ( uint32 n)
inline
Parameters
nsignal index.
Returns
pointer to the n'th SignalSpec in the tail, or NULL if out of range.

Definition at line 501 of file Subscriptions.h.

References filterCount, postCount, queryCount, retrieveCount, and signalCount.

◆ reset()

bool cmlabs::TriggerSpec::reset ( uint32 s = 0)
inline

Zero the header and stamp size/cid.

Parameters
stotal block size to record (0 = just sizeof(TriggerSpec))
Returns
true

Definition at line 451 of file Subscriptions.h.

References cid, size, and TRIGGERDATA.

Referenced by _wrap_TriggerSpec_reset__SWIG_1(), _wrap_TriggerSpec_reset__SWIG_1(), Java_com_cmlabs_cmsdk_cmsdkJNI_TriggerSpec_1reset_1_1SWIG_10(), Java_com_cmlabs_cmsdk_cmsdkJNI_TriggerSpec_1reset_1_1SWIG_11(), and UnitTest().

◆ toXML()

◆ UnitTest()

Member Data Documentation

◆ cid

uint32 cmlabs::TriggerSpec::cid

Object id, TRIGGERDATA when valid.

Definition at line 515 of file Subscriptions.h.

Referenced by reset().

◆ componentID

uint32 cmlabs::TriggerSpec::componentID

Id of the component owning the trigger.

Definition at line 517 of file Subscriptions.h.

Referenced by toXML(), and UnitTest().

◆ context

PsyContext cmlabs::TriggerSpec::context

Context in which the trigger is active.

Definition at line 528 of file Subscriptions.h.

Referenced by toXML().

◆ crankID

uint16 cmlabs::TriggerSpec::crankID

Id of the crank (processing function) to run when fired.

Definition at line 525 of file Subscriptions.h.

◆ delay

uint32 cmlabs::TriggerSpec::delay

Delay in ms between trigger match and crank execution.

Definition at line 522 of file Subscriptions.h.

Referenced by toXML().

◆ filterCount

uint16 cmlabs::TriggerSpec::filterCount

◆ from

uint32 cmlabs::TriggerSpec::from

Only messages sent by this component id fire the trigger (0 = any).

Definition at line 519 of file Subscriptions.h.

Referenced by toXML().

◆ group

uint32 cmlabs::TriggerSpec::group

Group id this trigger belongs to.

Definition at line 526 of file Subscriptions.h.

◆ groupparam

uint32 cmlabs::TriggerSpec::groupparam

Parameter for the group policy.

Definition at line 524 of file Subscriptions.h.

◆ grouppolicy

uint8 cmlabs::TriggerSpec::grouppolicy

Policy for distributing triggers within a group of components.

Definition at line 523 of file Subscriptions.h.

◆ id

uint32 cmlabs::TriggerSpec::id

Unique id of this trigger.

Definition at line 516 of file Subscriptions.h.

Referenced by UnitTest().

◆ interval

uint32 cmlabs::TriggerSpec::interval

Periodic trigger interval in ms (0 = message-triggered only).

Definition at line 518 of file Subscriptions.h.

Referenced by toXML().

◆ name

◆ postCount

uint16 cmlabs::TriggerSpec::postCount

Number of PostSpecs in the tail.

Definition at line 534 of file Subscriptions.h.

Referenced by getPostSpec(), getPostSpec(), getPostSpec(), getPostSpecs(), getPostSpecs(), getSignalSpec(), getSignalSpec(), getSignalSpec(), toXML(), and UnitTest().

◆ queryCount

uint16 cmlabs::TriggerSpec::queryCount

◆ retrieveCount

uint16 cmlabs::TriggerSpec::retrieveCount

◆ signalCount

uint16 cmlabs::TriggerSpec::signalCount

Number of SignalSpecs in the tail.

Definition at line 535 of file Subscriptions.h.

Referenced by getSignalSpec(), getSignalSpec(), getSignalSpec(), toXML(), and UnitTest().

◆ size

uint32 cmlabs::TriggerSpec::size

Total block size in bytes including all tail specs.

Definition at line 514 of file Subscriptions.h.

Referenced by reset().

◆ tag

uint32 cmlabs::TriggerSpec::tag

Only messages with this tag fire the trigger (0 = any).

Definition at line 521 of file Subscriptions.h.

Referenced by toXML().

◆ to

uint32 cmlabs::TriggerSpec::to

Only messages addressed to this component id fire the trigger (0 = any).

Definition at line 520 of file Subscriptions.h.

Referenced by toXML().

◆ triggerContext

PsyContext cmlabs::TriggerSpec::triggerContext

Context the triggering message must match.

Definition at line 529 of file Subscriptions.h.

Referenced by toXML().

◆ type

PsyType cmlabs::TriggerSpec::type

Message type that fires the trigger (wildcards allowed).

Definition at line 527 of file Subscriptions.h.

Referenced by getPostSpec(), getPostSpecs(), getSignalSpec(), toXML(), and UnitTest().


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