13#if !defined(_MESSAGEPLAYER_H_)
14#define _MESSAGEPLAYER_H_
77 bool initRead(
const char* root, uint32 interval,
bool rotate =
false);
82 bool initRead(
const char* root,
bool rotate =
false);
88 bool initWrite(
const char* root, uint32 maxCount, uint64 maxSize);
107 bool exportToCSVFile(
const char* filename,
const char* separator = NULL);
111 std::string
exportToCSV(
const char* separator = NULL);
162 std::string indexFile;
163 uint32 indexFileSize;
165 std::string metadataFile;
166 std::string metadataTextFile;
169 std::map<uint16, std::string> subtypeList;
170 std::map<uint16, std::string> subcontextList;
171 std::map<uint32, std::string> componentNameList;
178 uint64 lastWriteTime;
179 uint64 lastReceiveTime;
The binary DataMessage container — the central data-exchange object of Psyclone/CMSDK.
#define DATAMESSAGEINFOID
The central Psyclone data container: a self-contained binary message with typed, named user entries.
std::string printAllString(const char *format=NULL)
Render a human-readable dump of all recorded messages.
bool addMessage(const char *name, DataMessage *msg)
Append a message to the recording (write mode).
std::string exportToCSV(const char *separator=NULL)
Export the whole recording as a CSV string.
bool readMetadata()
Load the metadata files of an opened recording.
DataMessage * waitForNextMessage(uint32 ms, const char *&triggerName)
Wait for and return the next message in the recording (read mode), honouring the replay timing.
bool flushToDisk()
Force buffered messages and the index out to disk (write mode).
bool setComponentNameList(std::map< uint32, std::string > &names)
Provide readable names for component ids, used in metadata/CSV export.
bool setSubTypeList(std::map< uint16, std::string > &subtypes)
Provide readable names for type level ids, used in metadata/CSV export.
bool writeMetadata()
Write the metadata (name lists etc.) files alongside the recording.
bool setSystemIDs(DataMessage *msg)
Stamp system-identifying header fields onto msg for recording.
~MessagePlayer()
Destructor; releases buffers (does not delete messages already handed out).
bool initRead(const char *root, uint32 interval, bool rotate=false)
Open a recording for replay with a fixed playback interval.
MessagePlayer()
Create an uninitialised player; call initRead() or initWrite() before use.
bool initWrite(const char *root, uint32 maxCount, uint64 maxSize)
Open a recording for writing.
std::string getCurrentTriggerName()
bool exportToCSVFile(const char *filename, const char *separator=NULL)
Export the whole recording to a CSV file.
bool setSubContextList(std::map< uint16, std::string > &subcontexts)
Provide readable names for context level ids, used in metadata/CSV export.
Fixed-size on-disk index record describing one recorded message.
char msgTriggerName[128]
Name of the trigger that produced the message.
bool reset()
Zero the entry and stamp it with DATAMESSAGEINFOID.
DataMessage * msg
In-memory pointer to the loaded message; not valid on disk.
uint64 serial
Sequence number of the message within the recording.
uint64 msgTime
Original message time in microseconds (drives replay timing).
uint32 size
Binary size of the recorded message block in bytes.
uint32 cid
Object id, DATAMESSAGEINFOID when valid.