|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Wrapper class managing a single flat ControlMessage memory block. More...
#include <ControlMessage.h>
Public Member Functions | |
| ControlMessage (uint16 command, uint64 from, uint64 to, char *data=NULL, uint32 dataSize=0) | |
| Create a new control message. | |
| ControlMessage (char *data) | |
| Wrap an existing binary control message block without copying. | |
| ~ControlMessage () | |
| Destructor. | |
| uint32 | getSize () |
| uint16 | getCommand () |
| uint64 | getTime () |
| uint64 | getFrom () |
| uint64 | getTo () |
| uint16 | getStatus () |
| bool | setStatus (uint16 status) |
| Set the status/result code. | |
Static Public Member Functions | |
| static bool | UnitTest () |
| Run the built-in self test. | |
Public Attributes | |
| char * | data |
| The flat message block (ControlMessageHeader + payload); see class notes on ownership. | |
Wrapper class managing a single flat ControlMessage memory block.
Provides typed access to the header fields of the underlying block pointed to by data. Ownership: the (command, from, to, ...) constructor allocates a new block (payload bytes are copied); the char* constructor merely wraps the supplied block without copying.
Definition at line 49 of file ControlMessage.h.
| cmlabs::ControlMessage::ControlMessage | ( | uint16 | command, |
| uint64 | from, | ||
| uint64 | to, | ||
| char * | data = NULL, | ||
| uint32 | dataSize = 0 ) |
Create a new control message.
| command | command code for the receiver |
| from | sender id |
| to | addressee id |
| data | optional payload bytes (copied), NULL for none |
| dataSize | payload size in bytes |
Definition at line 12 of file ControlMessage.cpp.
References CONTROLMESSAGEID, data, cmlabs::GetTimeNow(), and cmlabs::ControlMessageHeader::size.
Referenced by UnitTest().
| cmlabs::ControlMessage::ControlMessage | ( | char * | data | ) |
Wrap an existing binary control message block without copying.
| data | the binary block to wrap; caller retains ownership |
Definition at line 25 of file ControlMessage.cpp.
References data.
| cmlabs::ControlMessage::~ControlMessage | ( | ) |
Destructor.
Definition at line 29 of file ControlMessage.cpp.
References data.
| uint16 cmlabs::ControlMessage::getCommand | ( | ) |
Definition at line 38 of file ControlMessage.cpp.
Referenced by UnitTest().
| uint64 cmlabs::ControlMessage::getFrom | ( | ) |
Definition at line 48 of file ControlMessage.cpp.
Referenced by UnitTest().
| uint32 cmlabs::ControlMessage::getSize | ( | ) |
Definition at line 33 of file ControlMessage.cpp.
Referenced by UnitTest().
| uint16 cmlabs::ControlMessage::getStatus | ( | ) |
Definition at line 58 of file ControlMessage.cpp.
Referenced by UnitTest().
| uint64 cmlabs::ControlMessage::getTime | ( | ) |
Definition at line 43 of file ControlMessage.cpp.
Referenced by UnitTest().
| uint64 cmlabs::ControlMessage::getTo | ( | ) |
Definition at line 53 of file ControlMessage.cpp.
Referenced by UnitTest().
| bool cmlabs::ControlMessage::setStatus | ( | uint16 | status | ) |
Set the status/result code.
| status | new status value |
Definition at line 63 of file ControlMessage.cpp.
Referenced by UnitTest().
|
static |
Run the built-in self test.
Definition at line 70 of file ControlMessage.cpp.
References ControlMessage(), data, cmlabs::unittest::detail(), cmlabs::unittest::fail(), getCommand(), getFrom(), getSize(), getStatus(), getTime(), cmlabs::GetTimeNow(), getTo(), cmlabs::unittest::metric(), cmlabs::unittest::progress(), and setStatus().
Referenced by cmlabs::Register_ControlMessage_Tests().
| char* cmlabs::ControlMessage::data |
The flat message block (ControlMessageHeader + payload); see class notes on ownership.
Definition at line 80 of file ControlMessage.h.
Referenced by ControlMessage(), ControlMessage(), getCommand(), getFrom(), getSize(), getStatus(), getTime(), getTo(), setStatus(), UnitTest(), and ~ControlMessage().