| helics 3.6.1

Classes | Public Member Functions | Protected Attributes | List of all members
helics::apps::Recorder Class Reference

`#include <Recorder.hpp>`

Inheritance diagram for helics::apps::Recorder:

## Classes
class | ValueCapture
class | ValueStats

## Public Member Functions
| Recorder (std::string_view name, FederateInfo &fedInfo)
| Recorder (std::vector< std::string > args)
| Recorder (int argc, char *argv[])
| Recorder (std::string_view name, const std::shared_ptr< Core > &core, const FederateInfo &fedInfo)
| Recorder (std::string_view name, CoreApp &core, const FederateInfo &fedInfo)
| Recorder (std::string_view name, const std::string &jsonString)
| Recorder (Recorder &&other_recorder)=default
Recorder & | operator= (Recorder &&other_recorder)=default
| ~Recorder ()
virtual void | runTo (Time runToTime) override
void | addSubscription (std::string_view key)
void | addEndpoint (std::string_view endpoint)
void | addSourceEndpointClone (std::string_view sourceEndpoint)
void | addDestEndpointClone (std::string_view destEndpoint)
void | addCapture (std::string_view captureDesc)
void | saveFile (const std::string &filename)
auto | pointCount () const
auto | messageCount () const
std::tuple< Time, std::string_view, std::string > | getValue (std::size_t index) const
std::unique_ptr< Message > | getMessage (std::size_t index) const
Public Member Functions inherited from helics::apps::App
| App ()=default
| App (std::string_view defaultAppName, std::vector< std::string > args)
| App (std::string_view defaultAppName, int argc, char *argv[])
| App (std::string_view appName, const FederateInfo &fedInfo)
| App (std::string_view appName, const std::shared_ptr< Core > &core, const FederateInfo &fedInfo)
| App (std::string_view appName, CoreApp &core, const FederateInfo &fedInfo)
| App (std::string_view appName, const std::string &configString)
| App (App &&other_app)=default
| App (const App &other_app)=delete
App & | operator= (App &&app)=default
App & | operator= (const App &app)=delete
void | loadFile (const std::string &filename, bool enableFederateInterfaceRegistration=true)
virtual void | run ()
virtual void | finalize ()
bool | isActive () const
const CombinationFederate & | accessUnderlyingFederate () const
std::shared_ptr< CombinationFederate > | getUnderlyingFederatePointer ()

## Protected Attributes
bool | allow_iteration {false}
| trigger to allow Iteration
bool | verbose {false}
| print all captured values to the screen
Time | nextPrintTimeStep
| the time advancement period for printing markers More...
std::unique_ptr< CloningFilter > | cFilt
| a pointer to a clone filter
std::vector< ValueCapture > | points
| lists of points that were captured
std::deque< Input > | subscriptions
| the actual subscription objects
std::vector< std::string > | targets
| specified targets for the subscriptions
std::deque< Endpoint > | endpoints
| the actual endpoint objects
std::unique_ptr< Endpoint > | cloneEndpoint
| the endpoint for cloned message delivery
std::vector< std::unique_ptr< Message > > | messages
| list of messages
std::map< helics::InterfaceHandle, int > | subids
| map of the subscription ids
std::map< std::string_view, int > | subkeys
| translate subscription names to an index
std::map< helics::InterfaceHandle, int > | eptids
std::map< std::string_view, int > | eptNames
| translate endpoint name to index
std::vector< ValueStats > | vStat
| storage for statistics capture
std::vector< std::string > | captureInterfaces
| storage for the interfaces to capture
std::string | mapfile
| file name for the on-line file updater
Protected Attributes inherited from helics::apps::App
std::shared_ptr< CombinationFederate > | fed
| the federate created for the App
Time | stopTime = Time::maxVal()
| the time the App should stop
std::string | configFileName
| name of the config file used for constructing the federate
std::string | inputFileName
| the name of the app input file
std::string | outFileName
| the name of any output file
bool | useLocal {false}
bool | fileLoaded {false}
bool | deactivated {false}
bool | quietMode {false}
bool | helpMode {false}
std::vector< std::string > | remArgs

## Additional Inherited Members
Protected Member Functions inherited from helics::apps::App
void | loadJsonFileConfiguration (const std::string &appName, const std::string &jsonString, bool enableFederateInterfaceRegistration)
void | loadInputFiles ()
void | loadConfigOptions (AppTextParser &aparser)

## Detailed Description

class designed to capture data points from a set of subscriptions or endpoints

## Constructor & Destructor Documentation

## ◆ Recorder() [1/7]

helics::apps::Recorder::Recorder | ( | std::string_view | name,
|  | FederateInfo & | fedInfo
| ) |  |

construct from a FederateInfo structure

Parameters

  name | the name of the Recorder, can be left empty for the default or to pull from the federateInfo object
  fedInfo | a federate information structure

## ◆ Recorder() [2/7]

helics::apps::Recorder::Recorder | ( | std::vector< std::string > | args | ) |
| explicit

construct from command line arguments in a vector

Parameters

  args | the command line arguments to pass in a reverse vector

## ◆ Recorder() [3/7]

helics::apps::Recorder::Recorder | ( | int | argc,
|  | char * | argv[]
| ) |  |

construct from command line arguments

## ◆ Recorder() [4/7]

helics::apps::Recorder::Recorder | ( | std::string_view | name,
|  | const std::shared_ptr< Core > & | core,
|  | const FederateInfo & | fedInfo
| ) |  |

constructor taking a federate information structure and using the given core

Parameters

  name | the name of the Recorder, can be left empty for the default or to pull from the federateInfo object
  core | a pointer to core object which the federate can join
  fedInfo | a federate information structure

## ◆ Recorder() [5/7]

helics::apps::Recorder::Recorder | ( | std::string_view | name,
|  | CoreApp & | core,
|  | const FederateInfo & | fedInfo
| ) |  |

constructor taking a federate information structure and using the given core

Parameters

  name | the name of the federate (can be empty to use defaults from fedInfo)
  core | a coreApp object that can be joined
  fedInfo | a federate information structure

## ◆ Recorder() [6/7]

helics::apps::Recorder::Recorder | ( | std::string_view | name,
|  | const std::string & | jsonString
| ) |  |

constructor taking a file with the required information

Parameters

  name | the name of the app
  jsonString | a file or JSON string defining the federate information in JSON

## ◆ Recorder() [7/7]

helics::apps::Recorder::Recorder | ( | Recorder && | other_recorder | ) |
| default

move construction

## ◆ ~Recorder()

helics::apps::Recorder::~Recorder | ( |  | ) |

destructor

References helics::apps::App::outFileName, and saveFile().

## Member Function Documentation

## ◆ addCapture()

void helics::apps::Recorder::addCapture | ( | std::string_view | captureDesc | ) |

add a capture interface

Parameters

  captureDesc | describes a federate to capture all the interfaces for

References captureInterfaces.

## ◆ addDestEndpointClone()

void helics::apps::Recorder::addDestEndpointClone | ( | std::string_view | destEndpoint | ) |

copy all messages that are going to a specific endpoint

References cFilt, cloneEndpoint, and helics::apps::App::fed.

## ◆ addEndpoint()

void helics::apps::Recorder::addEndpoint | ( | std::string_view | endpoint | ) |

add an endpoint

References endpoints, and eptNames.

## ◆ addSourceEndpointClone()

void helics::apps::Recorder::addSourceEndpointClone | ( | std::string_view | sourceEndpoint | ) |

copy all messages that come from a specified endpoint

References cFilt, cloneEndpoint, and helics::apps::App::fed.

## ◆ addSubscription()

void helics::apps::Recorder::addSubscription | ( | std::string_view | key | ) |

add a subscription to capture

add a subscription to record

References helics::apps::App::fed, subids, subkeys, subscriptions, and targets.

## ◆ getMessage()

std::unique_ptr< Message > helics::apps::Recorder::getMessage | ( | std::size_t | index | ) | const

get a message

makes a copy of a message and returns it in a unique_ptr

Parameters

  index | the number of the message to retrieve

References helics::isValidIndex(), and messages.

## ◆ getValue()

std::tuple< Time, std::string_view, std::string > helics::apps::Recorder::getValue | ( | std::size_t | index | ) | const

get a string with the value of point index

Parameters

  index | the number of the point to retrieve

Returns
  a tuple with Time as the first element the tag as the 2nd element and the value as the third

References helics::isValidIndex(), points, and targets.

## ◆ messageCount()

auto helics::apps::Recorder::messageCount | ( |  | ) | const
| inline

get the number of captured messages

## ◆ operator=()

Recorder& helics::apps::Recorder::operator= | ( | Recorder && | other_recorder | ) |
| default

move assignment

## ◆ pointCount()

auto helics::apps::Recorder::pointCount | ( |  | ) | const
| inline

get the number of captured points

## ◆ runTo()

void helics::apps::Recorder::runTo | ( | Time | runToTime | ) |
| override virtual

run the Player until the specified time

Implements helics::apps::App.

References allow_iteration, helics::apps::App::fed, helics::ITERATE_IF_NEEDED, mapfile, helics::NEXT_STEP, nextPrintTimeStep, helics::Federate::STARTUP, helics::timeZero, and vStat.

## ◆ saveFile()

void helics::apps::Recorder::saveFile | ( | const std::string & | filename | ) |

save the data to a file

Referenced by ~Recorder().

## Member Data Documentation

## ◆ nextPrintTimeStep

Time helics::apps::Recorder::nextPrintTimeStep
| protected

Initial value:
{
helics::timeZero}
helics::timeZero
constexpr Time timeZero
Definition: helicsTime.hpp:31

the time advancement period for printing markers

Referenced by runTo().

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

- Recorder.hpp
- Recorder.cpp