helics  2.8.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 (const std::string &name, FederateInfo &fi)
 
 Recorder (std::vector< std::string > args)
 
 Recorder (int argc, char *argv[])
 
 Recorder (const std::string &name, const std::shared_ptr< Core > &core, const FederateInfo &fi)
 
 Recorder (const std::string &name, CoreApp &core, const FederateInfo &fi)
 
 Recorder (const std::string &name, const std::string &jsonString)
 
 Recorder (Recorder &&other_recorder)=default
 
Recorderoperator= (Recorder &&other_recorder)=default
 
 ~Recorder ()
 
virtual void runTo (Time runToTime) override
 
void addSubscription (const std::string &key)
 
void addEndpoint (const std::string &endpoint)
 
void addSourceEndpointClone (const std::string &sourceEndpoint)
 
void addDestEndpointClone (const std::string &destEndpoint)
 
void addCapture (const std::string &captureDesc)
 
void saveFile (const std::string &filename)
 
auto pointCount () const
 
auto messageCount () const
 
std::tuple< Time, std::string, std::string > getValue (int index) const
 
std::unique_ptr< MessagegetMessage (int index) const
 
- Public Member Functions inherited from helics::apps::App
 App ()=default
 
 App (const std::string &defaultAppName, std::vector< std::string > args)
 
 App (const std::string &defaultAppName, int argc, char *argv[])
 
 App (const std::string &appName, const FederateInfo &fi)
 
 App (const std::string &appName, const std::shared_ptr< Core > &core, const FederateInfo &fi)
 
 App (const std::string &appName, CoreApp &core, const FederateInfo &fi)
 
 App (const std::string &appName, const std::string &jsonString)
 
 App (App &&other_app)=default
 
 App (const App &other_app)=delete
 
Appoperator= (App &&app)=default
 
Appoperator= (const App &app)=delete
 
void loadFile (const std::string &filename)
 
virtual void run ()
 
virtual void finalize ()
 
bool isActive () const
 
const CombinationFederateaccessUnderlyingFederate () const
 

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< CloningFiltercFilt
 a pointer to a clone filter
 
std::vector< ValueCapturepoints
 lists of points that were captured
 
std::vector< Inputsubscriptions
 the actual subscription objects
 
std::vector< Endpointendpoints
 the actual endpoint objects
 
std::unique_ptr< EndpointcloneEndpoint
 the endpoint for cloned message delivery
 
std::vector< std::unique_ptr< Message > > messages
 list of messages
 
std::map< helics::interface_handle, int > subids
 map of the subscription ids
 
std::map< std::string, int > subkeys
 translate subscription names to an index
 
std::map< helics::interface_handle, int > eptids
 
std::map< std::string, int > eptNames
 translate endpoint name to index
 
std::vector< ValueStatsvStat
 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
 
std::string outFileName {"out.txt"}
 the final output file
 
- Protected Attributes inherited from helics::apps::App
std::shared_ptr< CombinationFederatefed
 the federate created for the Player
 
Time stopTime = Time::maxVal()
 the time the Player should stop
 
std::string masterFileName
 the name of the master file used to do the construction
 
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)
 

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 ( const std::string &  name,
FederateInfo fi 
)

construct from a FederateInfo structure

Parameters
namethe name of the Recorder, can be left empty for the default or to pull from the federateInfo object
fia federate information structure

References helics::apps::App::fed, and helics_flag_observer.

◆ Recorder() [2/7]

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

construct from command line arguments in a vector

Parameters
argsthe 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 ( const std::string &  name,
const std::shared_ptr< Core > &  core,
const FederateInfo fi 
)

constructor taking a federate information structure and using the given core

Parameters
namethe name of the Recorder, can be left empty for the default or to pull from the federateInfo object
corea pointer to core object which the federate can join
fia federate information structure

References helics::apps::App::fed, and helics_flag_observer.

◆ Recorder() [5/7]

helics::apps::Recorder::Recorder ( const std::string &  name,
CoreApp &  core,
const FederateInfo fi 
)

constructor taking a federate information structure and using the given core

Parameters
namethe name of the federate (can be empty to use defaults from fi)
corea coreApp object that can be joined
fia federate information structure

References helics::apps::App::fed, and helics_flag_observer.

◆ Recorder() [6/7]

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

constructor taking a file with the required information

Parameters
namethe name of the app
jsonStringa file or JSON string defining the federate information in JSON

References helics::apps::App::fed, and helics_flag_observer.

◆ Recorder() [7/7]

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

move construction

◆ ~Recorder()

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

destructor

References outFileName, and saveFile().

Member Function Documentation

◆ addCapture()

void helics::apps::Recorder::addCapture ( const std::string &  captureDesc)

add a capture interface

Parameters
captureDescdescribes a federate to capture all the interfaces for

References captureInterfaces.

◆ addDestEndpointClone()

void helics::apps::Recorder::addDestEndpointClone ( const std::string &  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 ( const std::string &  endpoint)

add an endpoint

References endpoints, eptNames, and helics::apps::App::fed.

◆ addSourceEndpointClone()

void helics::apps::Recorder::addSourceEndpointClone ( const std::string &  sourceEndpoint)

copy all messages that come from a specified endpoint

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

◆ addSubscription()

void helics::apps::Recorder::addSubscription ( const std::string &  key)

add a subscription to capture

add a subscription to record

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

◆ getMessage()

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

get a message

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

Parameters
indexthe number of the message to retrieve

References helics::isValidIndex(), and messages.

◆ getValue()

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

get a string with the value of point index

Parameters
indexthe 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 subscriptions.

◆ 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)
overridevirtual

◆ 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:

the time advancement period for printing markers

Referenced by runTo().


The documentation for this class was generated from the following files:
helics::timeZero
constexpr Time timeZero
Definition: helics-time.hpp:31