helics  3.5.2
Public Member Functions | Protected Attributes | List of all members
helics::apps::Tracer Class Reference

#include <Tracer.hpp>

+ Inheritance diagram for helics::apps::Tracer:

Public Member Functions

 Tracer (std::string_view name, FederateInfo &fedInfo)
 
 Tracer (std::vector< std::string > args)
 
 Tracer (int argc, char *argv[])
 
 Tracer (std::string_view name, const std::shared_ptr< Core > &core, const FederateInfo &fedInfo)
 
 Tracer (std::string_view name, CoreApp &core, const FederateInfo &fedInfo)
 
 Tracer (std::string_view name, const std::string &configString)
 
 Tracer (Tracer &&other_tracer)=default
 
Traceroperator= (Tracer &&tracer)=default
 
 ~Tracer ()
 
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 setClonedMessageCallback (std::function< void(Time, std::unique_ptr< Message >)> callback)
 
void setEndpointMessageCallback (std::function< void(Time, std::string_view, std::unique_ptr< Message >)> callback)
 
void setValueCallback (std::function< void(Time, std::string_view, std::string_view)> callback)
 
void enableTextOutput ()
 
void disableTextOutput ()
 
- 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
 
Appoperator= (App &&app)=default
 
Appoperator= (const App &app)=delete
 
void loadFile (const std::string &filename, bool enableFederateInterfaceRegistration=true)
 
virtual void run ()
 
virtual void finalize ()
 
bool isActive () const
 
const CombinationFederateaccessUnderlyingFederate () const
 

Protected Attributes

bool printMessage = false
 
bool allow_iteration
 flag to allow iteration of the federate for time requests More...
 
bool skiplog = false
 skip the log function and print directly to cout
 
std::unique_ptr< CloningFiltercFilt
 a pointer to a clone filter
 
std::deque< Inputsubscriptions
 the actual subscription objects
 
std::map< std::string_view, int > subkeys
 translate subscription names to an index
 
std::deque< Endpointendpoints
 the actual endpoint objects
 
std::map< std::string_view, int > eptNames
 translate endpoint name to index
 
std::unique_ptr< EndpointcloneEndpoint
 the endpoint for cloned message delivery
 
std::vector< std::string > captureInterfaces
 storage for the interfaces to capture
 
std::function< void(Time, std::unique_ptr< Message >)> clonedMessageCallback
 
std::function< void(Time, std::string_view, std::unique_ptr< Message >)> endpointMessageCallback
 
std::function< void(Time, std::string_view, std::string_view)> valueCallback
 
- Protected Attributes inherited from helics::apps::App
std::shared_ptr< CombinationFederatefed
 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
 
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

◆ Tracer() [1/7]

helics::apps::Tracer::Tracer ( std::string_view  name,
FederateInfo fedInfo 
)
explicit

construct from a FederateInfo structure

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

◆ Tracer() [2/7]

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

◆ Tracer() [3/7]

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

construct from command line arguments

◆ Tracer() [4/7]

helics::apps::Tracer::Tracer ( 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
namethe name of the tracer object, if empty it tries to figure it out from fedInfo
corea pointer to core object which the federate can join
fedInfoa federate information structure

◆ Tracer() [5/7]

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

constructor taking a federate information structure and using the given core

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

◆ Tracer() [6/7]

helics::apps::Tracer::Tracer ( std::string_view  name,
const std::string &  configString 
)

constructor taking a file with the required information

Parameters
namethe name of the app may be empty to pull name from the file
filea file defining the federate information

◆ Tracer() [7/7]

helics::apps::Tracer::Tracer ( Tracer &&  other_tracer)
default

move construction

◆ ~Tracer()

helics::apps::Tracer::~Tracer ( )
default

destructor

Member Function Documentation

◆ addCapture()

void helics::apps::Tracer::addCapture ( std::string_view  captureDesc)

add a capture interface

Parameters
captureDescdescribes a federate to capture all the interfaces for

References captureInterfaces.

◆ addDestEndpointClone()

void helics::apps::Tracer::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::Tracer::addEndpoint ( std::string_view  endpoint)

add an endpoint

References endpoints, and eptNames.

◆ addSourceEndpointClone()

void helics::apps::Tracer::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::Tracer::addSubscription ( std::string_view  key)

add a subscription to capture

add a subscription to record

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

◆ disableTextOutput()

void helics::apps::Tracer::disableTextOutput ( )
inline

turn the screen display off for values and messages

◆ enableTextOutput()

void helics::apps::Tracer::enableTextOutput ( )
inline

turn the screen display on for values and messages

◆ operator=()

Tracer& helics::apps::Tracer::operator= ( Tracer &&  tracer)
default

move assignment

◆ runTo()

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

◆ setClonedMessageCallback()

void helics::apps::Tracer::setClonedMessageCallback ( std::function< void(Time, std::unique_ptr< Message >)>  callback)
inline

set the callback for a message received through cloned interfaces

the function signature will take the time in the Tracer a unique_ptr to the message

◆ setEndpointMessageCallback()

void helics::apps::Tracer::setEndpointMessageCallback ( std::function< void(Time, std::string_view, std::unique_ptr< Message >)>  callback)
inline

set the callback for a message received through endpoints

the function signature will take the time in the Tracer, the endpoint name as a string, and a unique_ptr to the message

◆ setValueCallback()

void helics::apps::Tracer::setValueCallback ( std::function< void(Time, std::string_view, std::string_view)>  callback)
inline

set the callback for a value published

the function signature will take the time in the Tracer, the publication key as a string, and the value as a string

Member Data Documentation

◆ allow_iteration

bool helics::apps::Tracer::allow_iteration
protected
Initial value:
=
false

flag to allow iteration of the federate for time requests

Referenced by runTo().


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