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

Typed "observation" records extracted from DataMessages: location, dimension, integer, float, time and string observations. More...

#include "DataMessage.h"
#include "Observations.tpl.h"
Include dependency graph for Observations.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cmlabs::ObsEntry
 Declarative description of one observation source: name, observation type, trigger expression and field-name mappings. More...
struct  cmlabs::cmpObsEntry
 Comparator matching ObsEntry records by name only (used for de-duplication in containers). More...
struct  cmlabs::ObsHeader
 Fixed-size header preceding every observation payload: sizes/ids, provenance (creator, object, topic), type tag, name and confidence/consensus scores. More...
struct  cmlabs::ObsLocation
 6-DOF pose observation: position (x,y,z), orientation (pitch,roll,yaw), size and owning map id. More...
struct  cmlabs::ObsDimension
 Extent observation (w,h,d). More...
struct  cmlabs::ObsInteger
 Scalar integer observation. More...
struct  cmlabs::ObsFloat
 Scalar float observation. More...
struct  cmlabs::ObsTime
 Timestamp observation (ms epoch). More...
struct  cmlabs::ObsString
 Fixed-buffer (1023 chars + NUL) string observation; comparisons are case-insensitive lexicographic. More...
class  cmlabs::GenericObservation< T >
 Header + typed payload wrapper for one observation, serializable to/from DataMessage and raw memory. More...

Namespaces

namespace  cmlabs

Macros

#define OBSID_LOC   1
#define OBSID_DIM   2
#define OBSID_INT   3
#define OBSID_FLOAT   4
#define OBSID_TIME   5
#define OBSID_STRING   6
#define OBSID_COUNT   6
 Number of defined observation type ids (OBSID_LOC..OBSID_STRING).

Functions

int64 cmlabs::ExtractIntFromMessage (const char *name, DataMessage *msg, std::map< std::string, std::string > &mappings, bool &ok)
 Read an integer field from a message, translating name through mappings first.
float64 cmlabs::ExtractFloatFromMessage (const char *name, DataMessage *msg, std::map< std::string, std::string > &mappings, bool &ok)
 Float variant of ExtractIntFromMessage(); same mapping semantics.
uint64 cmlabs::ExtractTimeFromMessage (const char *name, DataMessage *msg, std::map< std::string, std::string > &mappings, bool &ok)
 Timestamp variant of ExtractIntFromMessage(); same mapping semantics.
std::string cmlabs::ExtractStringFromMessage (const char *name, DataMessage *msg, std::map< std::string, std::string > &mappings, bool &ok)
 String variant of ExtractIntFromMessage(); same mapping semantics.
uint32 cmlabs::GetObsTypeFromRawData (const char *data, uint32 size)
 Inspect a raw observation blob and return its OBSID_* type tag from the embedded ObsHeader.
bool cmlabs::Observations_UnitTest ()
 Unit test for the Observations module.
void cmlabs::Register_Observations_Tests ()
 Register the Observations tests with the unit test framework.

Detailed Description

Typed "observation" records extracted from DataMessages: location, dimension, integer, float, time and string observations.

An observation is a small POD payload (Obs* struct) plus an ObsHeader with identity, provenance and confidence, wrapped by GenericObservation<T>. Field-name mappings let heterogeneous sensor messages populate the same observation type: the Extract*FromMessage() helpers first look the logical field name up in the mapping table, then read the mapped field from the message. Range queries are supported via extractRangeFrom()/extractRangeTo() and isBetween(). Template bodies live in Observations.tpl.h.

Definition in file Observations.h.

Macro Definition Documentation

◆ OBSID_COUNT

#define OBSID_COUNT   6

Number of defined observation type ids (OBSID_LOC..OBSID_STRING).

Definition at line 339 of file Observations.h.

◆ OBSID_DIM

#define OBSID_DIM   2

Definition at line 138 of file Observations.h.

Referenced by cmlabs::ObsDimension::getType().

◆ OBSID_FLOAT

#define OBSID_FLOAT   4

Definition at line 229 of file Observations.h.

Referenced by cmlabs::ObsFloat::getType(), and cmlabs::Observations_UnitTest().

◆ OBSID_INT

#define OBSID_INT   3

Definition at line 197 of file Observations.h.

Referenced by cmlabs::ObsInteger::getType(), and cmlabs::Observations_UnitTest().

◆ OBSID_LOC

#define OBSID_LOC   1

Definition at line 59 of file Observations.h.

Referenced by cmlabs::ObsLocation::getType(), and cmlabs::Observations_UnitTest().

◆ OBSID_STRING

#define OBSID_STRING   6

Definition at line 293 of file Observations.h.

Referenced by cmlabs::ObsString::getType().

◆ OBSID_TIME

#define OBSID_TIME   5

Definition at line 261 of file Observations.h.

Referenced by cmlabs::ObsTime::getType().