Class for recording channel data to tape.
More...
#include <fw/TapeRecorder.h>
|
| TapeRecorder (const Duration &initialWaitForDataDuration=Duration::seconds(0)) |
| Create a TapeRecorder. More...
|
|
virtual | ~TapeRecorder () |
|
template<typename Reflector > |
void | reflect (Reflector &r) |
|
| MIRA_DEPRECATED ("Please use int compressionLevel(=0/-1) instead of bool compress(=false/true)", void addChannel(const std::string &channelID, const std::list< BinarySerializerCodecPtr > &codecs, bool compress, Duration interval=Duration::microseconds(0), bool avoidDataLoss=false)) |
| Add a channel to the list of recorded channels. More...
|
|
void | addChannel (const std::string &channelID, const std::list< BinarySerializerCodecPtr > &codecs=std::list< BinarySerializerCodecPtr >(), int compressionLevel=0, Duration interval=Duration::microseconds(0), bool avoidDataLoss=false) |
| Add a channel to the list of recorded channels. More...
|
|
void | addChannel (const std::string &channelID, const RecordedChannelInfo &info) |
| Add a channel to the list of recorded channels by providing an ID and an info object that contains the settings for the channel. More...
|
|
void | record (const Path &file) |
| Start recording to file. More...
|
|
void | record (const TapeRecorderConfig &config) |
| Start recording to file using a recorder config that contains channels and settings for recording. More...
|
|
void | stop (bool finishQueue=true) |
| Stop recording. More...
|
|
size_t | storageQueueSize () |
| Query size of internal storage queue. More...
|
|
void | processStorageQueue (int numEntries=1) |
| Process single element or a specified number of elements from storage queue. More...
|
|
void | setMaxMessageBlockSize (uint32 maxMessageBlockSize) |
| Set the maximum size of the chunks. More...
|
|
void | setWarnOfDataLoss (bool enable) |
| Set whether detected data loss should show a warning. More...
|
|
bool | getWarnOfDataLoss () |
| Query if data loss warning is enabled. More...
|
|
bool | isRecording () const |
| Returns whether TapeRecorder is currently gathering data after record was called. More...
|
|
const PerformanceStatistics & | getStats (const std::string &name) |
|
Class for recording channel data to tape.
◆ ChannelMap
◆ TapeRecorder()
Create a TapeRecorder.
- Parameters
-
[in] | initialWaitForDataDuration | Max time to wait for initial data in all recorded channels. The purpose is to give channels published remotely some time after subscribing to receive data already published in the past. The given duration is the max total waiting time for all recorded channels (i.e. determination of the tape start time begins after 1 data update is read from each recorded channel, or when the time has passed after calling record(), whichever happens first). |
◆ ~TapeRecorder()
◆ reflect()
void reflect |
( |
Reflector & |
r | ) |
|
|
inline |
◆ MIRA_DEPRECATED()
MIRA_DEPRECATED |
( |
"Please use int compressionLevel(=0/-1) instead of bool compress(=false/true)" |
, |
|
|
void |
addChannelconst std::string &channelID, const std::list< BinarySerializerCodecPtr > &codecs, bool compress, Duration interval=Duration::microseconds(0), bool avoidDataLoss=false |
|
) |
| |
|
inline |
Add a channel to the list of recorded channels.
- Parameters
-
[in] | channelID | Name of the channel |
[in] | codecs | A list of used codecs or empty if none |
[in] | compress | Should the channel data be recorded in a compressed format (zip) |
[in] | interval | Interval in which the data gets recorded. E.g. if a channel changes every 10 ms and the interval is 100 ms, only 1 out of 10 changes are recorded. |
[in] | avoidDataLoss | Avoid data loss on the channel during recording by using subscribeInterval() instead of subscribe() |
◆ addChannel() [1/2]
Add a channel to the list of recorded channels.
- Parameters
-
[in] | channelID | Name of the channel |
[in] | codecs | A list of used codecs or empty if none |
[in] | compressionLevel | libzip compression level for recorded channel data (0=none, 1..9=best speed to best compression, -1=default compression) |
[in] | interval | Interval in which the data gets recorded. E.g. if a channel changes every 10 ms and the interval is 100 ms, only 1 out of 10 changes are recorded. |
[in] | avoidDataLoss | Avoid data loss on the channel during recording by using subscribeInterval() instead of subscribe() |
◆ addChannel() [2/2]
Add a channel to the list of recorded channels by providing an ID and an info object that contains the settings for the channel.
- Parameters
-
[in] | channelID | Name of the channel |
[in] | info | Settings for recording the channel |
◆ record() [1/2]
void record |
( |
const Path & |
file | ) |
|
Start recording to file.
- Parameters
-
[in] | file | Filename of the tape |
◆ record() [2/2]
Start recording to file using a recorder config that contains channels and settings for recording.
- Parameters
-
[in] | config | A config containing all settings for recording |
◆ stop()
void stop |
( |
bool |
finishQueue = true | ) |
|
Stop recording.
- Parameters
-
[in] | finishQueue | If true, the internal storage queue is finished before returning. Otherwise, items remain in the queue and the tape file is not finished, processStorageQueue() must be called until the queue is empty. |
◆ storageQueueSize()
size_t storageQueueSize |
( |
| ) |
|
Query size of internal storage queue.
This can be called during recording or after stopping.
◆ processStorageQueue()
void processStorageQueue |
( |
int |
numEntries = 1 | ) |
|
Process single element or a specified number of elements from storage queue.
This should only be used to process remaining queue entries after recording was stopping with stop(finishQueue=false). This way, the external caller can control and monitor the number of elements to process (e.g. if it wants to display a progress bar).
Will throw XLogical if called while still recording.
◆ setMaxMessageBlockSize()
void setMaxMessageBlockSize |
( |
uint32 |
maxMessageBlockSize | ) |
|
|
inline |
Set the maximum size of the chunks.
- Parameters
-
[in] | maxMessageBlockSize | Size of a chunk in bytes |
◆ setWarnOfDataLoss()
void setWarnOfDataLoss |
( |
bool |
enable | ) |
|
|
inline |
Set whether detected data loss should show a warning.
This only applies to channels which are configured to avoid data loss. it can only be detected if the channel data has valid sequence IDs.
- Parameters
-
[in] | enable | Whether to enable the warning |
◆ getWarnOfDataLoss()
bool getWarnOfDataLoss |
( |
| ) |
|
|
inline |
Query if data loss warning is enabled.
◆ isRecording()
bool isRecording |
( |
| ) |
const |
|
inline |
Returns whether TapeRecorder is currently gathering data after record was called.
◆ getStats()
◆ valueChanged()
bool valueChanged |
( |
ChannelRead< void > |
value, |
|
|
bool |
forceStorage = false |
|
) |
| |
|
protected |
◆ intervalValueChanged()
◆ addAllTransformationChannels()
void addAllTransformationChannels |
( |
| ) |
|
|
protected |
◆ timestampFilename()
Path timestampFilename |
( |
const Path & |
filenameBase | ) |
|
|
protected |
◆ mAuthority
◆ mMaxMessageBlockSize
uint32 mMaxMessageBlockSize |
|
protected |
◆ mWarnDataLoss
◆ mTape
◆ mIsRecording
◆ mFirstCallbackMessage
bool mFirstCallbackMessage |
|
protected |
◆ mChannels
◆ mInitialWaitForDataDuration
◆ mStorageThread
boost::thread mStorageThread |
|
protected |
◆ mStorageThreadCondition
boost::condition_variable mStorageThreadCondition |
|
protected |
◆ mStorageMutex
boost::mutex mStorageMutex |
|
protected |
◆ mStorageThreadStarted
bool mStorageThreadStarted |
|
protected |
◆ mStorageQueue
std::deque<MessageToStore> mStorageQueue |
|
protected |
◆ mStorageThreadTerminationRequest
volatile bool mStorageThreadTerminationRequest |
|
protected |
The documentation for this class was generated from the following file: