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

Legacy accessor wrapping one component record inside a shared page. More...

#include <ComponentData.h>

Public Member Functions

 ComponentData (char *data)
 Wrap an existing raw component record.
 ~ComponentData ()
bool disconnect ()
bool destroyComponent ()
bool resize (uint32 increase)
uint32 getAvailableDataSize ()
bool setPrivateData (const char *name, const char *data, uint32 size)
uint32 getPrivateDataSize (const char *name)
bool getPrivateDataCopy (const char *name, char *data, uint32 maxSize)
bool replacePrivateData (const char *name, const char *data, uint32 size)
bool replacePrivateData (const char *name, const char *data, uint32 size, uint32 offset)
bool deletePrivateData (const char *name)
bool createParameter (const char *name, const char *val, const char *defaultValue=NULL)
bool createParameter (const char *name, const char *val, uint32 count, uint32 defaultIndex)
bool createParameter (const char *name, std::vector< std::string > values, const char *defaultValue=NULL)
bool createParameter (const char *name, int64 *val, uint32 count, uint32 defaultIndex)
bool createParameter (const char *name, std::vector< std::string > values, int64 defaultValue=0)
bool createParameter (const char *name, float64 *val, uint32 count, uint32 defaultIndex)
bool createParameter (const char *name, std::vector< std::string > values, float64 defaultValue=0)
bool createParameter (const char *name, int64 val, int64 min=0, int64 max=0, int64 interval=0)
bool createParameter (const char *name, float64 val, float64 min=0, float64 max=0, float64 interval=0)
bool hasParameter (const char *name)
bool deleteParameter (const char *name)
uint8 getParameterDataType (const char *name)
uint32 getParameterValueSize (const char *name)
bool getParameter (const char *name, char *val, uint32 maxSize)
bool getParameter (const char *name, int64 &val)
bool getParameter (const char *name, float64 &val)
bool setParameter (const char *name, const char *val)
bool setParameter (const char *name, int64 val)
bool setParameter (const char *name, float64 val)
bool resetParameter (const char *name)
bool tweakParameter (const char *name, int32 tweak)

Static Public Member Functions

static bool UnitTest ()
 Self-test.
static ComponentDataCreateComponent (uint32 id, const char *name, uint32 size, uint16 nodeID, uint16 procID)
static bool RecordRemoteComponent (uint32 id, const char *name, uint16 nodeID, uint64 time)
static bool ReserveComponentID (uint32 id, const char *name)
static bool DestroyComponent (uint32 cid)
static ComponentDataGetComponentData (uint32 cid)
static bool GetComponentName (uint32 cid, char *name, uint32 maxNameLen)
static bool GetComponentID (const char *name, uint32 &cid)
static ComponentStats GetComponentStats (uint32 cid)
static bool SetComponentStats (uint32 cid, ComponentStats &stats)
static bool IsComponentLocal (uint32 cid)
static bool IsComponentLocal (const char *name)
static uint16 GetComponentNodeID (uint32 cid)
static uint16 GetComponentProcessID (uint32 cid)
static char * GetAndRemoveComponent (uint32 cid, uint32 &dataSize)
static bool AddExistingComponent (uint32 cid, uint16 nodeID, uint16 procID, char *oldData, uint32 dataSize)
static bool UpdateRemoteComponent (uint32 cid, uint16 nodeID, uint16 procID, const char *name)
static bool AddComponentStats (uint32 cid, uint64 userCPU, uint64 kernelCPU, DataMessage *inputMsg, DataMessage *outputMsg, uint32 runCount)

Detailed Description

Legacy accessor wrapping one component record inside a shared page.

Static functions operate on the shared component map / page allocator; instance methods operate on the record wrapped at construction. Pointers returned by the static Get* functions point into shared memory and follow the legacy locking rules of MemoryManagerX. Superseded by ComponentMemory.

Definition at line 137 of file ComponentData.h.

Constructor & Destructor Documentation

◆ ComponentData()

cmlabs::ComponentData::ComponentData ( char * data)

Wrap an existing raw component record.

Parameters
dataMapped record address (not owned).

Definition at line 478 of file ComponentData.cpp.

Referenced by CreateComponent(), DestroyComponent(), GetComponentData(), RecordRemoteComponent(), ReserveComponentID(), and UnitTest().

◆ ~ComponentData()

cmlabs::ComponentData::~ComponentData ( )

Definition at line 482 of file ComponentData.cpp.

References disconnect().

Member Function Documentation

◆ AddComponentStats()

bool cmlabs::ComponentData::AddComponentStats ( uint32 cid,
uint64 userCPU,
uint64 kernelCPU,
DataMessage * inputMsg,
DataMessage * outputMsg,
uint32 runCount )
static

◆ AddExistingComponent()

bool cmlabs::ComponentData::AddExistingComponent ( uint32 cid,
uint16 nodeID,
uint16 procID,
char * oldData,
uint32 dataSize )
static

Definition at line 144 of file ComponentData.cpp.

◆ CreateComponent()

ComponentData * cmlabs::ComponentData::CreateComponent ( uint32 id,
const char * name,
uint32 size,
uint16 nodeID,
uint16 procID )
static

◆ createParameter() [1/9]

bool cmlabs::ComponentData::createParameter ( const char * name,
const char * val,
const char * defaultValue = NULL )

◆ createParameter() [2/9]

bool cmlabs::ComponentData::createParameter ( const char * name,
const char * val,
uint32 count,
uint32 defaultIndex )

◆ createParameter() [3/9]

bool cmlabs::ComponentData::createParameter ( const char * name,
float64 * val,
uint32 count,
uint32 defaultIndex )

◆ createParameter() [4/9]

bool cmlabs::ComponentData::createParameter ( const char * name,
float64 val,
float64 min = 0,
float64 max = 0,
float64 interval = 0 )

◆ createParameter() [5/9]

bool cmlabs::ComponentData::createParameter ( const char * name,
int64 * val,
uint32 count,
uint32 defaultIndex )

◆ createParameter() [6/9]

bool cmlabs::ComponentData::createParameter ( const char * name,
int64 val,
int64 min = 0,
int64 max = 0,
int64 interval = 0 )

◆ createParameter() [7/9]

bool cmlabs::ComponentData::createParameter ( const char * name,
std::vector< std::string > values,
const char * defaultValue = NULL )

Definition at line 780 of file ComponentData.cpp.

References createParameter().

◆ createParameter() [8/9]

bool cmlabs::ComponentData::createParameter ( const char * name,
std::vector< std::string > values,
float64 defaultValue = 0 )

Definition at line 812 of file ComponentData.cpp.

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

◆ createParameter() [9/9]

bool cmlabs::ComponentData::createParameter ( const char * name,
std::vector< std::string > values,
int64 defaultValue = 0 )

Definition at line 798 of file ComponentData.cpp.

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

◆ deleteParameter()

bool cmlabs::ComponentData::deleteParameter ( const char * name)

Definition at line 992 of file ComponentData.cpp.

Referenced by setParameter(), and UnitTest().

◆ deletePrivateData()

bool cmlabs::ComponentData::deletePrivateData ( const char * name)

Definition at line 656 of file ComponentData.cpp.

Referenced by replacePrivateData(), and UnitTest().

◆ DestroyComponent()

bool cmlabs::ComponentData::DestroyComponent ( uint32 cid)
static

Definition at line 209 of file ComponentData.cpp.

References ComponentData(), destroyComponent(), and GetComponentData().

◆ destroyComponent()

bool cmlabs::ComponentData::destroyComponent ( )

Definition at line 523 of file ComponentData.cpp.

Referenced by DestroyComponent(), and UnitTest().

◆ disconnect()

bool cmlabs::ComponentData::disconnect ( )

Definition at line 486 of file ComponentData.cpp.

Referenced by ~ComponentData().

◆ GetAndRemoveComponent()

char * cmlabs::ComponentData::GetAndRemoveComponent ( uint32 cid,
uint32 & dataSize )
static

Definition at line 125 of file ComponentData.cpp.

◆ getAvailableDataSize()

uint32 cmlabs::ComponentData::getAvailableDataSize ( )

Definition at line 494 of file ComponentData.cpp.

Referenced by UnitTest().

◆ GetComponentData()

ComponentData * cmlabs::ComponentData::GetComponentData ( uint32 cid)
static

◆ GetComponentID()

bool cmlabs::ComponentData::GetComponentID ( const char * name,
uint32 & cid )
static

◆ GetComponentName()

bool cmlabs::ComponentData::GetComponentName ( uint32 cid,
char * name,
uint32 maxNameLen )
static

◆ GetComponentNodeID()

uint16 cmlabs::ComponentData::GetComponentNodeID ( uint32 cid)
static

◆ GetComponentProcessID()

uint16 cmlabs::ComponentData::GetComponentProcessID ( uint32 cid)
static

◆ GetComponentStats()

ComponentStats cmlabs::ComponentData::GetComponentStats ( uint32 cid)
static

Definition at line 410 of file ComponentData.cpp.

◆ getParameter() [1/3]

bool cmlabs::ComponentData::getParameter ( const char * name,
char * val,
uint32 maxSize )

◆ getParameter() [2/3]

bool cmlabs::ComponentData::getParameter ( const char * name,
float64 & val )

◆ getParameter() [3/3]

bool cmlabs::ComponentData::getParameter ( const char * name,
int64 & val )

◆ getParameterDataType()

uint8 cmlabs::ComponentData::getParameterDataType ( const char * name)

Definition at line 1015 of file ComponentData.cpp.

References cmlabs::PARAMHEADER::type.

◆ getParameterValueSize()

uint32 cmlabs::ComponentData::getParameterValueSize ( const char * name)

◆ getPrivateDataCopy()

bool cmlabs::ComponentData::getPrivateDataCopy ( const char * name,
char * data,
uint32 maxSize )

Definition at line 607 of file ComponentData.cpp.

Referenced by UnitTest().

◆ getPrivateDataSize()

uint32 cmlabs::ComponentData::getPrivateDataSize ( const char * name)

Definition at line 594 of file ComponentData.cpp.

Referenced by UnitTest().

◆ hasParameter()

bool cmlabs::ComponentData::hasParameter ( const char * name)

Definition at line 980 of file ComponentData.cpp.

◆ IsComponentLocal() [1/2]

bool cmlabs::ComponentData::IsComponentLocal ( const char * name)
static

◆ IsComponentLocal() [2/2]

bool cmlabs::ComponentData::IsComponentLocal ( uint32 cid)
static

◆ RecordRemoteComponent()

bool cmlabs::ComponentData::RecordRemoteComponent ( uint32 id,
const char * name,
uint16 nodeID,
uint64 time )
static

◆ replacePrivateData() [1/2]

bool cmlabs::ComponentData::replacePrivateData ( const char * name,
const char * data,
uint32 size )

Definition at line 627 of file ComponentData.cpp.

References replacePrivateData().

Referenced by replacePrivateData(), and setPrivateData().

◆ replacePrivateData() [2/2]

bool cmlabs::ComponentData::replacePrivateData ( const char * name,
const char * data,
uint32 size,
uint32 offset )

Definition at line 641 of file ComponentData.cpp.

References deletePrivateData(), and setPrivateData().

◆ ReserveComponentID()

bool cmlabs::ComponentData::ReserveComponentID ( uint32 id,
const char * name )
static

◆ resetParameter()

bool cmlabs::ComponentData::resetParameter ( const char * name)

◆ resize()

bool cmlabs::ComponentData::resize ( uint32 increase)

Definition at line 498 of file ComponentData.cpp.

References cmlabs::COMPONENTDATAHEADER::pageID, and cmlabs::COMPONENTDATAHEADER::size.

Referenced by UnitTest().

◆ SetComponentStats()

bool cmlabs::ComponentData::SetComponentStats ( uint32 cid,
ComponentStats & stats )
static

Definition at line 427 of file ComponentData.cpp.

◆ setParameter() [1/3]

bool cmlabs::ComponentData::setParameter ( const char * name,
const char * val )

◆ setParameter() [2/3]

bool cmlabs::ComponentData::setParameter ( const char * name,
float64 val )

◆ setParameter() [3/3]

bool cmlabs::ComponentData::setParameter ( const char * name,
int64 val )

◆ setPrivateData()

bool cmlabs::ComponentData::setPrivateData ( const char * name,
const char * data,
uint32 size )

Definition at line 564 of file ComponentData.cpp.

References replacePrivateData().

Referenced by replacePrivateData(), and UnitTest().

◆ tweakParameter()

◆ UnitTest()

◆ UpdateRemoteComponent()

bool cmlabs::ComponentData::UpdateRemoteComponent ( uint32 cid,
uint16 nodeID,
uint16 procID,
const char * name )
static

Definition at line 169 of file ComponentData.cpp.


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