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

#include <Clone.hpp>

+ Inheritance diagram for helics::apps::Clone:

Classes

class  ValueCapture
 

Public Member Functions

 Clone (const std::string &appName, FederateInfo &fi)
 
 Clone (std::vector< std::string > args)
 
 Clone (int argc, char *argv[])
 
 Clone (const std::string &appName, const std::shared_ptr< Core > &core, const FederateInfo &fi)
 
 Clone (const std::string &appName, CoreApp &core, const FederateInfo &fi)
 
 Clone (const std::string &appName, const std::string &jsonString)
 
 Clone (Clone &&other_recorder)=default
 
Cloneoperator= (Clone &&record)=default
 
 ~Clone ()
 
virtual void runTo (Time runToTime) override
 
void saveFile (const std::string &filename=std::string{})
 
auto pointCount () const
 
auto messageCount () const
 
std::tuple< Time, std::string, std::string > getValue (int index) const
 
std::unique_ptr< MessagegetMessage (int index) const
 
void setFederateToClone (const std::string &federateName)
 
void setOutputFile (std::string fileName)
 
- 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
 
bool fileSaved {false}
 true if the file has been saved already
 
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< std::string > cloneSubscriptionNames
 string of the subscriptions of the cloned federate
 
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::string captureFederate
 storage for the name of the federate to clone
 
std::string fedConfig
 storage for the federateConfiguration
 
std::string outFileName {"clone.json"}
 the final output file
 
std::vector< int > pubPointCount
 a vector containing the counts of each publication
 
- 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
virtual void loadJsonFile (const std::string &jsonString)
 
void loadJsonFileConfiguration (const std::string &appName, const std::string &jsonString)
 
virtual void loadTextFile (const std::string &textFile)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Clone() [1/7]

helics::apps::Clone::Clone ( const std::string &  appName,
FederateInfo fi 
)

construct from a FederateInfo structure

Parameters
appNamethe 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.

◆ Clone() [2/7]

helics::apps::Clone::Clone ( 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

◆ Clone() [3/7]

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

construct from command line arguments

◆ Clone() [4/7]

helics::apps::Clone::Clone ( const std::string &  appName,
const std::shared_ptr< Core > &  core,
const FederateInfo fi 
)

constructor taking a federate information structure and using the given core

Parameters
appNamethe 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.

◆ Clone() [5/7]

helics::apps::Clone::Clone ( const std::string &  appName,
CoreApp &  core,
const FederateInfo fi 
)

constructor taking a federate information structure and using the given core

Parameters
appNamethe 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.

◆ Clone() [6/7]

helics::apps::Clone::Clone ( const std::string &  appName,
const std::string &  jsonString 
)

constructor taking a file with the required information

Parameters
appNamethe name of the app
jsonStringa file or json string defining the federate information in JSON or text

References helics::apps::App::fed, helics_flag_observer, and helics::apps::App::loadJsonFile().

◆ Clone() [7/7]

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

move construction

◆ ~Clone()

helics::apps::Clone::~Clone ( )

destructor

References fileSaved, outFileName, and saveFile().

Member Function Documentation

◆ getMessage()

std::unique_ptr< Message > helics::apps::Clone::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::Clone::getValue ( int  index) const

get a string with the value of point index

Parameters
indexthe number of the point to retrieve
Returns
a pair with the tag as the first element and the value as the second

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

◆ messageCount()

auto helics::apps::Clone::messageCount ( ) const
inline

get the number of captured messages

◆ operator=()

Clone& helics::apps::Clone::operator= ( Clone &&  record)
default

move assignment

◆ pointCount()

auto helics::apps::Clone::pointCount ( ) const
inline

get the number of captured points

◆ runTo()

void helics::apps::Clone::runTo ( Time  runToTime)
overridevirtual

run the Cloner until the specified time

run the Player until the specified time

Implements helics::apps::App.

References allow_iteration, helics::apps::App::fed, helics::iterate_if_needed, helics::next_step, nextPrintTimeStep, and helics::timeZero.

◆ saveFile()

void helics::apps::Clone::saveFile ( const std::string &  filename = std::string{})

save the data to a file

References cloneSubscriptionNames, fedConfig, fileSaved, loadJsonStr(), messages, outFileName, points, and subscriptions.

Referenced by ~Clone().

◆ setFederateToClone()

void helics::apps::Clone::setFederateToClone ( const std::string &  federateName)

set the name of the federate to Clone

Parameters
federateNamethe name of the federate to clone

References captureFederate.

◆ setOutputFile()

void helics::apps::Clone::setOutputFile ( std::string  fileName)
inline

set the name of the output file

Parameters
fileNamethe name of the file, can be "" if no file should be auto saved

Member Data Documentation

◆ nextPrintTimeStep

Time helics::apps::Clone::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