|
RTC Toolkit 5.1.0
|
Abstract base class for all sources that can be recorded by the MetadataCollector and TelemetryRecorder. More...
#include <recordingUnit.hpp>
Public Types | |
| enum class | State : uint8_t { STOPPED , PREPARING , IDLE , WAITING , RUNNING , FINISHED , FAILED } |
Public Member Functions | |
| RecordingUnit (const std::string &comp_id, const std::string &unit_id, const std::string &unit_type, ServiceContainer &services) | |
| Create a new RecordingIngestion. | |
| RecordingUnit ()=delete | |
| virtual | ~RecordingUnit ()=default |
| void | ConnectWithLeaders (RecUnitListType &units) |
| std::string | GetId () |
| Get the unit_it of this RecordingUnit. | |
| State | GetState () |
| Get the current state of the Recording Unit. | |
| virtual void | CheckErrors () |
| Check for Errors, will rethrow errors thrown in the recorder. | |
| virtual void | Prepare (const std::filesystem::path &file_path)=0 |
| Prepare the recording. | |
| virtual void | Start ()=0 |
| Start the recording. | |
| virtual std::vector< std::filesystem::path > | Stop ()=0 |
| Stop the recording and wait for it's termination. | |
| virtual void | Update () |
| Update dynamic settings. | |
| boost::signals2::connection | Connect (const std::function< void(const std::string &, const State &)> &function) |
| Connect to State change signal. | |
Public Attributes | |
| const std::map< State, std::string > | m_state_text |
Protected Member Functions | |
| bool | SetState (State state, State precondition) |
| Sets the new state, only goes to new state, if expected state matches. | |
| void | SetState (State state, State precondition, const std::string &error_message) |
| Sets the new state, only goes to new state, if expected state matches. | |
| void | SetFailed (const std::exception_ptr &exception) |
| Set the unit into failed state, with the given exception. | |
| void | SetStopped () |
| Set the Unit state to STOPPED independent of the current State. | |
| bool | HasLeaders () |
| Check if this unit is following any leaders. | |
| bool | HasFirstLeaderStarted () |
| This function is used to determine if this unit should start recording when waiting for leaders. | |
| bool | HasLastLeaderFinished () |
| This function is used to determine if this unit should stop recording when waiting for leaders. | |
| void | ResetLeaderStates () |
Protected Attributes | |
| std::string | m_comp_id |
| std::string | m_unit_id |
| RuntimeRepoIf & | m_rtr |
| OldbIf & | m_oldb |
| ComponentMetricsIf & | m_metrics |
| std::optional< std::filesystem::path > | m_file_path |
| boost::signals2::signal< void(const std::string &, const State &) | m_signal ) |
Abstract base class for all sources that can be recorded by the MetadataCollector and TelemetryRecorder.
| rtctk::componentFramework::RecordingUnit::RecordingUnit | ( | const std::string & | comp_id, |
| const std::string & | unit_id, | ||
| const std::string & | unit_type, | ||
| ServiceContainer & | services ) |
Create a new RecordingIngestion.
| comp_id | name of the component |
| unit_id | the id of the recording unit |
| unit_type | type of the recording unit as a string |
| services | required services |
|
delete |
|
virtualdefault |
|
virtual |
Check for Errors, will rethrow errors thrown in the recorder.
Reimplemented in rtctk::componentFramework::DynamicDataPointRecordingUnit.
| boost::signals2::connection rtctk::componentFramework::RecordingUnit::Connect | ( | const std::function< void(const std::string &, const State &)> & | function | ) |
Connect to State change signal.
| function | callback that should be called |
| void rtctk::componentFramework::RecordingUnit::ConnectWithLeaders | ( | RecUnitListType & | units | ) |
| std::string rtctk::componentFramework::RecordingUnit::GetId | ( | ) |
Get the unit_it of this RecordingUnit.
| RecordingUnit::State rtctk::componentFramework::RecordingUnit::GetState | ( | ) |
Get the current state of the Recording Unit.
|
protected |
This function is used to determine if this unit should start recording when waiting for leaders.
|
protected |
This function is used to determine if this unit should stop recording when waiting for leaders.
|
protected |
Check if this unit is following any leaders.
|
pure virtual |
Prepare the recording.
| file_path | file path where the data should be recorded |
Implemented in rtctk::componentFramework::DataPointRecordingUnit< DpType >, rtctk::componentFramework::DynamicDataPointRecordingUnit, rtctk::componentFramework::TypedEventRecordingUnit< EventType, OutputStage >, rtctk::componentFramework::JsonEventRecordingUnit< OutputStage >, rtctk::componentFramework::EventRecordingUnit< OutputStage >, and rtctk::componentFramework::IpcqRecordingUnit< RecInfoType >.
|
protected |
|
protected |
Set the unit into failed state, with the given exception.
|
protected |
Sets the new state, only goes to new state, if expected state matches.
| state | new state |
| precondition | the state before the transition |
|
protected |
Sets the new state, only goes to new state, if expected state matches.
| state | new state |
| precondition | expected state |
| error_message | message of InvalidStateChange if state change invalid (meaning the precondition was not met) |
| InvalidStateChange | when state change |
|
protected |
Set the Unit state to STOPPED independent of the current State.
Start the recording.
Implemented in rtctk::componentFramework::DataPointRecordingUnit< DpType >, rtctk::componentFramework::DynamicDataPointRecordingUnit, rtctk::componentFramework::TypedEventRecordingUnit< EventType, OutputStage >, rtctk::componentFramework::JsonEventRecordingUnit< OutputStage >, rtctk::componentFramework::EventRecordingUnit< OutputStage >, and rtctk::componentFramework::IpcqRecordingUnit< RecInfoType >.
|
pure virtual |
Stop the recording and wait for it's termination.
Implemented in rtctk::componentFramework::DataPointRecordingUnit< DpType >, rtctk::componentFramework::DynamicDataPointRecordingUnit, rtctk::componentFramework::TypedEventRecordingUnit< EventType, OutputStage >, rtctk::componentFramework::JsonEventRecordingUnit< OutputStage >, rtctk::componentFramework::EventRecordingUnit< OutputStage >, and rtctk::componentFramework::IpcqRecordingUnit< RecInfoType >.
|
virtual |
Update dynamic settings.
Reimplemented in rtctk::componentFramework::DynamicDataPointRecordingUnit, and rtctk::componentFramework::IpcqRecordingUnit< RecInfoType >.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |