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

Hierarchical execution-context identifier. More...

#include <Types.h>

Public Member Functions

bool isValid ()
bool operator== (const PsyContext &othercontext) const
bool operator!= (const PsyContext &othercontext) const
bool operator< (const PsyContext &othercontext) const
bool operator> (const PsyContext &othercontext) const
uint16 operator[] (int i) const
bool setLevel (int i, uint16 value)
bool matches (const PsyContext &othercontext) const
 Wildcard-aware context matching: levels are considered matching when equal, or when either side is 0xFFFF or 0 (both act as wildcards here).
std::string toString ()
std::string toString (std::map< uint16, std::string > *subcontexts)
bool fromString (const char *text)
uint8 compare (const PsyContext &othercontext) const
 Classify the hierarchical relationship between this context and another.

Public Attributes

uint16 levels [PSYCONTEXTLEVELS]
 Hierarchy levels, most significant first; 0 terminates (and wildcards in matches()), 0xFFFF is a wildcard.

Detailed Description

Hierarchical execution-context identifier.

Structurally identical to PsyType (16 uint16 levels, dotted notation, 0xFFFF wildcard) but semantically different: a PsyContext describes the situation/state a system is operating in (e.g. "dialog.greeting"). Components can be active only in certain contexts, and messages can switch the current context via DataMessageHeader::contextchange. Unlike PsyType::matches(), PsyContext::matches() also treats level value 0 as a wildcard, so a more general context matches a more specific one. Use compare() to get the precise relationship (equal / supersedes / included / different root). Use NOCONTEXT for the empty value.

Note
POD embedded in wire structs — size must never change.

Definition at line 284 of file Types.h.

Member Function Documentation

◆ compare()

uint8 PsyContext::compare ( const PsyContext & othercontext) const
inline

Classify the hierarchical relationship between this context and another.

Parameters
othercontextcontext to compare with
Returns
one of CONTEXT_EQUAL, CONTEXT_SUPERSEDES, CONTEXT_INCLUDED, CONTEXT_OTHER_ROOT

Definition at line 414 of file Types.h.

References CONTEXT_EQUAL, CONTEXT_INCLUDED, CONTEXT_OTHER_ROOT, CONTEXT_SUPERSEDES, levels, and PSYCONTEXTLEVELS.

Referenced by _wrap_PsyContext_compare().

◆ fromString()

bool PsyContext::fromString ( const char * text)
inline

Definition at line 374 of file Types.h.

References isValid(), levels, and PSYCONTEXTLEVELS.

◆ isValid()

bool PsyContext::isValid ( )
inline

Definition at line 289 of file Types.h.

References levels.

Referenced by _wrap_PsyContext_isValid(), fromString(), and cmlabs::PsyAPI::postOutputMessage().

◆ matches()

bool PsyContext::matches ( const PsyContext & othercontext) const
inline

Wildcard-aware context matching: levels are considered matching when equal, or when either side is 0xFFFF or 0 (both act as wildcards here).

Parameters
othercontextthe context to compare against
Returns
true if the contexts match

Definition at line 329 of file Types.h.

References levels, and PSYCONTEXTLEVELS.

Referenced by _wrap_PsyContext_matches().

◆ operator!=()

bool PsyContext::operator!= ( const PsyContext & othercontext) const
inline

Definition at line 293 of file Types.h.

References levels.

◆ operator<()

bool PsyContext::operator< ( const PsyContext & othercontext) const
inline

Definition at line 296 of file Types.h.

References levels, and PSYCONTEXTLEVELS.

◆ operator==()

bool PsyContext::operator== ( const PsyContext & othercontext) const
inline

Definition at line 290 of file Types.h.

References levels.

◆ operator>()

bool PsyContext::operator> ( const PsyContext & othercontext) const
inline

Definition at line 305 of file Types.h.

References levels, and PSYCONTEXTLEVELS.

◆ operator[]()

uint16 PsyContext::operator[] ( int i) const
inline

Definition at line 314 of file Types.h.

References levels, and PSYCONTEXTLEVELS.

◆ setLevel()

bool PsyContext::setLevel ( int i,
uint16 value )
inline

Definition at line 319 of file Types.h.

References levels, and PSYCONTEXTLEVELS.

◆ toString() [1/2]

std::string PsyContext::toString ( )
inline

Definition at line 341 of file Types.h.

References levels, and PSYCONTEXTLEVELS.

Referenced by toString().

◆ toString() [2/2]

std::string PsyContext::toString ( std::map< uint16, std::string > * subcontexts)
inline

Definition at line 352 of file Types.h.

References levels, PSYTYPELEVELS, and toString().

Member Data Documentation

◆ levels

uint16 PsyContext::levels[PSYCONTEXTLEVELS]

Hierarchy levels, most significant first; 0 terminates (and wildcards in matches()), 0xFFFF is a wildcard.

Definition at line 285 of file Types.h.

Referenced by _wrap_PsyContext_levels_set(), compare(), fromString(), isValid(), matches(), operator!=(), operator<(), operator==(), operator>(), operator[](), setLevel(), toString(), and toString().


The documentation for this struct was generated from the following file:
  • /home/ubuntu/c/partner/psyclone2/CMSDK/include/Types.h