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

The central Psyclone data container: a self-contained binary message with typed, named user entries. More...

#include <DataMessage.h>

Collaboration diagram for cmlabs::DataMessage:
[legend]

Public Types

enum  KeyType { NONE , SINGLE , ARRAY , MAP }

Public Member Functions

 DataMessage ()
 DataMessage() Creates an empty DataMessage.
 DataMessage (PsyType type, uint32 from)
 DataMessage(PsyType type, uint32 from) Creates a DataMessage with type and from fields set.
 DataMessage (PsyType type, uint32 from, uint32 to, uint64 ttl=0, uint16 priority=0)
 DataMessage(PsyType type, uint32 from, uint32 to, uint64 ttl = 0, uint16 priority = 0) Creates a DataMessage with multiple fields set.
 DataMessage (PsyType type, uint32 from, uint32 to, uint32 tag, uint64 time, uint64 ttl=0, uint16 priority=0)
 DataMessage(PsyType type, uint32 from, uint32 to, uint32 tag, uint64 time, uint64 ttl = 0, uint16 priority = 0) Creates a DataMessage with multiple fields set.
 DataMessage (char *data, bool copy=false)
 DataMessage(char* data, bool copy = false) Creates a DataMessage as a copy of the binary message data provided.
 DataMessage (const char *data)
 DataMessage(const char* data).
 DataMessage (const DataMessage &msg)
 DataMessage(const DataMessage& msg).
 DataMessage (const char *data, uint32 maxDraftSize)
 DataMessage(const char* data, uint32 maxDraftSize) Creates a DataMessage as a copy of the binary message data provided, will always copy the data If the binary size is below maxDraftSize the full message is copied If not some larger user entries will be provided as information only, i.e.
 DataMessage (const DataMessage &msg, uint32 maxDraftSize)
 DataMessage(const DataMessage& msg, uint32 maxDraftSize) Creates a DataMessage as a copy of the message provided If the binary size is below maxDraftSize the full message is copied If not some larger user entries will be provided as information only, i.e.
 ~DataMessage ()
 ~DataMessage() Message destructor
DataMessagecopy ()
 copy() Creates a full deep copy of the message and returns it.
const char * swapMessageData (const char *data)
 swapMessageData(const char* data)
bool fillInDraftUserDataFrom (const char *data, uint32 maxDraftSize)
 fillInDraftUserDataFrom(const char* data, uint32 maxDraftSize)
bool isValid ()
 isValid() Checks that the message memory block exists and carries the current-format object id (DATAMESSAGEID).
uint32 getContentType (const char *key)
 getContentType(const char* key)
uint32 getContentSize (const char *key)
 getContentSize(const char* key)
bool getAsBool (const char *key)
 getAsBool(const char* key)
std::string getAsString (const char *key)
 getAsString(const char* key)
int64 getAsInt (const char *key)
 getAsInt(const char* key)
uint64 getAsTime (const char *key)
 getAsTime(const char* key)
float64 getAsFloat (const char *key)
 getAsFloat(const char* key)
uint64 getTime (const char *key)
 getTime(const char* key)
const char * getString (const char *key)
 getString(const char* key)
const char * getString (const char *key, uint32 &size)
 getString(const char* key, uint32 &size)
bool getInt (const char *key, int64 &value)
 getInt(const char* key, int64& value)
bool getDouble (const char *key, double &value)
 getDouble(const char* key, double& value)
bool getFloat (const char *key, float64 &value)
 getFloat(const char* key, float64& value)
const char * getData (const char *key, uint32 &size)
 getData(const char* key, uint32& size)
char * getDataCopy (const char *key, uint32 &size)
 getDataCopy(const char* key, uint32& size)
DataMessagegetAttachedMessageCopy (const char *key)
 getAttachedMessageCopy(const char* key)
uint64 getTime (const char *key, bool &success)
 getTime(const char* key, bool& success)
const char * getString (const char *key, bool &success)
 getString(const char* key)
const char * getString (const char *key, uint32 &size, bool &success)
 getString(const char* key, uint32 &size)
int64 getInt (const char *key, bool &success)
 getInt(const char* key, int64& value)
double getDouble (const char *key, bool &success)
 getDouble(const char* key, double& value)
float64 getFloat (const char *key, bool &success)
 getFloat(const char* key, float64& value)
const char * getData (const char *key, uint32 &size, bool &success)
 getData(const char* key, uint32& size)
char * getDataCopy (const char *key, uint32 &size, bool &success)
 getDataCopy(const char* key, uint32& size)
DataMessagegetAttachedMessageCopy (const char *key, bool &success)
 getAttachedMessageCopy(const char* key)
int64 getInt (const char *key)
 getInt(const char* key)
double getDouble (const char *key)
 getDouble(const char* key)
float64 getFloat (const char *key)
 getFloat(const char* key)
bool setTime (const char *key, uint64 value)
 setTime(const char* key, uint64 value)
bool setString (const char *key, const char *value)
 setString(const char* key, const char* value)
bool setInt (const char *key, int64 value)
 setInt(const char* key, int64 value)
bool setDouble (const char *key, double value)
 setDouble(const char* key, double value)
bool setFloat (const char *key, float64 value)
 setFloat(const char* key, float64 value)
bool setData (const char *key, const char *value, uint32 size)
 setData(const char* key, const char* value, uint32 size)
bool setAttachedMessage (const char *key, DataMessage *msg)
 setAttachedMessage(const char* key, DataMessage* msg)
uint32 getUserSize ()
 getUserSize()
uint32 getUserCount ()
 getUserCount()
KeyType getKeyType (const char *key)
 getKeyType(const char* key)
bool isArrayContent (const char *key)
 isArrayContent(const char* key)
bool isMapContent (const char *key)
 isMapContent(const char* key)
bool isSingleValue (const char *key)
 isSingleValue(const char* key)
bool hasKey (const char *key)
 Check if key variable exists.
bool hasString (const char *key)
 Check if key variable exists and is a string.
bool hasInteger (const char *key)
 Check if key variable exists and is an integer.
bool hasFloat (const char *key)
 Check if key variable exists and is a float.
bool hasTime (const char *key)
 Check if key variable exists and is a time.
bool hasData (const char *key)
 Check if key variable exists and is a data entry.
bool hasMessage (const char *key)
 Check if key variable exists and is a message.
uint32 getContentType (int64 i, const char *key)
 getContentType(int64 i, const char* key)
uint32 getContentSize (int64 i, const char *key)
 getContentSize(int64 i, const char* key)
uint64 getTime (int64 i, const char *key)
 getTime(int64 i, const char* key)
std::string getAsString (int64 i, const char *key)
 getAsString(int64 i, const char* key)
int64 getAsInt (int64 i, const char *key)
 getAsInt(int64 i, const char* key)
uint64 getAsTime (int64 i, const char *key)
 getAsTime(int64 i, const char* key)
float64 getAsFloat (int64 i, const char *key)
 getAsFloat(int64 i, const char* key)
const char * getString (int64 i, const char *key)
 getString(int64 i, const char* key)
const char * getString (int64 i, const char *key, uint32 &size)
 getString(int64 i, const char* key, uint32 &size)
bool getInt (int64 i, const char *key, int64 &value)
 getInt(int64 i, const char* key, int64& value)
bool getDouble (int64 i, const char *key, double &value)
 getDouble(int64 i, const char* key, double& value)
bool getFloat (int64 i, const char *key, float64 &value)
 getFloat(int64 i, const char* key, float64& value)
int64 getInt (int64 i, const char *key, bool &success)
 getInt(int64 i, const char* key, bool& success)
double getDouble (int64 i, const char *key, bool &success)
 getDouble(int64 i, const char* key, bool& success)
float64 getFloat (int64 i, const char *key, bool &success)
 getFloat(int64 i, const char* key, bool& success)
int64 getInt (int64 i, const char *key)
 getInt(int64 i, const char* key)
double getDouble (int64 i, const char *key)
 getDouble(int64 i, const char* key)
float64 getFloat (int64 i, const char *key)
 getFloat(int64 i, const char* key)
const char * getData (int64 i, const char *key, uint32 &size)
 getData(int64 i, const char* key, uint32& size)
char * getDataCopy (int64 i, const char *key, uint32 &size)
 getDataCopy(int64 i, const char* key, uint32& size)
DataMessagegetAttachedMessageCopy (int64 i, const char *key)
 getAttachedMessageCopy(int64 i, const char* key)
bool setTime (int64 i, const char *key, uint64 value)
 setTime(int64 i, const char* key, uint64 value)
bool setString (int64 i, const char *key, const char *value)
 setString(int64 i, const char* key, const char* value)
bool setInt (int64 i, const char *key, int64 value)
 setInt(int64 i, const char* key, int64 value)
bool setDouble (int64 i, const char *key, double value)
 setDouble(int64 i, const char* key, double value)
bool setFloat (int64 i, const char *key, float64 value)
 setFloat(int64 i, const char* key, float64 value)
bool setData (int64 i, const char *key, const char *value, uint32 size)
 setData(int64 i, const char* key, const char* value, uint32 size)
bool setAttachedMessage (int64 i, const char *key, DataMessage *msg)
 setAttachedMessage(int64 i, const char* key, DataMessage* msg)
std::map< int64, uint64 > getTimeArray (const char *key)
std::map< int64, std::string > getAsStringArray (const char *key)
 getAsStringArray(const char* key)
std::map< int64, int64 > getAsIntArray (const char *key)
 getAsIntArray(const char* key)
std::map< int64, float64 > getAsFloatArray (const char *key)
 getAsFloatArray(const char* key)
std::map< int64, std::string > getStringArray (const char *key)
 getStringArray(const char* key)
std::map< int64, int64 > getIntArray (const char *key)
 getIntArray(const char* key)
std::map< int64, double > getDoubleArray (const char *key)
 getDoubleArray(const char* key)
std::map< int64, float64 > getFloatArray (const char *key)
 getFloatArray(const char* key)
std::map< int64, DataMessage * > getAttachedMessageArray (const char *key)
 getAttachedMessageArray(const char* key)
uint32 getArraySize (const char *key)
 getArraySize(const char* key) Returns the number of elements in array with name '<key>'
uint32 getArrayCount (const char *key)
 getArrayCount(const char* key) Returns the number of elements in array with name '<key>'
uint32 getMapSize (const char *key)
 getMapSize(const char* key) Returns the number of elements in map with name '<key>'
uint32 getMapCount (const char *key)
 getMapCount(const char* key) Returns the number of elements in map with name '<key>'
bool setTimeArray (const char *key, std::map< int64, uint64 > &map)
 setTimeArray(const char* key, std::map<int64, uint64>& map) Sets the whole time array named key in one call.
bool setStringArray (const char *key, std::map< int64, std::string > &map)
 setStringArray(const char* key, std::map<int64, std::string>& map) Sets the whole string array named key in one call.
bool setIntArray (const char *key, std::map< int64, int64 > &map)
 setIntArray(const char* key, std::map<int64, int64>& map) Sets the whole integer array named key in one call.
bool setDoubleArray (const char *key, std::map< int64, double > &map)
 setDoubleArray(const char* key, std::map<int64, double>& map) Sets the whole double array named key in one call.
bool setFloatArray (const char *key, std::map< int64, float64 > &map)
 setFloatArray(const char* key, std::map<int64, float64>& map) Sets the whole float array named key in one call.
bool setAttachedMessageArray (const char *key, std::map< int64, DataMessage * > &map)
 setAttachedMessageArray(const char* key, std::map<int64, DataMessage*>& map) Sets the whole array of attached messages named key in one call.
uint32 getContentType (const char *idx, const char *key)
 returns the type of content with this key as CONSTCHARID, TIMEID, CHARDATAID, INTID, DOUBLEID, etc
uint32 getContentSize (const char *idx, const char *key)
 returns the binary size of the content with this key
uint64 getTime (const char *idx, const char *key)
 returns the user time entry with this key
std::string getAsString (const char *idx, const char *key)
 returns the user entry as a string regardless of what type it is
int64 getAsInt (const char *idx, const char *key)
 returns the user entry as an integer regardless of what type it is
uint64 getAsTime (const char *idx, const char *key)
 returns the user entry as a time regardless of what type it is
float64 getAsFloat (const char *idx, const char *key)
 returns the user entry as a float regardless of what type it is
const char * getString (const char *idx, const char *key)
 returns the user string entry with this key
const char * getString (const char *idx, const char *key, uint32 &size)
 returns the user string entry with this key
bool getInt (const char *idx, const char *key, int64 &value)
 returns the user integer entry with this key
bool getDouble (const char *idx, const char *key, double &value)
 returns the user float entry with this key
bool getFloat (const char *idx, const char *key, float64 &value)
 returns the user float entry with this key
int64 getInt (const char *idx, const char *key, bool &success)
 returns the user integer entry with this key
double getDouble (const char *idx, const char *key, bool &success)
 returns the user double entry with this key
float64 getFloat (const char *idx, const char *key, bool &success)
 returns the user float entry with this key
int64 getInt (const char *idx, const char *key)
 returns the user integer entry with this key
double getDouble (const char *idx, const char *key)
 returns the user double entry with this key
float64 getFloat (const char *idx, const char *key)
 returns the user float entry with this key
const char * getData (const char *idx, const char *key, uint32 &size)
 returns the user binary data entry with this key + the size
char * getDataCopy (const char *idx, const char *key, uint32 &size)
 returns a copy of the user binary data entry with this key + the size
DataMessagegetAttachedMessageCopy (const char *idx, const char *key)
 returns a copy of the user message entry with this key
bool setTime (const char *idx, const char *key, uint64 value)
 sets the user time entry with this key to the value provided
bool setString (const char *idx, const char *key, const char *value)
 sets the user string entry with this key to the value provided
bool setInt (const char *idx, const char *key, int64 value)
 sets the user integer entry with this key to the value provided
bool setDouble (const char *idx, const char *key, double value)
 sets the user double entry with this key to the value provided
bool setFloat (const char *idx, const char *key, float64 value)
 sets the user float entry with this key to the value provided
bool setData (const char *idx, const char *key, const char *value, uint32 size)
 sets the user binary data entry with this key + the size
bool setAttachedMessage (const char *idx, const char *key, DataMessage *msg)
 sets the user message entry with this key to the provided message
std::map< std::string, uint64 > getTimeMap (const char *key)
 returns the user time entry with this key
std::map< std::string, std::string > getAsStringMap (const char *key)
 returns the user entry as a string regardless of what type it is
std::map< std::string, int64 > getAsIntMap (const char *key)
 returns the user entry as an integer map regardless of what type it is
std::map< std::string, float64 > getAsFloatMap (const char *key)
 returns the user entry as a float map regardless of what type it is
std::map< std::string, std::string > getStringMap (const char *key)
 returns the user string entry with this key
std::map< std::string, int64 > getIntMap (const char *key)
 returns the user integer entry with this key
std::map< std::string, double > getDoubleMap (const char *key)
 returns the user double entry with this key
std::map< std::string, float64 > getFloatMap (const char *key)
 returns the user float entry with this key
std::map< std::string, DataMessage * > getAttachedMessageMap (const char *key)
 returns a copy of the user message entry with this key
bool setTimeMap (const char *key, std::map< std::string, uint64 > &map)
 sets the user time entry with this key
bool setStringMap (const char *key, std::map< std::string, std::string > &map)
 sets the user string entry with this key
bool setIntMap (const char *key, std::map< std::string, int64 > &map)
 sets the user integer entry with this key
bool setDoubleMap (const char *key, std::map< std::string, double > &map)
 sets the user double entry with this key to the value provided
bool setFloatMap (const char *key, std::map< std::string, float64 > &map)
 sets the user float entry with this key to the value provided
bool setAttachedMessageMap (const char *key, std::map< std::string, DataMessage * > &map)
 sets the user message entry with this key to the provided message
std::string toJSON (std::map< uint16, std::string > *subtypes=NULL, std::map< uint16, std::string > *subcontexts=NULL, std::map< uint32, std::string > *compNames=NULL)
 toJSON()
std::string toXML (std::map< uint16, std::string > *subtypes=NULL, std::map< uint16, std::string > *subcontexts=NULL, std::map< uint32, std::string > *compNames=NULL)
 toXML()
std::string toCSV (const char *separator=NULL, const char *preample=NULL, std::map< uint16, std::string > *subtypes=NULL, std::map< uint16, std::string > *subcontexts=NULL, std::map< uint32, std::string > *compNames=NULL)
 toCSV()
uint32 copyUserEntriesFromMessage (DataMessage *msg)
 copyUserEntriesFromMessage(DataMessage* msg) Copies all user data from a message into this message, overwriting any existing entries with the same key
std::string getUserEntriesAsString ()
 getUserEntriesAsString() Returns the textual representation of the full message including all user entries, arrays and maps - and including the textual representation of any attached messages
std::string getUserEntriesAsJSON (bool asText)
 getUserEntriesAsJSON(bool asText) Returns the JSON representation of the full message including all user entries, arrays and maps - and including the textual representation of any attached messages
char * getRawData ()
 getRawData() Retrieve a pointer to the raw binary block of the message (header + entries).
uint16 getOrigin ()
 getOrigin() Get the NodeID of the node the message originated on
uint16 getDestination ()
 getDestination() Get the NodeID of the destination node
bool setOrigin (uint16 addr)
 setOrigin(uint16 addr) Set origin to address addr and return new origin
bool setDestination (uint16 addr)
 setDestination(uint16 addr) Set destination to address addr and return new destination
uint32 getSize ()
 getSize() Get message size Many types of data of any size can be put into a message as user entries; the data will be kept in a single block of memory for efficiency
bool setMultiple (uint32 from, uint32 to, uint32 tag, uint64 ttl, uint8 policy, uint64 sendtime)
 setMultiple(uint32 from, uint32 to, uint32 tag, uint64 ttl, uint8 policy, uint64 sendtime) Set multiple information for a message at the same time
uint32 getTag ()
 getTag() Retrieve and return message tag id Tags can be used to segment data temporally, i.e.
bool setTag (uint32 tag)
 setTag(uint32 tag)
uint64 getReference ()
 getReference() Get and return message reference id
bool setReference (uint64 ref)
 setReference(uint64 ref) Set message reference
uint32 getSystemID ()
 getSystemID() Get and return message system id
bool setSystemID (uint32 id)
 setSystemID(uint32 id) Set message system id
uint64 getMemID ()
 getMemID() Get and return memory ID
bool setMemID (uint64 id)
 setMemID(uint64 id) Set memory ID to id
uint32 getFrom ()
 getFrom() Get the sender id
bool setFrom (uint32 from)
 setFrom(uint32 from)
uint32 getTo ()
 getTo()
bool setTo (uint32 to)
 setTo(uint32 to)
PsyType getType ()
 getType()
bool setType (PsyType &type)
 setType(PsyType &type)
PsyContext getContextChange ()
 getContextChange()
bool setContextChange (PsyContext &context)
 setContextChange(PsyContext& context)
uint64 getTTL ()
 getTTL()
uint64 getEOL ()
 getEOL()
bool setTTL (uint64 ttl)
 setTTL(uint64 ttl)
bool setEOL (uint64 eol)
 setEOL(uint64 eol)
uint16 getPriority ()
 getPriority()
bool setPriority (uint16 priority)
 setPriority(uint16 priority)
uint8 getPolicy ()
 getPolicy()
bool setPolicy (uint8 policy)
 setPolicy(uint8 policy)
uint64 getSendTime ()
 getSendTime()
bool setSendTime (uint64 time)
 setSendTime(uint64 time)
uint64 getRecvTime ()
 getRecvTime()
bool setRecvTime (uint64 time)
 setRecvTime(uint64 time)
uint64 getCreatedTime ()
 getCreatedTime()
bool setCreatedTime (uint64 t)
 setCreatedTime(uint64 t)
uint16 getStatus ()
 getStatus()
bool setStatus (uint16 status)
 setStatus(uint16 status)
uint64 getSerial ()
 getSerial()
bool setSerial (uint64 serial)
 setSerial(uint64 serial)
bool addTimeUsage (uint32 cycleCPUTime, uint32 cycleWallTime, uint32 chainCPUTime=0, uint32 chainWallTime=0, uint32 chainCount=0)
 addTimeUsage()
uint16 getCycleCPUTime ()
 getCycleCPUTime()
bool setCycleCPUTime (uint32 t)
 setCycleCPUTime(uint32 t)
uint16 getCycleWallTime ()
 getCycleWallTime()
bool setCycleWallTime (uint32 t)
 setCycleWallTime(uint32 t)
uint16 getChainCPUTime ()
 getChainCPUTime()
bool setChainCPUTime (uint32 t)
 setChainCPUTime(uint32 t)
uint16 getChainWallTime ()
 getChainWallTime()
bool setChainWallTime (uint32 t)
 setChainWallTime(uint32 t)
uint32 getChainCount ()
 getChainCount()
bool setChainCount (uint32 count)
 setChainCount(uint32 count)
bool deleteEntry (const char *key)
 deleteEntry(const char* key)
void invalidateFindKeyCache ()
 Internal: clears the single-entry key-lookup cache.

Static Public Member Functions

static DataMessageFindClosestMessage (uint64 t, std::map< uint64, DataMessage * > &messages)
 FindClosestMessage(uint64 t, std::map<uint64, DataMessage*> &messages) In a map of time -> DataMessage, find the message closes to the time t.
static bool ConvertDataFromOlderMessageFormat (const char *data, char **newData)
 Convert a binary block in the legacy (pre-version-10, DATAMESSAGEOLDID) format to the current DataMessageHeader layout.
static bool UnitTest ()
 Run the built-in self test for the DataMessage implementation.
static std::string GetCSVHeader (const char *separator=NULL, const char *preample=NULL)
 toCSVHeader()

Public Attributes

DataMessageHeaderdata
 Pointer to the message's flat memory block (header + user entries).
std::string _lastFindKey
 Internal: last key looked up (single-entry lookup cache; mutable so const-style getters can update it).
char * _lastFindKeyResult = NULL
 Internal: cached location of the last key's entry inside the block; NULL if not found.

Protected Member Functions

bool setRawData (const char *key, const char *value, uint32 size, uint32 datatype)
 Internal: low-level entry writer used by all typed set...() overloads.
char * findKey (const char *key)
 findKey(const char* key) Internal function: linear scan of the entry list for an entry whose key matches key (case-insensitive), with a one-slot cache of the last lookup to make repeated access to the same key O(1).
char * findEntry (const char *key)
 findEntry(const char* key)
bool removeEntry (const char *key)
 removeEntry(const char* key)
char * findSpace (uint32 space)
 findSpace(uint32 space)

Detailed Description

The central Psyclone data container: a self-contained binary message with typed, named user entries.

DataMessage is how components exchange data in Psyclone. Conceptually it is a routed envelope (type, from/to, tag, timestamps, TTL, priority, context) plus an ordered set of named user entries. Entries can be single values (string, integer, float, time, raw data, attached DataMessage), arrays (indexed by int64) or maps (indexed by string), all accessed through typed get/set overloads keyed by name.

The entire message lives in one flat memory block (pointed to by data), so it can be moved between processes via shared memory or over the network with a single copy — there is no separate serialisation format.

Typical use:

DataMessage* msg = new DataMessage(myType, myComponentID);
msg->setString("name", "camera1");
msg->setInt("width", 640);
msg->setData("pixels", pixelBuffer, bufferSize);
// ... post via the API; the receiver then reads:
int64 w = msg->getInt("width");
uint32 size; const char* pixels = msg->getData("pixels", size);
DataMessage()
DataMessage() Creates an empty DataMessage.
bool setString(const char *key, const char *value)
setString(const char* key, const char* value)
bool getInt(const char *key, int64 &value)
getInt(const char* key, int64& value)
bool setInt(const char *key, int64 value)
setInt(const char* key, int64 value)
const char * getData(const char *key, uint32 &size)
getData(const char* key, uint32& size)
bool setData(const char *key, const char *value, uint32 size)
setData(const char* key, const char* value, uint32 size)

Ownership and lifetime rules:

  • Pointers returned by getString()/getData() point INTO the message's own memory: they are valid only while the message exists and no entry is added/changed (which may reallocate the block). Do not free them.
  • getDataCopy()/getAttachedMessageCopy() and copy() return heap allocations the CALLER must delete (delete[] for data copies, delete for messages).
  • set...() calls copy the supplied values into the message; the caller keeps ownership of its own buffers (including the DataMessage passed to setAttachedMessage()).
Warning
DataMessage is not thread-safe: concurrent set...() calls, or a get...() concurrent with a set...(), must be externally synchronised. The internal find-key cache also makes lookups stateful (mutable members).

Definition at line 278 of file DataMessage.h.

Member Enumeration Documentation

◆ KeyType

Enumerator
NONE 
SINGLE 
ARRAY 
MAP 

Definition at line 812 of file DataMessage.h.

Constructor & Destructor Documentation

◆ DataMessage() [1/9]

◆ DataMessage() [2/9]

cmlabs::DataMessage::DataMessage ( PsyType type,
uint32 from )

DataMessage(PsyType type, uint32 from) Creates a DataMessage with type and from fields set.

Parameters
typeset the message type
fromset the message sender id

Definition at line 1105 of file DataMessage.cpp.

References CURRENTDATAMESSAGEVERSION, data, DATAMESSAGEID, cmlabs::GetTimeNow(), and invalidateFindKeyCache().

◆ DataMessage() [3/9]

cmlabs::DataMessage::DataMessage ( PsyType type,
uint32 from,
uint32 to,
uint64 ttl = 0,
uint16 priority = 0 )

DataMessage(PsyType type, uint32 from, uint32 to, uint64 ttl = 0, uint16 priority = 0) Creates a DataMessage with multiple fields set.

Parameters
typeset the message type
fromset the message sender id
toset the message receiver id
ttlset the time-to-live for the message in microseconds, after which it will have reached its end-of-life (eol)
priorityset the message priority

Definition at line 1117 of file DataMessage.cpp.

References CURRENTDATAMESSAGEVERSION, data, DATAMESSAGEID, cmlabs::GetTimeNow(), and invalidateFindKeyCache().

◆ DataMessage() [4/9]

cmlabs::DataMessage::DataMessage ( PsyType type,
uint32 from,
uint32 to,
uint32 tag,
uint64 time,
uint64 ttl = 0,
uint16 priority = 0 )

DataMessage(PsyType type, uint32 from, uint32 to, uint32 tag, uint64 time, uint64 ttl = 0, uint16 priority = 0) Creates a DataMessage with multiple fields set.

Parameters
typeset the message type
fromset the message sender id
toset the message receiver id
tagset the message tag id
timeset the message creation time in microseconds
ttlset the time-to-live for the message in microseconds, after which it will have reached its end-of-life (eol)
priorityset the message priority

Definition at line 1132 of file DataMessage.cpp.

References CURRENTDATAMESSAGEVERSION, data, DATAMESSAGEID, cmlabs::GetTimeNow(), and invalidateFindKeyCache().

◆ DataMessage() [5/9]

cmlabs::DataMessage::DataMessage ( char * data,
bool copy = false )

DataMessage(char* data, bool copy = false) Creates a DataMessage as a copy of the binary message data provided.

Parameters
datathe binary message data to copy from
copyshould the data be copied or can it be taken

Definition at line 1161 of file DataMessage.cpp.

References ConvertDataFromOlderMessageFormat(), copy(), CURRENTDATAMESSAGEVERSION, data, DATAMESSAGEID, DATAMESSAGEOLDID, GetObjID, invalidateFindKeyCache(), and MAXVALUINT32.

◆ DataMessage() [6/9]

cmlabs::DataMessage::DataMessage ( const char * data)

DataMessage(const char* data).

Parameters
datathe binary message data to copy from Creates a DataMessage as a copy of the binary message data provided, will always copy the data

Definition at line 1216 of file DataMessage.cpp.

References ConvertDataFromOlderMessageFormat(), CURRENTDATAMESSAGEVERSION, data, DATAMESSAGEID, DATAMESSAGEOLDID, GetObjID, invalidateFindKeyCache(), and MAXVALUINT32.

◆ DataMessage() [7/9]

cmlabs::DataMessage::DataMessage ( const DataMessage & msg)

DataMessage(const DataMessage& msg).

Parameters
msgthe message to copy from Creates a DataMessage as a copy of another DataMessage

Definition at line 1262 of file DataMessage.cpp.

References CURRENTDATAMESSAGEVERSION, data, DataMessage(), DATAMESSAGEID, GetObjID, invalidateFindKeyCache(), and cmlabs::DataMessageHeader::size.

◆ DataMessage() [8/9]

cmlabs::DataMessage::DataMessage ( const char * data,
uint32 maxDraftSize )

DataMessage(const char* data, uint32 maxDraftSize) Creates a DataMessage as a copy of the binary message data provided, will always copy the data If the binary size is below maxDraftSize the full message is copied If not some larger user entries will be provided as information only, i.e.

name and size, but not content

Parameters
datathe binary message data to copy from
maxDraftSizethe maximum binary size of the newly created message

Definition at line 1283 of file DataMessage.cpp.

References CURRENTDATAMESSAGEVERSION, data, DataMessage(), DATAMESSAGEID, DATAMESSAGEOLDID, fillInDraftUserDataFrom(), GetObjID, and invalidateFindKeyCache().

◆ DataMessage() [9/9]

cmlabs::DataMessage::DataMessage ( const DataMessage & msg,
uint32 maxDraftSize )

DataMessage(const DataMessage& msg, uint32 maxDraftSize) Creates a DataMessage as a copy of the message provided If the binary size is below maxDraftSize the full message is copied If not some larger user entries will be provided as information only, i.e.

name and size, but not content

Parameters
msgthe message to copy from
maxDraftSizethe maximum binary size of the newly created message

Definition at line 1326 of file DataMessage.cpp.

References CURRENTDATAMESSAGEVERSION, data, DataMessage(), DATAMESSAGEID, fillInDraftUserDataFrom(), GetObjID, and invalidateFindKeyCache().

◆ ~DataMessage()

cmlabs::DataMessage::~DataMessage ( )

~DataMessage() Message destructor

Definition at line 1539 of file DataMessage.cpp.

References data.

Member Function Documentation

◆ addTimeUsage()

bool cmlabs::DataMessage::addTimeUsage ( uint32 cycleCPUTime,
uint32 cycleWallTime,
uint32 chainCPUTime = 0,
uint32 chainWallTime = 0,
uint32 chainCount = 0 )

addTimeUsage()

Update the CPU and Wall time usage since trigger message arrived and add up the chain usage

Parameters
cycleCPUTimecycle CPU time in us
cycleWallTimecycle wall time in us
chainCPUTimechain CPU time in us
chainWallTimechain wall time in us
chainCountnumber of chain entries to add
Returns
false if the message is not valid
true otherwise

Definition at line 3138 of file DataMessage.cpp.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1addTimeUsage_1_1SWIG_10(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1addTimeUsage_1_1SWIG_11(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1addTimeUsage_1_1SWIG_12(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1addTimeUsage_1_1SWIG_13(), and cmlabs::PsyAPI::postOutputMessage().

◆ ConvertDataFromOlderMessageFormat()

bool cmlabs::DataMessage::ConvertDataFromOlderMessageFormat ( const char * data,
char ** newData )
static

Convert a binary block in the legacy (pre-version-10, DATAMESSAGEOLDID) format to the current DataMessageHeader layout.

Parameters
datalegacy binary message block (not modified)
newDatareceives a newly allocated block in the current format; caller takes ownership (delete[])
Returns
true if the block was recognised and converted successfully

Definition at line 3151 of file DataMessage.cpp.

References cmlabs::DataMessageHeader::cid, cmlabs::DataMessageHeader_Old::contextchange, CURRENTDATAMESSAGEVERSION, cmlabs::DataMessageHeader::cver, data, DATAMESSAGEID, DATAMESSAGEOLDID, cmlabs::DataMessageHeader_Old::destination, cmlabs::DataMessageHeader_Old::from, LogPrint, cmlabs::DataMessageHeader_Old::memid, cmlabs::DataMessageHeader_Old::origin, cmlabs::DataMessageHeader_Old::policy, cmlabs::DataMessageHeader_Old::priority, cmlabs::DataMessageHeader_Old::recvtime, cmlabs::DataMessageHeader_Old::reference, cmlabs::DataMessageHeader_Old::sendtime, cmlabs::DataMessageHeader_Old::serial, cmlabs::DataMessageHeader::size, cmlabs::DataMessageHeader_Old::size, cmlabs::DataMessageHeader_Old::status, cmlabs::DataMessageHeader_Old::tag, cmlabs::DataMessageHeader_Old::time, cmlabs::DataMessageHeader_Old::to, cmlabs::DataMessageHeader_Old::ttl, cmlabs::DataMessageHeader_Old::type, cmlabs::DataMessageHeader_Old::userCount, and cmlabs::DataMessageHeader_Old::userSize.

Referenced by _wrap_DataMessage_ConvertDataFromOlderMessageFormat(), _wrap_DataMessage_ConvertDataFromOlderMessageFormat(), DataMessage(), DataMessage(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1ConvertDataFromOlderMessageFormat().

◆ copy()

DataMessage * cmlabs::DataMessage::copy ( )
inline

copy() Creates a full deep copy of the message and returns it.

Returns
new DataMessage owned by the caller (delete when done), or NULL if data is invalid

Definition at line 370 of file DataMessage.h.

References DataMessage().

Referenced by _wrap_DataMessage_copy(), _wrap_DataMessage_copy(), DataMessage(), cmlabs::Internal_MessageToggler(), cmlabs::Internal_MessageTypeConverter(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1copy(), and cmlabs::TestRequestClient::run().

◆ copyUserEntriesFromMessage()

uint32 cmlabs::DataMessage::copyUserEntriesFromMessage ( DataMessage * msg)

copyUserEntriesFromMessage(DataMessage* msg) Copies all user data from a message into this message, overwriting any existing entries with the same key

Parameters
msgthe Message to copy the user data from
Returns
the number of data entries copied

Definition at line 150 of file DataMessage.cpp.

References cmlabs::DataMessageHeader::cid, CONSTCHARID, data, DataMessage(), DATAMESSAGEID, setRawData(), cmlabs::DataMessageEntryHeader::size, cmlabs::DataMessageHeader::size, and cmlabs::DataMessageHeader::userCount.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1copyUserEntriesFromMessage(), and UnitTest().

◆ deleteEntry()

bool cmlabs::DataMessage::deleteEntry ( const char * key)
inline

deleteEntry(const char* key)

Marks the entry as unused

Parameters
keykeyword
Returns
true if successfull

Definition at line 2478 of file DataMessage.h.

References data, DATAMESSAGEID, and removeEntry().

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1deleteEntry().

◆ fillInDraftUserDataFrom()

bool cmlabs::DataMessage::fillInDraftUserDataFrom ( const char * data,
uint32 maxDraftSize )

fillInDraftUserDataFrom(const char* data, uint32 maxDraftSize)

Internal function: for a "draft" message (created with a maxDraftSize limit, where large entries were replaced by name+size placeholders), copy the missing full entry payloads back in from the complete source block data.

Parameters
datathe complete original binary message block
maxDraftSizethe draft size limit originally used
Returns
true if successful

Definition at line 1361 of file DataMessage.cpp.

References CHARDATAID, CHARDATAINFOID, CONSTCHARID, CONSTCHARINFOID, data, DATAMESSAGEDRAFTID, DATAMESSAGEID, DATAMESSAGEINFOID, DOUBLEID, INTID, setDouble(), setInt(), setRawData(), setString(), setTime(), cmlabs::DataMessageEntryHeader::size, cmlabs::DataMessageHeader::size, TIMEID, cmlabs::DataMessageHeader::userCount, and cmlabs::DataMessageHeader::userSize.

Referenced by DataMessage(), DataMessage(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1fillInDraftUserDataFrom().

◆ FindClosestMessage()

DataMessage * cmlabs::DataMessage::FindClosestMessage ( uint64 t,
std::map< uint64, DataMessage * > & messages )
static

FindClosestMessage(uint64 t, std::map<uint64, DataMessage*> &messages) In a map of time -> DataMessage, find the message closes to the time t.

Parameters
ttimestamp to find the closest match to
messagesmap of time -> DataMessage
Returns
Closest DataMessage to time t or NULL if messages is empty

Definition at line 3117 of file DataMessage.cpp.

References DataMessage().

Referenced by _wrap_DataMessage_FindClosestMessage(), _wrap_DataMessage_FindClosestMessage(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1FindClosestMessage().

◆ findEntry()

char * cmlabs::DataMessage::findEntry ( const char * key)
inlineprotected

findEntry(const char* key)

Internal function: like findKey() but returns a pointer to the entry's value payload (just past the entry header and the key string).

Parameters
keyentry name to find
Returns
pointer to the payload, or NULL if the key does not exist

Definition at line 2562 of file DataMessage.h.

References findKey().

Referenced by getAsBool(), getAsString(), getAttachedMessageCopy(), getContentSize(), getContentType(), getData(), getDataCopy(), getDouble(), getFloat(), getInt(), getString(), getString(), getTime(), hasData(), hasFloat(), hasInteger(), hasKey(), hasMessage(), hasString(), hasTime(), isSingleValue(), and setRawData().

◆ findKey()

char * cmlabs::DataMessage::findKey ( const char * key)
inlineprotected

findKey(const char* key) Internal function: linear scan of the entry list for an entry whose key matches key (case-insensitive), with a one-slot cache of the last lookup to make repeated access to the same key O(1).

Parameters
keyentry name to find
Returns
pointer to the start of the entry (its DataMessageEntryHeader), or NULL if not found or the message is invalid

Definition at line 2532 of file DataMessage.h.

References _lastFindKey, _lastFindKeyResult, CONSTCHARID, data, DATAMESSAGEID, cmlabs::DataMessageEntryHeader::size, and stricmp.

Referenced by findEntry(), and removeEntry().

◆ findSpace()

char * cmlabs::DataMessage::findSpace ( uint32 space)
inlineprotected

findSpace(uint32 space)

Internal function: scans for a previously deleted (UNUSEDID) entry slot of EXACTLY space bytes that can be reused for a new entry, avoiding a reallocation of the whole block.

Note
Only exact-size matches are reused; allowing smaller reuse would require slot splitting, which is not implemented (see code comment).
Parameters
spacerequired slot size in bytes (header + key + payload)
Returns
pointer to a reusable slot, or NULL if none exists or the message is invalid

Definition at line 2600 of file DataMessage.h.

References data, DATAMESSAGEID, cmlabs::DataMessageEntryHeader::size, and UNUSEDID.

Referenced by setRawData().

◆ getArrayCount()

uint32 cmlabs::DataMessage::getArrayCount ( const char * key)

getArrayCount(const char* key) Returns the number of elements in array with name '<key>'

Parameters
keyentry key

Definition at line 2738 of file DataMessage.cpp.

References getArraySize().

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getArrayCount().

◆ getArraySize()

uint32 cmlabs::DataMessage::getArraySize ( const char * key)

◆ getAsBool()

bool cmlabs::DataMessage::getAsBool ( const char * key)

getAsBool(const char* key)

returns the interpretation of the entry as a Boolean value i.e. if the value is integer/float != 0, string "yes", etc.

Parameters
key

Definition at line 1596 of file DataMessage.cpp.

References CHARDATAID, CHARDATAINFOID, CONSTCHARID, CONSTCHARINFOID, DATAMESSAGEID, DATAMESSAGEINFOID, DOUBLEID, findEntry(), INTID, stricmp, and TIMEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getAsBool(), and UnitTest().

◆ getAsFloat() [1/3]

float64 cmlabs::DataMessage::getAsFloat ( const char * idx,
const char * key )

returns the user entry as a float regardless of what type it is

Parameters
idxtextual index for the maps
key
Returns
user entry as a string

Definition at line 1591 of file DataMessage.cpp.

References cmlabs::utils::Ascii2Float64(), and getAsString().

◆ getAsFloat() [2/3]

float64 cmlabs::DataMessage::getAsFloat ( const char * key)

◆ getAsFloat() [3/3]

float64 cmlabs::DataMessage::getAsFloat ( int64 i,
const char * key )

getAsFloat(int64 i, const char* key)

Parameters
i
key

Definition at line 1579 of file DataMessage.cpp.

References cmlabs::utils::Ascii2Float64(), and getAsString().

◆ getAsFloatArray()

◆ getAsFloatMap()

std::map< std::string, float64 > cmlabs::DataMessage::getAsFloatMap ( const char * key)

returns the user entry as a float map regardless of what type it is

Parameters
key
Returns
user entry as a string

Definition at line 2843 of file DataMessage.cpp.

References cmlabs::utils::Ascii2Float64(), CHARDATAID, CONSTCHARID, data, DATAMESSAGEID, DOUBLEID, INTID, cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), cmlabs::utils::TextStartsWith(), and TIMEID.

◆ getAsInt() [1/3]

int64 cmlabs::DataMessage::getAsInt ( const char * idx,
const char * key )

returns the user entry as an integer regardless of what type it is

Parameters
idxtextual index for the maps
key
Returns
user entry as a string

Definition at line 1583 of file DataMessage.cpp.

References cmlabs::utils::Ascii2Int64(), and getAsString().

◆ getAsInt() [2/3]

int64 cmlabs::DataMessage::getAsInt ( const char * key)

◆ getAsInt() [3/3]

int64 cmlabs::DataMessage::getAsInt ( int64 i,
const char * key )

getAsInt(int64 i, const char* key)

Parameters
i
key

Definition at line 1571 of file DataMessage.cpp.

References cmlabs::utils::Ascii2Int64(), and getAsString().

◆ getAsIntArray()

std::map< int64, int64 > cmlabs::DataMessage::getAsIntArray ( const char * key)

◆ getAsIntMap()

std::map< std::string, int64 > cmlabs::DataMessage::getAsIntMap ( const char * key)

returns the user entry as an integer map regardless of what type it is

Parameters
key
Returns
user entry as a string

Definition at line 2799 of file DataMessage.cpp.

References cmlabs::utils::Ascii2Int64(), CHARDATAID, CONSTCHARID, data, DATAMESSAGEID, DOUBLEID, INTID, cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), cmlabs::utils::TextStartsWith(), and TIMEID.

◆ getAsString() [1/3]

std::string cmlabs::DataMessage::getAsString ( const char * idx,
const char * key )

returns the user entry as a string regardless of what type it is

Parameters
idxtextual index for the maps
key
Returns
user entry as a string

Definition at line 2267 of file DataMessage.cpp.

References getAsString(), and cmlabs::utils::StringFormat().

◆ getAsString() [2/3]

◆ getAsString() [3/3]

std::string cmlabs::DataMessage::getAsString ( int64 i,
const char * key )

getAsString(int64 i, const char* key)

Parameters
i
key

Definition at line 2141 of file DataMessage.cpp.

References getAsString(), and cmlabs::utils::StringFormat().

◆ getAsStringArray()

std::map< int64, std::string > cmlabs::DataMessage::getAsStringArray ( const char * key)

◆ getAsStringMap()

std::map< std::string, std::string > cmlabs::DataMessage::getAsStringMap ( const char * key)

returns the user entry as a string regardless of what type it is

Parameters
key
Returns
user entry as a string

Definition at line 2887 of file DataMessage.cpp.

References CHARDATAID, CONSTCHARID, data, DATAMESSAGEID, DOUBLEID, INTID, cmlabs::PrintTimeString(), cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), cmlabs::utils::TextStartsWith(), and TIMEID.

Referenced by UnitTest().

◆ getAsTime() [1/3]

uint64 cmlabs::DataMessage::getAsTime ( const char * idx,
const char * key )

returns the user entry as a time regardless of what type it is

Parameters
idxtextual index for the maps
key
Returns
user entry as a string

Definition at line 1587 of file DataMessage.cpp.

References cmlabs::utils::Ascii2Uint64(), and getAsString().

◆ getAsTime() [2/3]

uint64 cmlabs::DataMessage::getAsTime ( const char * key)

◆ getAsTime() [3/3]

uint64 cmlabs::DataMessage::getAsTime ( int64 i,
const char * key )

getAsTime(int64 i, const char* key)

Parameters
i
key

Definition at line 1575 of file DataMessage.cpp.

References cmlabs::utils::Ascii2Uint64(), and getAsString().

◆ getAttachedMessageArray()

std::map< int64, DataMessage * > cmlabs::DataMessage::getAttachedMessageArray ( const char * key)

◆ getAttachedMessageCopy() [1/4]

DataMessage * cmlabs::DataMessage::getAttachedMessageCopy ( const char * idx,
const char * key )

returns a copy of the user message entry with this key

Parameters
idxtextual index for the maps
key
Returns
copy of the user message entry

Definition at line 2311 of file DataMessage.cpp.

References DataMessage(), getAttachedMessageCopy(), and cmlabs::utils::StringFormat().

◆ getAttachedMessageCopy() [2/4]

◆ getAttachedMessageCopy() [3/4]

DataMessage * cmlabs::DataMessage::getAttachedMessageCopy ( const char * key,
bool & success )

getAttachedMessageCopy(const char* key)

returns a copy of the user message entry with this key / returning the value and success/fail as a parameter

Parameters
key
success

Definition at line 1903 of file DataMessage.cpp.

References DataMessage(), DATAMESSAGEID, and findEntry().

◆ getAttachedMessageCopy() [4/4]

DataMessage * cmlabs::DataMessage::getAttachedMessageCopy ( int64 i,
const char * key )

◆ getAttachedMessageMap()

std::map< std::string, DataMessage * > cmlabs::DataMessage::getAttachedMessageMap ( const char * key)

returns a copy of the user message entry with this key

Parameters
key
Returns
copy of the user message entry

Definition at line 3031 of file DataMessage.cpp.

References CONSTCHARID, data, DataMessage(), DATAMESSAGEID, cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), and cmlabs::utils::TextStartsWith().

◆ getChainCount()

uint32 cmlabs::DataMessage::getChainCount ( )
inline

getChainCount()

Get number of messages it took to process the trigger message that caused this message to be posted

Returns
0 if the message is not valid
count

Definition at line 2446 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getChainCount(), _wrap_DataMessage_getChainCount(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getChainCount().

◆ getChainCPUTime()

uint16 cmlabs::DataMessage::getChainCPUTime ( )
inline

getChainCPUTime()

Get cpu time in us it took to process the trigger message that caused this message to be posted

Returns
0 if the message is not valid
cpu time in us

Definition at line 2379 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getChainCPUTime(), _wrap_DataMessage_getChainCPUTime(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getChainCPUTime().

◆ getChainWallTime()

uint16 cmlabs::DataMessage::getChainWallTime ( )
inline

getChainWallTime()

Get wall time in us it took to process the trigger message that caused this message to be posted

Returns
0 if the message is not valid
cpu time in us

Definition at line 2413 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getChainWallTime(), _wrap_DataMessage_getChainWallTime(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getChainWallTime().

◆ getContentSize() [1/3]

uint32 cmlabs::DataMessage::getContentSize ( const char * idx,
const char * key )

returns the binary size of the content with this key

Parameters
idxtextual index for the maps
key
Returns
binary size of the content

Definition at line 2259 of file DataMessage.cpp.

References getContentSize(), and cmlabs::utils::StringFormat().

◆ getContentSize() [2/3]

uint32 cmlabs::DataMessage::getContentSize ( const char * key)

◆ getContentSize() [3/3]

uint32 cmlabs::DataMessage::getContentSize ( int64 i,
const char * key )

◆ getContentType() [1/3]

uint32 cmlabs::DataMessage::getContentType ( const char * idx,
const char * key )

returns the type of content with this key as CONSTCHARID, TIMEID, CHARDATAID, INTID, DOUBLEID, etc

Parameters
idxtextual index for the maps
key
Returns
contentType as int

Definition at line 2251 of file DataMessage.cpp.

References getContentType(), and cmlabs::utils::StringFormat().

◆ getContentType() [2/3]

◆ getContentType() [3/3]

uint32 cmlabs::DataMessage::getContentType ( int64 i,
const char * key )

◆ getContextChange()

PsyContext cmlabs::DataMessage::getContextChange ( )
inline

getContextChange()

Get and return context change entry

Returns
NOCONTEXT is message is not valid or if context change is not set
contextchange else

Definition at line 1948 of file DataMessage.h.

References data, DATAMESSAGEID, and NOCONTEXT.

Referenced by cmlabs::Internal_Print().

◆ getCreatedTime()

◆ GetCSVHeader()

std::string cmlabs::DataMessage::GetCSVHeader ( const char * separator = NULL,
const char * preample = NULL )
static

◆ getCycleCPUTime()

uint16 cmlabs::DataMessage::getCycleCPUTime ( )
inline

getCycleCPUTime()

Get cpu time in us it took to process the trigger message that caused this message to be posted

Returns
0 if the message is not valid
cpu time in us

Definition at line 2310 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getCycleCPUTime(), _wrap_DataMessage_getCycleCPUTime(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getCycleCPUTime().

◆ getCycleWallTime()

uint16 cmlabs::DataMessage::getCycleWallTime ( )
inline

getCycleWallTime()

Get wall time in us it took to process the trigger message that caused this message to be posted

Returns
0 if the message is not valid
cpu time in us

Definition at line 2344 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getCycleWallTime(), _wrap_DataMessage_getCycleWallTime(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getCycleWallTime().

◆ getData() [1/4]

const char * cmlabs::DataMessage::getData ( const char * idx,
const char * key,
uint32 & size )

returns the user binary data entry with this key + the size

Parameters
idxtextual index for the maps
key
size
Returns
user binary data

Definition at line 2303 of file DataMessage.cpp.

References getData(), and cmlabs::utils::StringFormat().

◆ getData() [2/4]

◆ getData() [3/4]

const char * cmlabs::DataMessage::getData ( const char * key,
uint32 & size,
bool & success )

getData(const char* key, uint32& size)

returns the user binary data entry with this key + the size / returning the value and success/fail as a parameter

Parameters
key
size
success

Definition at line 1873 of file DataMessage.cpp.

References CHARDATAID, and findEntry().

◆ getData() [4/4]

const char * cmlabs::DataMessage::getData ( int64 i,
const char * key,
uint32 & size )

getData(int64 i, const char* key, uint32& size)

Parameters
i
key
size

Definition at line 2208 of file DataMessage.cpp.

References getData(), and cmlabs::utils::StringFormat().

◆ getDataCopy() [1/4]

char * cmlabs::DataMessage::getDataCopy ( const char * idx,
const char * key,
uint32 & size )

returns a copy of the user binary data entry with this key + the size

Parameters
idxtextual index for the maps
key
size
Returns
copy of the user binary data

Definition at line 2307 of file DataMessage.cpp.

References getDataCopy(), and cmlabs::utils::StringFormat().

◆ getDataCopy() [2/4]

◆ getDataCopy() [3/4]

char * cmlabs::DataMessage::getDataCopy ( const char * key,
uint32 & size,
bool & success )

getDataCopy(const char* key, uint32& size)

returns a copy of the user binary data entry with this key + the size / returning the value and success/fail as a parameter

Parameters
key
size
success

Definition at line 1887 of file DataMessage.cpp.

References CHARDATAID, data, and findEntry().

◆ getDataCopy() [4/4]

char * cmlabs::DataMessage::getDataCopy ( int64 i,
const char * key,
uint32 & size )

◆ getDestination()

uint16 cmlabs::DataMessage::getDestination ( )
inline

getDestination() Get the NodeID of the destination node

Returns
0 if the message is not valid, otherwise the destination NodeID

Definition at line 1705 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getDestination(), _wrap_DataMessage_getDestination(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getDestination().

◆ getDouble() [1/9]

double cmlabs::DataMessage::getDouble ( const char * idx,
const char * key )

returns the user double entry with this key

Parameters
idxtextual index for the maps
key
Returns
user double entry

Definition at line 2197 of file DataMessage.cpp.

References getDouble().

◆ getDouble() [2/9]

double cmlabs::DataMessage::getDouble ( const char * idx,
const char * key,
bool & success )

returns the user double entry with this key

Parameters
idxtextual index for the maps
key
success
Returns
user double entry

Definition at line 2295 of file DataMessage.cpp.

References getDouble(), and cmlabs::utils::StringFormat().

◆ getDouble() [3/9]

bool cmlabs::DataMessage::getDouble ( const char * idx,
const char * key,
double & value )

returns the user float entry with this key

Parameters
idxtextual index for the maps
key
value
Returns
true if successfull

Definition at line 2283 of file DataMessage.cpp.

References getDouble(), and cmlabs::utils::StringFormat().

◆ getDouble() [4/9]

double cmlabs::DataMessage::getDouble ( const char * key)

getDouble(const char* key)

returns the user double entry with this key/ returning the value with no indication of the success/fail except value will be default (0, "", NULL, etc.)

Parameters
key

Definition at line 1863 of file DataMessage.cpp.

References getDouble().

◆ getDouble() [5/9]

double cmlabs::DataMessage::getDouble ( const char * key,
bool & success )

getDouble(const char* key, double& value)

returns the user float entry with this key / returning the value and success/fail as a parameter

Parameters
keyentry key
successset to true if the entry was found

Definition at line 1839 of file DataMessage.cpp.

References DOUBLEID, and findEntry().

◆ getDouble() [6/9]

◆ getDouble() [7/9]

double cmlabs::DataMessage::getDouble ( int64 i,
const char * key )

getDouble(int64 i, const char* key)

Parameters
i
key

Definition at line 2182 of file DataMessage.cpp.

References getDouble().

◆ getDouble() [8/9]

double cmlabs::DataMessage::getDouble ( int64 i,
const char * key,
bool & success )

getDouble(int64 i, const char* key, bool& success)

Parameters
i
key
success

Definition at line 2169 of file DataMessage.cpp.

References getDouble(), and cmlabs::utils::StringFormat().

◆ getDouble() [9/9]

bool cmlabs::DataMessage::getDouble ( int64 i,
const char * key,
double & value )

getDouble(int64 i, const char* key, double& value)

Parameters
i
key
value

Definition at line 2157 of file DataMessage.cpp.

References getDouble(), and cmlabs::utils::StringFormat().

◆ getDoubleArray()

std::map< int64, double > cmlabs::DataMessage::getDoubleArray ( const char * key)

◆ getDoubleMap()

std::map< std::string, double > cmlabs::DataMessage::getDoubleMap ( const char * key)

returns the user double entry with this key

Parameters
key
Returns
user double entry

Definition at line 2981 of file DataMessage.cpp.

References CONSTCHARID, data, DATAMESSAGEID, DOUBLEID, cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), and cmlabs::utils::TextStartsWith().

◆ getEOL()

uint64 cmlabs::DataMessage::getEOL ( )
inline

getEOL()

Get End of life of message

Returns
0 if message is not valid or the ttl is not set
time that the message will expire

Definition at line 2002 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getEOL(), _wrap_DataMessage_getEOL(), cmlabs::MessageIndex::addMessage(), cmlabs::TemporalMemory::insertMessage(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getEOL(), cmlabs::PsySpace::postMessage(), and cmlabs::PsySpace::queryReply().

◆ getFloat() [1/9]

float64 cmlabs::DataMessage::getFloat ( const char * idx,
const char * key )

returns the user float entry with this key

Parameters
idxtextual index for the maps
key
Returns
user float entry

Definition at line 2202 of file DataMessage.cpp.

References getFloat().

◆ getFloat() [2/9]

float64 cmlabs::DataMessage::getFloat ( const char * idx,
const char * key,
bool & success )

returns the user float entry with this key

Parameters
idxtextual index for the maps
key
success
Returns

Definition at line 2299 of file DataMessage.cpp.

References getFloat(), and cmlabs::utils::StringFormat().

◆ getFloat() [3/9]

bool cmlabs::DataMessage::getFloat ( const char * idx,
const char * key,
float64 & value )

returns the user float entry with this key

Parameters
idxtextual index for the maps
key
value
Returns
true if successfull

Definition at line 2287 of file DataMessage.cpp.

References getFloat(), and cmlabs::utils::StringFormat().

◆ getFloat() [4/9]

double cmlabs::DataMessage::getFloat ( const char * key)

getFloat(const char* key)

returns the user float entry with this key/ returning the value with no indication of the success/fail except value will be default (0, "", NULL, etc.)

Parameters
key

Definition at line 1868 of file DataMessage.cpp.

References getFloat().

◆ getFloat() [5/9]

float64 cmlabs::DataMessage::getFloat ( const char * key,
bool & success )

getFloat(const char* key, float64& value)

returns the user float entry with this key / returning the value and success/fail as a parameter

Parameters
keyentry key
successset to true if the entry was found

Definition at line 1851 of file DataMessage.cpp.

References DOUBLEID, and findEntry().

◆ getFloat() [6/9]

◆ getFloat() [7/9]

float64 cmlabs::DataMessage::getFloat ( int64 i,
const char * key )

getFloat(int64 i, const char* key)

Parameters
i
key

Definition at line 2187 of file DataMessage.cpp.

References getFloat().

◆ getFloat() [8/9]

float64 cmlabs::DataMessage::getFloat ( int64 i,
const char * key,
bool & success )

getFloat(int64 i, const char* key, bool& success)

Parameters
i
key
success

Definition at line 2173 of file DataMessage.cpp.

References getFloat(), and cmlabs::utils::StringFormat().

◆ getFloat() [9/9]

bool cmlabs::DataMessage::getFloat ( int64 i,
const char * key,
float64 & value )

getFloat(int64 i, const char* key, float64& value)

Parameters
i
key
value

Definition at line 2161 of file DataMessage.cpp.

References getFloat(), and cmlabs::utils::StringFormat().

◆ getFloatArray()

std::map< int64, float64 > cmlabs::DataMessage::getFloatArray ( const char * key)

◆ getFloatMap()

std::map< std::string, float64 > cmlabs::DataMessage::getFloatMap ( const char * key)

returns the user float entry with this key

Parameters
key
Returns
user float entry

Definition at line 3006 of file DataMessage.cpp.

References CONSTCHARID, data, DATAMESSAGEID, DOUBLEID, cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), and cmlabs::utils::TextStartsWith().

◆ getFrom()

◆ getInt() [1/9]

int64 cmlabs::DataMessage::getInt ( const char * idx,
const char * key )

returns the user integer entry with this key

Parameters
idxtextual index for the maps
key
Returns
user integer entry

Definition at line 2192 of file DataMessage.cpp.

References getInt().

◆ getInt() [2/9]

int64 cmlabs::DataMessage::getInt ( const char * idx,
const char * key,
bool & success )

returns the user integer entry with this key

Parameters
idxtextual index for the maps
key
success
Returns
user integer entry

Definition at line 2291 of file DataMessage.cpp.

References getInt(), and cmlabs::utils::StringFormat().

◆ getInt() [3/9]

bool cmlabs::DataMessage::getInt ( const char * idx,
const char * key,
int64 & value )

returns the user integer entry with this key

Parameters
idxtextual index for the maps
key
value
Returns
true if successfull

Definition at line 2279 of file DataMessage.cpp.

References getInt(), and cmlabs::utils::StringFormat().

◆ getInt() [4/9]

int64 cmlabs::DataMessage::getInt ( const char * key)

getInt(const char* key)

returns the user integer entry with this key / returning the value with no indication of the success/fail except value will be default (0, "", NULL, etc.)

Parameters
key

Definition at line 1834 of file DataMessage.cpp.

References getInt().

◆ getInt() [5/9]

int64 cmlabs::DataMessage::getInt ( const char * key,
bool & success )

getInt(const char* key, int64& value)

returns the user integer entry with this key / returning the value and success/fail as a parameter

Parameters
keyentry key
successset to true if the entry was found

Definition at line 1822 of file DataMessage.cpp.

References findEntry(), and INTID.

◆ getInt() [6/9]

bool cmlabs::DataMessage::getInt ( const char * key,
int64 & value )

getInt(const char* key, int64& value)

returns the user integer entry with this key

Parameters
key
value

Definition at line 1727 of file DataMessage.cpp.

References getInt().

Referenced by cmlabs::Bitmap::Bitmap(), cmlabs::GenericObservation< T >::extractDataFromMessage(), cmlabs::ExtractIntFromMessage(), cmlabs::ObsInteger::extractRangeFrom(), cmlabs::ObsInteger::extractRangeTo(), cmlabs::ExtractTimeFromMessage(), getInt(), getInt(), getInt(), getInt(), getInt(), getInt(), getInt(), getInt(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getInt_1_1SWIG_10(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getInt_1_1SWIG_11(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getInt_1_1SWIG_12(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getInt_1_1SWIG_13(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getInt_1_1SWIG_14(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getInt_1_1SWIG_15(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getInt_1_1SWIG_16(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getInt_1_1SWIG_17(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getInt_1_1SWIG_18(), cmlabs::RESTParser::parseRequest(), cmlabs::RequestGateway::receiveMessage(), cmlabs::RequestGateway::replyToClient(), cmlabs::RESTRequest::RESTRequest(), cmlabs::PsyAPI::retrieve(), cmlabs::ComponentMemory::syncComponents(), cmlabs::DataMapsMemory::syncContextLevels(), cmlabs::DataMapsMemory::syncCranks(), cmlabs::DataMapsMemory::syncTags(), cmlabs::DataMapsMemory::syncTypeLevels(), cmlabs::ComponentMemory::UnitTest(), UnitTest(), cmlabs::MemoryManager::UnitTest(), cmlabs::MessageIndex::UnitTest(), and cmlabs::TriggerSpec::UnitTest().

◆ getInt() [7/9]

int64 cmlabs::DataMessage::getInt ( int64 i,
const char * key )

getInt(int64 i, const char* key)

Parameters
i
key

Definition at line 2177 of file DataMessage.cpp.

References getInt().

◆ getInt() [8/9]

int64 cmlabs::DataMessage::getInt ( int64 i,
const char * key,
bool & success )

getInt(int64 i, const char* key, bool& success)

Parameters
i
key
success

Definition at line 2165 of file DataMessage.cpp.

References getInt(), and cmlabs::utils::StringFormat().

◆ getInt() [9/9]

bool cmlabs::DataMessage::getInt ( int64 i,
const char * key,
int64 & value )

getInt(int64 i, const char* key, int64& value)

Parameters
i
key
value

Definition at line 2153 of file DataMessage.cpp.

References getInt(), and cmlabs::utils::StringFormat().

◆ getIntArray()

std::map< int64, int64 > cmlabs::DataMessage::getIntArray ( const char * key)

◆ getIntMap()

std::map< std::string, int64 > cmlabs::DataMessage::getIntMap ( const char * key)

returns the user integer entry with this key

Parameters
key
Returns
user integer entry

Definition at line 2956 of file DataMessage.cpp.

References CONSTCHARID, data, DATAMESSAGEID, INTID, cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), and cmlabs::utils::TextStartsWith().

Referenced by UnitTest().

◆ getKeyType()

DataMessage::KeyType cmlabs::DataMessage::getKeyType ( const char * key)

◆ getMapCount()

uint32 cmlabs::DataMessage::getMapCount ( const char * key)

getMapCount(const char* key) Returns the number of elements in map with name '<key>'

Parameters
keyentry key

Definition at line 2764 of file DataMessage.cpp.

References getMapSize().

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getMapCount().

◆ getMapSize()

uint32 cmlabs::DataMessage::getMapSize ( const char * key)

◆ getMemID()

uint64 cmlabs::DataMessage::getMemID ( )
inline

getMemID() Get and return memory ID

Returns
memid memory ID

Definition at line 1836 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getMemID(), _wrap_DataMessage_getMemID(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getMemID().

◆ getOrigin()

uint16 cmlabs::DataMessage::getOrigin ( )
inline

getOrigin() Get the NodeID of the node the message originated on

Returns
0 if the message is not valid, otherwise the origin NodeID

Definition at line 1696 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getOrigin(), _wrap_DataMessage_getOrigin(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getOrigin().

◆ getPolicy()

uint8 cmlabs::DataMessage::getPolicy ( )
inline

getPolicy()

Gets the policy id of the message

Returns
0 if the message is not valid or if no policy is set
policy id else

Definition at line 2098 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getPolicy(), _wrap_DataMessage_getPolicy(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getPolicy().

◆ getPriority()

uint16 cmlabs::DataMessage::getPriority ( )
inline

getPriority()

Get message priority Messages have a prority that determines their relative order of scheduling, both in the whiteboards and in the modules.

Returns
0 if the message is not valid
priority else

Definition at line 2063 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getPriority(), _wrap_DataMessage_getPriority(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getPriority().

◆ getRawData()

char * cmlabs::DataMessage::getRawData ( )
inline

getRawData() Retrieve a pointer to the raw binary block of the message (header + entries).

The block is data->size bytes long and remains owned by the message; it can be memcpy'd elsewhere to clone or transmit the message verbatim.

Returns
NULL if the message is not valid, otherwise pointer to the block

Definition at line 1686 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getRawData(), _wrap_DataMessage_getRawData(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getRawData(), and UnitTest().

◆ getRecvTime()

uint64 cmlabs::DataMessage::getRecvTime ( )
inline

getRecvTime()

Get and return time message was received

Returns
0 if the message is not valid or the time was not set
recvtime else

Definition at line 2160 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getRecvTime(), _wrap_DataMessage_getRecvTime(), cmlabs::Internal_StatsLog(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getRecvTime(), and cmlabs::TestRequestExecutor::longRequestRun().

◆ getReference()

◆ getSendTime()

uint64 cmlabs::DataMessage::getSendTime ( )
inline

getSendTime()

Get time message was sent

Returns
0 if the message is not valid or the time was not set
sendtime else

Definition at line 2129 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getSendTime(), _wrap_DataMessage_getSendTime(), cmlabs::Internal_StatsLog(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getSendTime().

◆ getSerial()

uint64 cmlabs::DataMessage::getSerial ( )
inline

getSerial()

Get message serial number

Returns
0 if the message is not valid
serial else

Definition at line 2253 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getSerial(), _wrap_DataMessage_getSerial(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getSerial(), and cmlabs::TemporalMemory::UnitTest().

◆ getSize()

◆ getStatus()

uint16 cmlabs::DataMessage::getStatus ( )
inline

getStatus()

Get current message status

Returns
0 if the message is not valid
status else

Definition at line 2223 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getStatus(), _wrap_DataMessage_getStatus(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getStatus(), cmlabs::RequestClient::receiveMessage(), and cmlabs::Test_RequestClient().

◆ getString() [1/8]

const char * cmlabs::DataMessage::getString ( const char * idx,
const char * key )

returns the user string entry with this key

Parameters
idxtextual index for the maps
key
Returns
user string entry

Definition at line 2271 of file DataMessage.cpp.

References getString(), and cmlabs::utils::StringFormat().

◆ getString() [2/8]

const char * cmlabs::DataMessage::getString ( const char * idx,
const char * key,
uint32 & size )

returns the user string entry with this key

Parameters
idxtextual index for the maps
key
sizethe size of the memory chunk for the String
Returns
user string entry

Definition at line 2275 of file DataMessage.cpp.

References getString(), and cmlabs::utils::StringFormat().

◆ getString() [3/8]

const char * cmlabs::DataMessage::getString ( const char * key)

getString(const char* key)

returns the user string entry with this key

Parameters
key

Definition at line 1712 of file DataMessage.cpp.

References getString().

Referenced by cmlabs::RequestGateway::addRequestReplyToRequestQueue(), cmlabs::RESTParser::extractArrayParameters(), cmlabs::RESTParser::extractParameters(), cmlabs::ObsString::extractRangeFrom(), cmlabs::ObsString::extractRangeTo(), cmlabs::ExtractStringFromMessage(), getString(), getString(), getString(), getString(), getString(), getString(), cmlabs::Internal_MessageToggler(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getString_1_1SWIG_10(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getString_1_1SWIG_11(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getString_1_1SWIG_12(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getString_1_1SWIG_13(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getString_1_1SWIG_14(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getString_1_1SWIG_15(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getString_1_1SWIG_16(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getString_1_1SWIG_17(), cmlabs::RESTParser::parseRequest(), cmlabs::RequestExecutor::receiveMessage(), cmlabs::RequestGateway::receiveMessage(), cmlabs::RequestGateway::replyToClient(), cmlabs::RESTRequest::RESTRequest(), cmlabs::RequestClient::SendRequestAndWaitForJSON(), cmlabs::RESTParser::setParameterValue(), cmlabs::ComponentMemory::syncComponents(), cmlabs::DataMapsMemory::syncContextLevels(), cmlabs::DataMapsMemory::syncCranks(), cmlabs::DataMapsMemory::syncTags(), cmlabs::DataMapsMemory::syncTypeLevels(), cmlabs::Test_RequestClient(), UnitTest(), and cmlabs::ProcessMemory::UnitTest().

◆ getString() [4/8]

const char * cmlabs::DataMessage::getString ( const char * key,
bool & success )

getString(const char* key)

returns the user string entry with this key / returning the value and success/fail as a parameter

Parameters
key
success

Definition at line 1766 of file DataMessage.cpp.

References CONSTCHARID, and findEntry().

◆ getString() [5/8]

const char * cmlabs::DataMessage::getString ( const char * key,
uint32 & size )

getString(const char* key, uint32 &size)

returns the user string entry with this key and provides the size

Parameters
key
size

Definition at line 1717 of file DataMessage.cpp.

References getString().

◆ getString() [6/8]

const char * cmlabs::DataMessage::getString ( const char * key,
uint32 & size,
bool & success )

getString(const char* key, uint32 &size)

returns the user string entry with this key and provides the size / returning the value and success/fail as a parameter

Parameters
key
size
success

Definition at line 1780 of file DataMessage.cpp.

References CONSTCHARID, and findEntry().

◆ getString() [7/8]

const char * cmlabs::DataMessage::getString ( int64 i,
const char * key )

getString(int64 i, const char* key)

Parameters
i
key

Definition at line 2145 of file DataMessage.cpp.

References getString(), and cmlabs::utils::StringFormat().

◆ getString() [8/8]

const char * cmlabs::DataMessage::getString ( int64 i,
const char * key,
uint32 & size )

getString(int64 i, const char* key, uint32 &size)

Parameters
i
key
size

Definition at line 2149 of file DataMessage.cpp.

References getString(), and cmlabs::utils::StringFormat().

◆ getStringArray()

std::map< int64, std::string > cmlabs::DataMessage::getStringArray ( const char * key)

◆ getStringMap()

std::map< std::string, std::string > cmlabs::DataMessage::getStringMap ( const char * key)

returns the user string entry with this key

Parameters
key
Returns
user string entry

Definition at line 2931 of file DataMessage.cpp.

References CONSTCHARID, data, DATAMESSAGEID, cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), and cmlabs::utils::TextStartsWith().

◆ getSystemID()

◆ getTag()

uint32 cmlabs::DataMessage::getTag ( )
inline

getTag() Retrieve and return message tag id Tags can be used to segment data temporally, i.e.

a module may only be interested in camera data referencing a specific object or event.

Returns
0 if the message is not valid
tag returns message tag

Definition at line 1770 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getTag(), _wrap_DataMessage_getTag(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getTag(), and cmlabs::PsyAPI::postOutputMessage().

◆ getTime() [1/4]

uint64 cmlabs::DataMessage::getTime ( const char * idx,
const char * key )

returns the user time entry with this key

Parameters
idxtextual index for the maps
key
Returns
user time

Definition at line 2263 of file DataMessage.cpp.

References getTime(), and cmlabs::utils::StringFormat().

◆ getTime() [2/4]

◆ getTime() [3/4]

uint64 cmlabs::DataMessage::getTime ( const char * key,
bool & success )

getTime(const char* key, bool& success)

returns the user time entry with this key / returning the value and success/fail as a parameter

Parameters
key
success

Definition at line 1809 of file DataMessage.cpp.

References findEntry(), and TIMEID.

◆ getTime() [4/4]

uint64 cmlabs::DataMessage::getTime ( int64 i,
const char * key )

getTime(int64 i, const char* key)

returns the user time with this key, getting and setting entries in arrays

Parameters
i
key

Definition at line 2137 of file DataMessage.cpp.

References getTime(), and cmlabs::utils::StringFormat().

◆ getTimeArray()

std::map< int64, uint64 > cmlabs::DataMessage::getTimeArray ( const char * key)

◆ getTimeMap()

std::map< std::string, uint64 > cmlabs::DataMessage::getTimeMap ( const char * key)

returns the user time entry with this key

Parameters
key
Returns
user time

Definition at line 2774 of file DataMessage.cpp.

References CONSTCHARID, data, DATAMESSAGEID, cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), cmlabs::utils::TextStartsWith(), and TIMEID.

Referenced by UnitTest().

◆ getTo()

◆ getTTL()

uint64 cmlabs::DataMessage::getTTL ( )
inline

getTTL()

Gets message's "time to live" "TTL is a mechanism that limits the lifespan or lifetime of data in a computer or network"

Messages in Psyclone 2.0 live for a finite amount of time inside the shared memory, If ttl = 0 the message will only be delivered to whoever has subscribed to it and after this seize to exist.

Returns
0 if the message is not valid or the ttl is not set
ttl else

Definition at line 1987 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by _wrap_DataMessage_getTTL(), _wrap_DataMessage_getTTL(), cmlabs::MessageIndex::addMessage(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getTTL(), and cmlabs::PsyAPI::postOutputMessage().

◆ getType()

PsyType cmlabs::DataMessage::getType ( )
inline

getType()

Get message type

Returns
NOTYPE if message is not valid or if type is not set
type else

Definition at line 1916 of file DataMessage.h.

References data, DATAMESSAGEID, and NOTYPE.

Referenced by cmlabs::MessageIndex::addMessage(), cmlabs::Internal_Ping(), cmlabs::Internal_Print(), cmlabs::Internal_RetrieveTest(), cmlabs::PsyAPI::postOutputMessage(), and cmlabs::NetworkManager::UnitTest().

◆ getUserCount()

uint32 cmlabs::DataMessage::getUserCount ( )
inline

getUserCount()

Return the number of user entries stored in the message

Definition at line 804 of file DataMessage.h.

References data.

Referenced by _wrap_DataMessage_getUserCount(), _wrap_DataMessage_getUserCount(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getUserCount(), and UnitTest().

◆ getUserEntriesAsJSON()

std::string cmlabs::DataMessage::getUserEntriesAsJSON ( bool asText)

getUserEntriesAsJSON(bool asText) Returns the JSON representation of the full message including all user entries, arrays and maps - and including the textual representation of any attached messages

Parameters
asTextif true write all entries as human readable text
Returns
JSON string

Definition at line 392 of file DataMessage.cpp.

References cmlabs::utils::Ascii2Int64(), CHARDATAID, CHARDATAINFOID, CONSTCHARID, CONSTCHARINFOID, data, DataMessage(), DATAMESSAGEDRAFTID, DATAMESSAGEID, DATAMESSAGEINFOID, DOUBLEID, getUserEntriesAsJSON(), INTID, cmlabs::PrintTimeString(), cmlabs::DataMessageEntryHeader::size, cmlabs::utils::StringFormat(), swapMessageData(), TIMEID, and toJSON().

Referenced by getUserEntriesAsJSON(), toJSON(), and UnitTest().

◆ getUserEntriesAsString()

std::string cmlabs::DataMessage::getUserEntriesAsString ( )

◆ getUserSize()

uint32 cmlabs::DataMessage::getUserSize ( )
inline

getUserSize()

Return the memory usage in bytes of all user entries stored in the message

Definition at line 795 of file DataMessage.h.

References data.

Referenced by _wrap_DataMessage_getUserSize(), _wrap_DataMessage_getUserSize(), and Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1getUserSize().

◆ hasData()

bool cmlabs::DataMessage::hasData ( const char * key)

Check if key variable exists and is a data entry.

Parameters
key

Definition at line 2108 of file DataMessage.cpp.

References CHARDATAID, and findEntry().

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1hasData(), and UnitTest().

◆ hasFloat()

bool cmlabs::DataMessage::hasFloat ( const char * key)

Check if key variable exists and is a float.

Parameters
key

Definition at line 2096 of file DataMessage.cpp.

References DOUBLEID, and findEntry().

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1hasFloat(), and UnitTest().

◆ hasInteger()

bool cmlabs::DataMessage::hasInteger ( const char * key)

Check if key variable exists and is an integer.

Parameters
key

Definition at line 2090 of file DataMessage.cpp.

References findEntry(), and INTID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1hasInteger(), and UnitTest().

◆ hasKey()

bool cmlabs::DataMessage::hasKey ( const char * key)

Check if key variable exists.

Parameters
key

Definition at line 2080 of file DataMessage.cpp.

References findEntry().

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1hasKey(), and UnitTest().

◆ hasMessage()

bool cmlabs::DataMessage::hasMessage ( const char * key)

Check if key variable exists and is a message.

Parameters
key

Definition at line 2114 of file DataMessage.cpp.

References DATAMESSAGEID, and findEntry().

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1hasMessage(), and UnitTest().

◆ hasString()

bool cmlabs::DataMessage::hasString ( const char * key)

Check if key variable exists and is a string.

Parameters
key

Definition at line 2084 of file DataMessage.cpp.

References CONSTCHARID, and findEntry().

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1hasString(), and UnitTest().

◆ hasTime()

bool cmlabs::DataMessage::hasTime ( const char * key)

Check if key variable exists and is a time.

Parameters
key

Definition at line 2102 of file DataMessage.cpp.

References findEntry(), and TIMEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1hasTime(), and UnitTest().

◆ invalidateFindKeyCache()

void cmlabs::DataMessage::invalidateFindKeyCache ( )
inline

Internal: clears the single-entry key-lookup cache.

Must be called after any operation that moves or invalidates entries (reallocation, removal).

Definition at line 2510 of file DataMessage.h.

References _lastFindKey, and _lastFindKeyResult.

Referenced by DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), removeEntry(), setRawData(), and swapMessageData().

◆ isArrayContent()

bool cmlabs::DataMessage::isArrayContent ( const char * key)

◆ isMapContent()

bool cmlabs::DataMessage::isMapContent ( const char * key)

◆ isSingleValue()

bool cmlabs::DataMessage::isSingleValue ( const char * key)

isSingleValue(const char* key)

Check if key variable is not an array nor a map

Parameters
key

Definition at line 2121 of file DataMessage.cpp.

References findEntry().

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1isSingleValue(), and UnitTest().

◆ isValid()

bool cmlabs::DataMessage::isValid ( )
inline

isValid() Checks that the message memory block exists and carries the current-format object id (DATAMESSAGEID).

All accessors call the equivalent check and return defaults (0, NULL, false) on an invalid message rather than crashing.

Returns
true if the message is valid, false otherwise

Definition at line 405 of file DataMessage.h.

References data, DATAMESSAGEID, and GetObjID.

Referenced by _wrap_DataMessage_isValid(), _wrap_DataMessage_isValid(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1isValid(), setAttachedMessage(), UnitTest(), and cmlabs::TemporalMemory::UnitTest().

◆ removeEntry()

bool cmlabs::DataMessage::removeEntry ( const char * key)
inlineprotected

removeEntry(const char* key)

Internal function: marks the entry as unused (cid = UNUSEDID) and updates userCount/userSize. The slot is not compacted — it remains in the block and may be reused by a later entry of exactly the same size (findSpace()).

Parameters
keyentry name
Returns
true (also when the key did not exist)

Definition at line 2578 of file DataMessage.h.

References data, findKey(), invalidateFindKeyCache(), and UNUSEDID.

Referenced by deleteEntry(), setRawData(), and UnitTest().

◆ setAttachedMessage() [1/3]

bool cmlabs::DataMessage::setAttachedMessage ( const char * idx,
const char * key,
DataMessage * msg )

sets the user message entry with this key to the provided message

Parameters
idxtextual index for the maps
key
msgthe new message
Returns
true if successful

Definition at line 2340 of file DataMessage.cpp.

References DataMessage(), setAttachedMessage(), and cmlabs::utils::StringFormat().

◆ setAttachedMessage() [2/3]

bool cmlabs::DataMessage::setAttachedMessage ( const char * key,
DataMessage * msg )

setAttachedMessage(const char* key, DataMessage* msg)

Attaches a full copy of another DataMessage as a user entry named key. The message content is copied; the caller retains ownership of msg. Retrieve it later with getAttachedMessageCopy().

Parameters
keyentry name
msgthe message to attach (not modified, not taken over)
Returns
true if successful, false otherwise (usually because the message is not valid)

Definition at line 1954 of file DataMessage.cpp.

References data, DataMessage(), DATAMESSAGEID, isValid(), setRawData(), and cmlabs::DataMessageHeader::size.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setAttachedMessage_1_1SWIG_10(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setAttachedMessage_1_1SWIG_11(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setAttachedMessage_1_1SWIG_12(), cmlabs::PsySpace::queryReply(), setAttachedMessage(), setAttachedMessage(), setAttachedMessageArray(), setAttachedMessageMap(), and UnitTest().

◆ setAttachedMessage() [3/3]

bool cmlabs::DataMessage::setAttachedMessage ( int64 i,
const char * key,
DataMessage * msg )

◆ setAttachedMessageArray()

bool cmlabs::DataMessage::setAttachedMessageArray ( const char * key,
std::map< int64, DataMessage * > & map )

setAttachedMessageArray(const char* key, std::map<int64, DataMessage*>& map) Sets the whole array of attached messages named key in one call.

Each message is copied in; the caller retains ownership of the originals.

Parameters
keyentry name of the array
mapindex → message values to store
Returns
true if successful

Definition at line 2699 of file DataMessage.cpp.

References setAttachedMessage().

◆ setAttachedMessageMap()

bool cmlabs::DataMessage::setAttachedMessageMap ( const char * key,
std::map< std::string, DataMessage * > & map )

sets the user message entry with this key to the provided message

Parameters
key
map
Returns
true if successful

Definition at line 3106 of file DataMessage.cpp.

References setAttachedMessage().

◆ setChainCount()

bool cmlabs::DataMessage::setChainCount ( uint32 count)
inline

setChainCount(uint32 count)

Set number of messages it took to process the trigger message that caused this message to be posted

Parameters
countnumber of messages
Returns
false if the message is not valid
true otherwise

Definition at line 2462 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setChainCount().

◆ setChainCPUTime()

bool cmlabs::DataMessage::setChainCPUTime ( uint32 t)
inline

setChainCPUTime(uint32 t)

Set cpu time in us it took to process the trigger message that caused this message to be posted

Parameters
ttime in us
Returns
false if the message is not valid
true otherwise

Definition at line 2395 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setChainCPUTime().

◆ setChainWallTime()

bool cmlabs::DataMessage::setChainWallTime ( uint32 t)
inline

setChainWallTime(uint32 t)

Set wall time in us it took to process the trigger message that caused this message to be posted

Parameters
ttime in us
Returns
false if the message is not valid
true otherwise

Definition at line 2429 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setChainWallTime().

◆ setContextChange()

bool cmlabs::DataMessage::setContextChange ( PsyContext & context)
inline

setContextChange(PsyContext& context)

Set and return context change entry

Parameters
contextto change to
Returns
false if message is not valid
true else

Definition at line 1967 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by cmlabs::PsyAPI::postOutputMessage(), and cmlabs::MessagePlayer::waitForNextMessage().

◆ setCreatedTime()

bool cmlabs::DataMessage::setCreatedTime ( uint64 t)
inline

◆ setCycleCPUTime()

bool cmlabs::DataMessage::setCycleCPUTime ( uint32 t)
inline

setCycleCPUTime(uint32 t)

Set cpu time in us it took to process the trigger message that caused this message to be posted

Parameters
ttime in us
Returns
false if the message is not valid
true otherwise

Definition at line 2326 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setCycleCPUTime().

◆ setCycleWallTime()

bool cmlabs::DataMessage::setCycleWallTime ( uint32 t)
inline

setCycleWallTime(uint32 t)

Set wall time in us it took to process the trigger message that caused this message to be posted

Parameters
ttime in us
Returns
false if the message is not valid
true otherwise

Definition at line 2360 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setCycleWallTime().

◆ setData() [1/3]

bool cmlabs::DataMessage::setData ( const char * idx,
const char * key,
const char * value,
uint32 size )

sets the user binary data entry with this key + the size

Parameters
idxtextual index for the maps
key
valuethe new value for the data entry
size
Returns
true if successful

Definition at line 2336 of file DataMessage.cpp.

References setData(), and cmlabs::utils::StringFormat().

◆ setData() [2/3]

bool cmlabs::DataMessage::setData ( const char * key,
const char * value,
uint32 size )

◆ setData() [3/3]

bool cmlabs::DataMessage::setData ( int64 i,
const char * key,
const char * value,
uint32 size )

◆ setDestination()

bool cmlabs::DataMessage::setDestination ( uint16 addr)
inline

setDestination(uint16 addr) Set destination to address addr and return new destination

Parameters
addrdefine destination
Returns
true if successful, false otherwise

Definition at line 1726 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setDestination().

◆ setDouble() [1/3]

bool cmlabs::DataMessage::setDouble ( const char * idx,
const char * key,
double value )

sets the user double entry with this key to the value provided

Parameters
idxtextual index for the maps
key
valuethe new value of the double entry
Returns
true if successful

Definition at line 2328 of file DataMessage.cpp.

References setDouble(), and cmlabs::utils::StringFormat().

◆ setDouble() [2/3]

bool cmlabs::DataMessage::setDouble ( const char * key,
double value )

setDouble(const char* key, double value)

Sets (creating or overwriting) the user floating-point entry named key.

Parameters
keyentry name
valuevalue to store
Returns
true if successful, false otherwise (usually because the message is not valid)

Definition at line 1941 of file DataMessage.cpp.

References DOUBLEID, and setRawData().

Referenced by fillInDraftUserDataFrom(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setDouble_1_1SWIG_10(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setDouble_1_1SWIG_11(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setDouble_1_1SWIG_12(), setDouble(), setDouble(), setDoubleArray(), setDoubleMap(), and UnitTest().

◆ setDouble() [3/3]

bool cmlabs::DataMessage::setDouble ( int64 i,
const char * key,
double value )

setDouble(int64 i, const char* key, double value)

Parameters
i
key
value

Definition at line 2233 of file DataMessage.cpp.

References setDouble(), and cmlabs::utils::StringFormat().

◆ setDoubleArray()

bool cmlabs::DataMessage::setDoubleArray ( const char * key,
std::map< int64, double > & map )

setDoubleArray(const char* key, std::map<int64, double>& map) Sets the whole double array named key in one call.

Parameters
keyentry name of the array
mapindex → double values to store
Returns
true if successful

Definition at line 2679 of file DataMessage.cpp.

References setDouble().

Referenced by UnitTest().

◆ setDoubleMap()

bool cmlabs::DataMessage::setDoubleMap ( const char * key,
std::map< std::string, double > & map )

sets the user double entry with this key to the value provided

Parameters
keyentry key
mapmap of values to store
Returns
true if successful

Definition at line 3086 of file DataMessage.cpp.

References setDouble().

◆ setEOL()

bool cmlabs::DataMessage::setEOL ( uint64 eol)
inline

setEOL(uint64 eol)

Calculates and sets the equivalent ttl for the message

Parameters
eolthe time at which the message is no longer supposed to exist
Returns
false if the message is not valid
true

Definition at line 2042 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setEOL(), and cmlabs::MemoryManager::UnitTest().

◆ setFloat() [1/3]

bool cmlabs::DataMessage::setFloat ( const char * idx,
const char * key,
float64 value )

sets the user float entry with this key to the value provided

Parameters
idxtextual index for the maps
key
valuethe new value of the float entry
Returns
true if successful

Definition at line 2332 of file DataMessage.cpp.

References setFloat(), and cmlabs::utils::StringFormat().

◆ setFloat() [2/3]

bool cmlabs::DataMessage::setFloat ( const char * key,
float64 value )

setFloat(const char* key, float64 value)

Sets (creating or overwriting) the user floating-point entry named key. float64 is a typedef for double, so this is equivalent to setDouble().

Parameters
keyentry name
valuevalue to store
Returns
true if successful, false otherwise (usually because the message is not valid)

Definition at line 1946 of file DataMessage.cpp.

References DOUBLEID, and setRawData().

Referenced by cmlabs::PostSpec::addContentToMsg(), cmlabs::Internal_MessageScript(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setFloat_1_1SWIG_10(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setFloat_1_1SWIG_11(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setFloat_1_1SWIG_12(), cmlabs::Observations_UnitTest(), setFloat(), setFloat(), setFloatArray(), setFloatMap(), and UnitTest().

◆ setFloat() [3/3]

bool cmlabs::DataMessage::setFloat ( int64 i,
const char * key,
float64 value )

setFloat(int64 i, const char* key, float64 value)

Parameters
i
key
value

Definition at line 2237 of file DataMessage.cpp.

References setFloat(), and cmlabs::utils::StringFormat().

◆ setFloatArray()

bool cmlabs::DataMessage::setFloatArray ( const char * key,
std::map< int64, float64 > & map )

setFloatArray(const char* key, std::map<int64, float64>& map) Sets the whole float array named key in one call.

Parameters
keyentry name of the array
mapindex → float values to store
Returns
true if successful

Definition at line 2689 of file DataMessage.cpp.

References setFloat().

◆ setFloatMap()

bool cmlabs::DataMessage::setFloatMap ( const char * key,
std::map< std::string, float64 > & map )

sets the user float entry with this key to the value provided

Parameters
keyentry key
mapmap of values to store
Returns
true if successful

Definition at line 3096 of file DataMessage.cpp.

References setFloat().

◆ setFrom()

◆ setInt() [1/3]

bool cmlabs::DataMessage::setInt ( const char * idx,
const char * key,
int64 value )

sets the user integer entry with this key to the value provided

Parameters
idxtextual index for the maps
key
valuethe new value of the integer entry
Returns
true if successful

Definition at line 2324 of file DataMessage.cpp.

References setInt(), and cmlabs::utils::StringFormat().

◆ setInt() [2/3]

bool cmlabs::DataMessage::setInt ( const char * key,
int64 value )

setInt(const char* key, int64 value)

Sets (creating or overwriting) the user integer entry named key.

Parameters
keyentry name
valueinteger value to store
Returns
true if successful, false otherwise (usually because the message is not valid)

Definition at line 1937 of file DataMessage.cpp.

References INTID, and setRawData().

Referenced by cmlabs::PostSpec::addContentToMsg(), cmlabs::HTTPRequest::convertToMessage(), cmlabs::RequestClient::CreateRequestMessage(), fillInDraftUserDataFrom(), cmlabs::RESTRequest::getStorageMessageCopy(), cmlabs::Internal_BitmapPoster(), cmlabs::Internal_MessageScript(), cmlabs::Internal_RetrieveTest(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setInt_1_1SWIG_10(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setInt_1_1SWIG_11(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setInt_1_1SWIG_12(), cmlabs::Observations_UnitTest(), cmlabs::PsyAPI::queryCatalog(), cmlabs::PsyAPI::queryCatalog(), cmlabs::PsyAPI::queryRemoteCatalog(), cmlabs::PsyAPI::queryReply(), cmlabs::RequestGateway::receiveWebsocketData(), cmlabs::RequestExecutor::sendStatusNow(), setInt(), setInt(), setIntArray(), setIntMap(), cmlabs::Bitmap::toMessage(), cmlabs::ComponentMemory::UnitTest(), UnitTest(), cmlabs::MemoryManager::UnitTest(), cmlabs::MessageIndex::UnitTest(), cmlabs::RESTParser::UnitTest(), cmlabs::ComponentInfoStruct::writeToMsg(), cmlabs::ContextMapEntry::writeToMsg(), cmlabs::CrankMapEntry::writeToMsg(), cmlabs::TagMapEntry::writeToMsg(), and cmlabs::TypeMapEntry::writeToMsg().

◆ setInt() [3/3]

bool cmlabs::DataMessage::setInt ( int64 i,
const char * key,
int64 value )

setInt(int64 i, const char* key, int64 value)

Parameters
i
key
value

Definition at line 2229 of file DataMessage.cpp.

References setInt(), and cmlabs::utils::StringFormat().

◆ setIntArray()

bool cmlabs::DataMessage::setIntArray ( const char * key,
std::map< int64, int64 > & map )

setIntArray(const char* key, std::map<int64, int64>& map) Sets the whole integer array named key in one call.

Parameters
keyentry name of the array
mapindex → integer values to store
Returns
true if successful

Definition at line 2669 of file DataMessage.cpp.

References setInt().

Referenced by UnitTest().

◆ setIntMap()

bool cmlabs::DataMessage::setIntMap ( const char * key,
std::map< std::string, int64 > & map )

sets the user integer entry with this key

Parameters
key
map
Returns
true if successful

Definition at line 3076 of file DataMessage.cpp.

References setInt().

Referenced by UnitTest().

◆ setMemID()

bool cmlabs::DataMessage::setMemID ( uint64 id)
inline

setMemID(uint64 id) Set memory ID to id

Parameters
idmemory id
Returns
true if successful, false otherwise

Definition at line 1847 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setMemID().

◆ setMultiple()

bool cmlabs::DataMessage::setMultiple ( uint32 from,
uint32 to,
uint32 tag,
uint64 ttl,
uint8 policy,
uint64 sendtime )
inline

setMultiple(uint32 from, uint32 to, uint32 tag, uint64 ttl, uint8 policy, uint64 sendtime) Set multiple information for a message at the same time

Parameters
fromthe sender id
tothe receiver id
tagthe message's tag id
ttlthe message's time-to-live in microseconds
policythe policy id
sendtimethe timestamp of the sending of the message
Returns
true if successful, false otherwise

Definition at line 1753 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setMultiple(), and cmlabs::PsyAPI::postOutputMessage().

◆ setOrigin()

bool cmlabs::DataMessage::setOrigin ( uint16 addr)
inline

setOrigin(uint16 addr) Set origin to address addr and return new origin

Parameters
addrdefine origin
Returns
true if successful, false otherwise

Definition at line 1715 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setOrigin().

◆ setPolicy()

bool cmlabs::DataMessage::setPolicy ( uint8 policy)
inline

setPolicy(uint8 policy)

Sets the policy id of the message

Parameters
policy
Returns
false if the message is not valid
true else

Definition at line 2114 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setPolicy().

◆ setPriority()

bool cmlabs::DataMessage::setPriority ( uint16 priority)
inline

setPriority(uint16 priority)

Set message priority to priority Messages have a prority that determines their relative order of scheduling

Parameters
priority
Returns
false if the message is not valid
true else

Definition at line 2082 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setPriority().

◆ setRawData()

bool cmlabs::DataMessage::setRawData ( const char * key,
const char * value,
uint32 size,
uint32 datatype )
protected

Internal: low-level entry writer used by all typed set...() overloads.

Parameters
keyentry name
valuepayload bytes to copy in
sizepayload size in bytes
datatypecontent type id for the entry (see ObjectIDs.h)
Returns
true if successful

Definition at line 1960 of file DataMessage.cpp.

References CONSTCHARID, data, findEntry(), findSpace(), invalidateFindKeyCache(), removeEntry(), and cmlabs::utils::strcpyavail().

Referenced by copyUserEntriesFromMessage(), fillInDraftUserDataFrom(), setAttachedMessage(), setData(), setDouble(), setFloat(), setInt(), setString(), and setTime().

◆ setRecvTime()

bool cmlabs::DataMessage::setRecvTime ( uint64 time)
inline

setRecvTime(uint64 time)

Set new receiving time time

Parameters
timereceiving time
Returns
false if the message is not valid
true else

Definition at line 2176 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by cmlabs::HTTPRequest::convertToMessage(), cmlabs::JSONM::convertToMessage(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setRecvTime(), cmlabs::TestRequestExecutor::longRequestRun(), and cmlabs::RequestGateway::receiveMessage().

◆ setReference()

◆ setSendTime()

bool cmlabs::DataMessage::setSendTime ( uint64 time)
inline

setSendTime(uint64 time)

Set message sendtime to time

Parameters
timeSendtime
Returns
false if the message is not valid
true else

Definition at line 2145 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setSendTime(), cmlabs::RequestExecutor::waitForLongRequest(), and cmlabs::RequestExecutor::waitForShortRequest().

◆ setSerial()

bool cmlabs::DataMessage::setSerial ( uint64 serial)
inline

setSerial(uint64 serial)

Set message serial number

Parameters
serial
Returns
false if the message is not valid
true else

Definition at line 2269 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by cmlabs::Internal_BitmapPoster(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setSerial(), and cmlabs::TemporalMemory::UnitTest().

◆ setStatus()

bool cmlabs::DataMessage::setStatus ( uint16 status)
inline

setStatus(uint16 status)

Set message status

Parameters
statusmessage status
Returns
false if the message is not valid
true else

Definition at line 2239 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setStatus(), cmlabs::PsySpace::queryReply(), cmlabs::RequestGateway::replyToClient(), and cmlabs::Test_RequestClient().

◆ setString() [1/3]

bool cmlabs::DataMessage::setString ( const char * idx,
const char * key,
const char * value )

sets the user string entry with this key to the value provided

Parameters
idxtextual index for the maps
key
valuethe new value of the string entry
Returns
true if successful

Definition at line 2320 of file DataMessage.cpp.

References setString(), and cmlabs::utils::StringFormat().

◆ setString() [2/3]

bool cmlabs::DataMessage::setString ( const char * key,
const char * value )

setString(const char* key, const char* value)

Sets (creating or overwriting) the user string entry named key. The string is copied into the message; the caller keeps ownership of value.

Parameters
keyentry name
valueNUL-terminated string to store
Returns
true if successful, false otherwise (usually because the message is not valid)

Definition at line 1927 of file DataMessage.cpp.

References CONSTCHARID, and setRawData().

Referenced by cmlabs::PostSpec::addContentToMsg(), cmlabs::RequestClient::addGateway(), cmlabs::RequestExecutor::addGateway(), cmlabs::PsySpace::addPsyProbeCustomView(), cmlabs::RequestGateway::addRequestReplyToRequestQueue(), cmlabs::PsyAPI::addSubscription(), cmlabs::RequestGateway::addToRequestQueue(), cmlabs::RequestGateway::callExternalAPI(), cmlabs::HTTPRequest::convertToMessage(), cmlabs::JSONM::convertToMessage(), cmlabs::RequestClient::CreateRequestMessage(), fillInDraftUserDataFrom(), cmlabs::RESTRequest::getStorageMessageCopy(), cmlabs::Internal_BitmapPoster(), cmlabs::Internal_MessageScript(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setString_1_1SWIG_10(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setString_1_1SWIG_11(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setString_1_1SWIG_12(), cmlabs::PsyAPI::queryCatalog(), cmlabs::PsyAPI::queryCatalog(), cmlabs::PsyAPI::queryRemoteCatalog(), cmlabs::RequestGateway::receiveWebsocketData(), cmlabs::TestRequestClient::run(), cmlabs::RequestGateway::runExec(), cmlabs::RequestGateway::sendRestartToExecutor(), cmlabs::RequestClient::sendStatusNow(), cmlabs::RequestExecutor::sendStatusNow(), setString(), setString(), setStringArray(), setStringMap(), cmlabs::Test_RequestClient(), cmlabs::ComponentMemory::UnitTest(), UnitTest(), cmlabs::ProcessMemory::UnitTest(), cmlabs::RequestGateway::UnitTest(), cmlabs::RESTParser::UnitTest(), cmlabs::NetworkManager::UnitTestDelayedConnect(), cmlabs::ComponentMemory::writeComponentNamesToMsg(), cmlabs::ContextMapEntry::writeIDToMsg(), cmlabs::CrankMapEntry::writeIDToMsg(), cmlabs::TagMapEntry::writeIDToMsg(), cmlabs::TypeMapEntry::writeIDToMsg(), cmlabs::MessagePlayer::writeMetadata(), cmlabs::ComponentInfoStruct::writeToMsg(), cmlabs::ContextMapEntry::writeToMsg(), cmlabs::CrankMapEntry::writeToMsg(), cmlabs::TagMapEntry::writeToMsg(), and cmlabs::TypeMapEntry::writeToMsg().

◆ setString() [3/3]

bool cmlabs::DataMessage::setString ( int64 i,
const char * key,
const char * value )

◆ setStringArray()

bool cmlabs::DataMessage::setStringArray ( const char * key,
std::map< int64, std::string > & map )

setStringArray(const char* key, std::map<int64, std::string>& map) Sets the whole string array named key in one call.

Parameters
keyentry name of the array
mapindex → string values to store
Returns
true if successful

Definition at line 2659 of file DataMessage.cpp.

References setString().

Referenced by UnitTest().

◆ setStringMap()

bool cmlabs::DataMessage::setStringMap ( const char * key,
std::map< std::string, std::string > & map )

sets the user string entry with this key

Parameters
key
map
Returns
true if successful

Definition at line 3066 of file DataMessage.cpp.

References setString().

Referenced by UnitTest().

◆ setSystemID()

bool cmlabs::DataMessage::setSystemID ( uint32 id)
inline

setSystemID(uint32 id) Set message system id

Parameters
id
Returns
true if successful, false otherwise

Definition at line 1826 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setSystemID(), and cmlabs::Observations_UnitTest().

◆ setTag()

bool cmlabs::DataMessage::setTag ( uint32 tag)
inline

setTag(uint32 tag)

Sets message tag to tag Tags can be used to segment data temporally, i.e. a module may only be interested in camera data referencing a specific object or event.

Parameters
tagdefines message tag
Returns
true if successful, false otherwise

Definition at line 1785 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by cmlabs::Internal_QueryTest(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setTag(), cmlabs::PsyAPI::postOutputMessage(), and cmlabs::TimeQueue::waitForNextEvent().

◆ setTime() [1/3]

bool cmlabs::DataMessage::setTime ( const char * idx,
const char * key,
uint64 value )

sets the user time entry with this key to the value provided

Parameters
idxtextual index for the maps
key
valuethe value of the time entry
Returns
true if successful

Definition at line 2316 of file DataMessage.cpp.

References setTime(), and cmlabs::utils::StringFormat().

◆ setTime() [2/3]

bool cmlabs::DataMessage::setTime ( const char * key,
uint64 value )

◆ setTime() [3/3]

bool cmlabs::DataMessage::setTime ( int64 i,
const char * key,
uint64 value )

setTime(int64 i, const char* key, uint64 value)

Parameters
i
key
value

Definition at line 2221 of file DataMessage.cpp.

References setTime(), and cmlabs::utils::StringFormat().

◆ setTimeArray()

bool cmlabs::DataMessage::setTimeArray ( const char * key,
std::map< int64, uint64 > & map )

setTimeArray(const char* key, std::map<int64, uint64>& map) Sets the whole time array named key in one call.

Parameters
keyentry name of the array
mapindex → time (microseconds) values to store
Returns
true if successful

Definition at line 2649 of file DataMessage.cpp.

References setTime().

Referenced by UnitTest().

◆ setTimeMap()

bool cmlabs::DataMessage::setTimeMap ( const char * key,
std::map< std::string, uint64 > & map )

sets the user time entry with this key

Parameters
key
map
Returns
true if successful

Definition at line 3056 of file DataMessage.cpp.

References setTime().

Referenced by UnitTest().

◆ setTo()

bool cmlabs::DataMessage::setTo ( uint32 to)
inline

◆ setTTL()

bool cmlabs::DataMessage::setTTL ( uint64 ttl)
inline

setTTL(uint64 ttl)

Sets time to live for a message in microseconds Messages in Psyclone 2.0 live for a finite amount of time inside the shared memory, If ttl = 0 the message will only be delivered to whoever has subscribed to it and after this seize to exist.

Parameters
ttltime-to-live in microseconds
Returns
false if message is not valid
true else

Definition at line 2024 of file DataMessage.h.

References data, and DATAMESSAGEID.

Referenced by Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1setTTL(), cmlabs::PsySpace::queryReply(), cmlabs::MessageIndex::UnitTest(), and cmlabs::TemporalMemory::UnitTest().

◆ setType()

bool cmlabs::DataMessage::setType ( PsyType & type)
inline

◆ swapMessageData()

const char * cmlabs::DataMessage::swapMessageData ( const char * data)

swapMessageData(const char* data)

Internal function: replaces this message's memory block with data, returning the previous block so the caller can dispose of or reuse it. Used by the runtime to move message ownership without copying.

Parameters
datathe new binary message block to adopt
Returns
the previous message block (caller becomes responsible for it)

Definition at line 1549 of file DataMessage.cpp.

References data, and invalidateFindKeyCache().

Referenced by getUserEntriesAsJSON(), Java_com_cmlabs_cmsdk_cmsdkJNI_DataMessage_1swapMessageData(), cmlabs::ComponentStats::toXML(), toXML(), and cmlabs::ProcessStats::toXML().

◆ toCSV()

std::string cmlabs::DataMessage::toCSV ( const char * separator = NULL,
const char * preample = NULL,
std::map< uint16, std::string > * subtypes = NULL,
std::map< uint16, std::string > * subcontexts = NULL,
std::map< uint32, std::string > * compNames = NULL )

toCSV()

Parameters
separatorthe separator character, defaults to comma
preamplestring with entries to add before the standard list <preample>,type,created,sent,received,...
subtypesoptional map of subtype id to name used for textual output
subcontextsoptional map of subcontext id to name used for textual output
compNamesoptional map of component id to name used for textual output Returns the CSV representation of the full message including a textual description of all user entries

Definition at line 745 of file DataMessage.cpp.

References data, getUserEntriesAsString(), cmlabs::PrintTimeString(), cmlabs::utils::StringFormat(), and cmlabs::utils::StringSingleReplace().

Referenced by cmlabs::MessagePlayer::exportToCSV(), and UnitTest().

◆ toJSON()

std::string cmlabs::DataMessage::toJSON ( std::map< uint16, std::string > * subtypes = NULL,
std::map< uint16, std::string > * subcontexts = NULL,
std::map< uint32, std::string > * compNames = NULL )

toJSON()

Returns the JSON representation of the full message including all user entries, arrays and maps - and including the JSON representation of any attached messages

Definition at line 684 of file DataMessage.cpp.

References CONSTCHARID, data, DATAMESSAGEDRAFTID, DATAMESSAGEID, getUserEntriesAsJSON(), cmlabs::PrintTimeString(), cmlabs::DataMessageEntryHeader::size, and cmlabs::utils::StringFormat().

Referenced by getUserEntriesAsJSON(), cmlabs::MessagePlayer::printAllString(), and UnitTest().

◆ toXML()

std::string cmlabs::DataMessage::toXML ( std::map< uint16, std::string > * subtypes = NULL,
std::map< uint16, std::string > * subcontexts = NULL,
std::map< uint32, std::string > * compNames = NULL )

◆ UnitTest()

Member Data Documentation

◆ _lastFindKey

std::string cmlabs::DataMessage::_lastFindKey
mutable

Internal: last key looked up (single-entry lookup cache; mutable so const-style getters can update it).

Definition at line 2505 of file DataMessage.h.

Referenced by findKey(), and invalidateFindKeyCache().

◆ _lastFindKeyResult

char* cmlabs::DataMessage::_lastFindKeyResult = NULL
mutable

Internal: cached location of the last key's entry inside the block; NULL if not found.

Definition at line 2506 of file DataMessage.h.

Referenced by _wrap_DataMessage__lastFindKeyResult_set(), findKey(), and invalidateFindKeyCache().

◆ data

DataMessageHeader* cmlabs::DataMessage::data

Pointer to the message's flat memory block (header + user entries).

This is the actual message: copying these data->size bytes reproduces the message exactly. May be reallocated whenever entries are added or resized, invalidating any pointers previously returned by getString()/getData().

Definition at line 2503 of file DataMessage.h.

Referenced by cmlabs::ComponentData::AddComponentStats(), cmlabs::ComponentMemory::addComponentStats(), cmlabs::RequestClient::addGateway(), cmlabs::RequestExecutor::addGateway(), addTimeUsage(), cmlabs::ProcessMemory::addToProcessStats(), cmlabs::MemoryRequestQueues::AddToQueue(), ConvertDataFromOlderMessageFormat(), copyUserEntriesFromMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), DataMessage(), deleteEntry(), fillInDraftUserDataFrom(), findKey(), findSpace(), getArraySize(), getAsFloatArray(), getAsFloatMap(), getAsIntArray(), getAsIntMap(), getAsString(), getAsStringArray(), getAsStringMap(), getAttachedMessageArray(), getAttachedMessageMap(), getChainCount(), getChainCPUTime(), getChainWallTime(), getContextChange(), getCreatedTime(), getCycleCPUTime(), getCycleWallTime(), getDataCopy(), getDestination(), getDoubleArray(), getDoubleMap(), getEOL(), getFloatArray(), getFloatMap(), getFrom(), getIntArray(), getIntMap(), getKeyType(), getMapSize(), getMemID(), getOrigin(), getPolicy(), getPriority(), getRawData(), getRecvTime(), getReference(), getSendTime(), getSerial(), getSize(), getStatus(), getStringArray(), getStringMap(), getSystemID(), getTag(), getTimeArray(), getTimeMap(), getTo(), getTTL(), getType(), getUserCount(), getUserEntriesAsJSON(), getUserEntriesAsString(), getUserSize(), cmlabs::TemporalMemory::insertMessage(), cmlabs::Internal_StatsLog(), isArrayContent(), isMapContent(), isValid(), cmlabs::PsySpace::postMessage(), removeEntry(), cmlabs::MessageProtocol::SendMessage(), setAttachedMessage(), setChainCount(), setChainCPUTime(), setChainWallTime(), setContextChange(), setCreatedTime(), setCycleCPUTime(), setCycleWallTime(), setDestination(), setEOL(), setFrom(), setMemID(), setMultiple(), setOrigin(), setPolicy(), setPriority(), setRawData(), setRecvTime(), setReference(), setSendTime(), setSerial(), setStatus(), setSystemID(), cmlabs::MessagePlayer::setSystemIDs(), setTag(), setTo(), setTTL(), setType(), swapMessageData(), toCSV(), toJSON(), toXML(), cmlabs::NetworkManager::UnitTestDelayedConnect(), cmlabs::PsyAPI::waitForNewMessage(), cmlabs::PsySpace::waitForSignal(), cmlabs::MessagePlayer::writeMetadata(), and ~DataMessage().


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