 |
helics
3.0.1
|
9 #include "../application_api/Endpoints.hpp"
10 #include "../application_api/Publications.hpp"
11 #include "../application_api/Subscriptions.hpp"
12 #include "helicsApp.hpp"
38 explicit Clone(std::vector<std::string> args);
40 Clone(
int argc,
char* argv[]);
48 Clone(
const std::string& appName,
49 const std::shared_ptr<Core>& core,
63 Clone(
const std::string& appName,
const std::string& jsonString);
71 virtual void runTo(
Time runToTime)
override;
73 void saveFile(
const std::string& filename = std::string{});
82 std::tuple<Time, std::string, std::string>
getValue(
int index)
const;
87 std::unique_ptr<Message> getMessage(
int index)
const;
92 void setFederateToClone(
const std::string& federateName);
95 void setOutputFile(std::string fileName) { outFileName = std::move(fileName); }
99 void addSubscription(
const std::string& key);
102 void addSourceEndpointClone(
const std::string& sourceEndpoint);
104 virtual void initialize()
override;
105 void generateInterfaces();
106 void captureForCurrentTime(
Time currentTime,
int iteration = 0);
108 std::shared_ptr<helicsCLI11App> buildArgParserApp();
118 int16_t iteration{0};
123 time(t1), index(id1), value(val)
128 bool allow_iteration{
false};
130 bool fileSaved{
false};
133 std::unique_ptr<CloningFilter>
cFilt;
136 std::vector<std::string>
140 std::map<helics::InterfaceHandle, int>
subids;
142 std::map<helics::InterfaceHandle, int> eptids;
146 std::string outFileName{
"clone.json"};
constexpr Time timeZero
Definition: helicsTime.hpp:31
std::unique_ptr< CloningFilter > cFilt
a pointer to a clone filter
Definition: Clone.hpp:133
virtual void loadJsonFile(const std::string &jsonString)
Definition: helicsApp.cpp:154
std::vector< ValueCapture > points
lists of points that were captured
Definition: Clone.hpp:134
@ HELICS_SEQUENCING_MODE_ORDERED
Definition: helics_enums.h:367
void saveFile(const std::string &filename=std::string{})
Definition: Clone.cpp:100
std::string queryFederateSubscriptions(helics::Federate *fed, const std::string &fedName)
Definition: queryFunctions.cpp:175
std::string fedConfig
storage for the federateConfiguration
Definition: Clone.hpp:145
TimeRepresentation< count_time< 9 > > Time
Definition: helicsTime.hpp:27
std::map< std::string, int > subkeys
translate subscription names to an index
Definition: Clone.hpp:141
std::vector< Input > subscriptions
the actual subscription objects
Definition: Clone.hpp:135
Definition: Clone.hpp:114
@ HELICS_FLAG_OBSERVER
Definition: helics_enums.h:99
auto messageCount() const
Definition: Clone.hpp:77
bool verbose
print all captured values to the screen
Definition: Clone.hpp:129
std::string masterFileName
the name of the master file used to do the construction
Definition: helicsApp.hpp:129
bool fileSaved
true if the file has been saved already
Definition: Clone.hpp:130
std::unique_ptr< Endpoint > cloneEndpoint
the endpoint for cloned message delivery
Definition: Clone.hpp:138
void setOutputFile(std::string fileName)
Definition: Clone.hpp:95
std::vector< std::unique_ptr< Message > > messages
list of messages
Definition: Clone.hpp:139
Definition: FederateInfo.hpp:20
std::map< helics::InterfaceHandle, int > subids
map of the subscription ids
Definition: Clone.hpp:140
~Clone()
Definition: Clone.cpp:89
bool allow_iteration
trigger to allow Iteration
Definition: Clone.hpp:128
Time nextPrintTimeStep
the time advancement period for printing markers
Definition: Clone.hpp:131
@ ITERATE_IF_NEEDED
indicator that the iterations need to continue
std::string outFileName
the final output file
Definition: Clone.hpp:146
std::unique_ptr< Message > getMessage(int index) const
Definition: Clone.cpp:344
std::vector< std::string > cloneSubscriptionNames
string of the subscriptions of the cloned federate
Definition: Clone.hpp:137
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
std::string captureFederate
storage for the name of the federate to clone
Definition: Clone.hpp:144
virtual void runTo(Time runToTime) override
Definition: Clone.cpp:271
Definition: core-exceptions.hpp:29
auto pointCount() const
Definition: Clone.hpp:75
std::shared_ptr< CombinationFederate > fed
the federate created for the Player
Definition: helicsApp.hpp:127
std::map< std::string, int > eptNames
translate endpoint name to index
Definition: Clone.hpp:143
X getValue(ValueFederate &fed, const std::string &key)
Definition: Subscriptions.hpp:30
Definition: helicsApp.hpp:28
std::vector< std::string > vectorizeQueryResult(std::string &&queryres)
Definition: queryFunctions.cpp:19
bool waitForInit(helics::Federate *fed, const std::string &fedName, std::chrono::milliseconds timeout)
Definition: queryFunctions.cpp:136
std::tuple< Time, std::string, std::string > getValue(int index) const
Definition: Clone.cpp:334
void loadFile(const std::string &filename)
Definition: helicsApp.cpp:124
void setFederateToClone(const std::string &federateName)
Definition: Clone.cpp:329
Clone(const std::string &appName, FederateInfo &fi)
Definition: Clone.cpp:44
std::vector< int > pubPointCount
a vector containing the counts of each publication
Definition: Clone.hpp:147
bool isValidIndex(sizeType testSize, const SizedDataType &vec)
Definition: core-data.hpp:132