 |
helics
3.3.0
|
9 #include "../application_api/Endpoints.hpp"
10 #include "../application_api/Publications.hpp"
11 #include "../application_api/Subscriptions.hpp"
12 #include "helicsApp.hpp"
39 explicit Clone(std::vector<std::string> args);
41 Clone(
int argc,
char* argv[]);
49 Clone(std::string_view appName,
const std::shared_ptr<Core>& core,
const FederateInfo& fi);
62 Clone(std::string_view appName,
const std::string& jsonString);
70 virtual void runTo(
Time runToTime)
override;
72 void saveFile(
const std::string& filename = std::string{});
81 std::tuple<Time, std::string, std::string>
getValue(
int index)
const;
86 std::unique_ptr<Message> getMessage(
int index)
const;
91 void setFederateToClone(std::string_view federateName);
94 void setOutputFile(std::string_view fileName) { outFileName = fileName; }
98 void addSubscription(std::string_view key);
101 void addSourceEndpointClone(std::string_view sourceEndpoint);
103 virtual void initialize()
override;
104 void generateInterfaces();
105 void captureForCurrentTime(
Time currentTime,
int iteration = 0);
107 std::shared_ptr<helicsCLI11App> buildArgParserApp();
117 int16_t iteration{0};
122 time(t1), index(id1), value(val)
127 bool allow_iteration{
false};
129 bool fileSaved{
false};
132 std::unique_ptr<CloningFilter>
cFilt;
135 std::vector<std::string>
139 std::map<helics::InterfaceHandle, int>
subids;
141 std::map<helics::InterfaceHandle, int> eptids;
145 std::string outFileName{
"clone.json"};
constexpr Time timeZero
Definition: helicsTime.hpp:31
Clone(std::string_view appName, FederateInfo &fi)
Definition: Clone.cpp:44
std::unique_ptr< CloningFilter > cFilt
a pointer to a clone filter
Definition: Clone.hpp:132
virtual void loadJsonFile(const std::string &jsonString)
Definition: helicsApp.cpp:153
std::vector< ValueCapture > points
lists of points that were captured
Definition: Clone.hpp:133
@ HELICS_SEQUENCING_MODE_ORDERED
Definition: helics_enums.h:399
void saveFile(const std::string &filename=std::string{})
Definition: Clone.cpp:105
X getValue(ValueFederate &fed, std::string_view key)
Definition: Subscriptions.hpp:31
std::string fedConfig
storage for the federateConfiguration
Definition: Clone.hpp:144
TimeRepresentation< count_time< 9 > > Time
Definition: helicsTime.hpp:27
std::vector< std::string > vectorizeQueryResult(std::string_view queryres)
Definition: queryFunctions.cpp:19
Definition: Clone.hpp:113
@ HELICS_FLAG_OBSERVER
Definition: helics_enums.h:101
auto messageCount() const
Definition: Clone.hpp:76
bool verbose
print all captured values to the screen
Definition: Clone.hpp:128
std::string masterFileName
the name of the master file used to do the construction
Definition: helicsApp.hpp:132
bool fileSaved
true if the file has been saved already
Definition: Clone.hpp:129
void setOutputFile(std::string_view fileName)
Definition: Clone.hpp:94
std::unique_ptr< Endpoint > cloneEndpoint
the endpoint for cloned message delivery
Definition: Clone.hpp:137
void setFederateToClone(std::string_view federateName)
Definition: Clone.cpp:334
std::vector< std::unique_ptr< Message > > messages
list of messages
Definition: Clone.hpp:138
Definition: FederateInfo.hpp:24
std::map< helics::InterfaceHandle, int > subids
map of the subscription ids
Definition: Clone.hpp:139
~Clone()
Definition: Clone.cpp:94
bool allow_iteration
trigger to allow Iteration
Definition: Clone.hpp:127
std::deque< Input > subscriptions
the actual subscription objects
Definition: Clone.hpp:134
Time nextPrintTimeStep
the time advancement period for printing markers
Definition: Clone.hpp:130
@ ITERATE_IF_NEEDED
indicator that the iterations need to continue
std::string outFileName
the final output file
Definition: Clone.hpp:145
std::unique_ptr< Message > getMessage(int index) const
Definition: Clone.cpp:349
std::string queryFederateSubscriptions(helics::Federate *fed, std::string_view fedName)
Definition: queryFunctions.cpp:136
bool waitForInit(helics::Federate *fed, std::string_view fedName, std::chrono::milliseconds timeout)
Definition: queryFunctions.cpp:101
std::vector< std::string > cloneSubscriptionNames
string of the subscriptions of the cloned federate
Definition: Clone.hpp:136
std::map< std::string_view, int > eptNames
translate endpoint name to index
Definition: Clone.hpp:142
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:143
virtual void runTo(Time runToTime) override
Definition: Clone.cpp:276
Definition: core-exceptions.hpp:29
auto pointCount() const
Definition: Clone.hpp:74
std::shared_ptr< CombinationFederate > fed
the federate created for the Player
Definition: helicsApp.hpp:130
Definition: helicsApp.hpp:29
std::tuple< Time, std::string, std::string > getValue(int index) const
Definition: Clone.cpp:339
std::map< std::string_view, int > subkeys
translate subscription names to an index
Definition: Clone.hpp:140
void loadFile(const std::string &filename)
Definition: helicsApp.cpp:123
std::vector< int > pubPointCount
a vector containing the counts of each publication
Definition: Clone.hpp:146
bool isValidIndex(sizeType testSize, const SizedDataType &vec)
Definition: core-data.hpp:171