 |
helics
3.0.1
|
9 #include "../../application_api/helicsTypes.hpp"
10 #include "../../common/GuardedTypes.hpp"
11 #include "../../core/core-data.hpp"
12 #include "../api-data.h"
13 #include "gmlc/concurrency/TripWire.hpp"
23 static const int gCoreValidationIdentifier = 0x378424EC;
24 static const int gBrokerValidationIdentifier = 0xA3467D20;
31 class MessageFederate;
40 enum class FederateType : int { GENERIC, VALUE, MESSAGE, COMBINATION, INVALID };
45 std::shared_ptr<Broker> brokerptr;
55 std::shared_ptr<Core> coreptr;
56 std::vector<std::unique_ptr<FilterObject>>
filters;
59 CoreObject() =
default;
67 class PublicationObject;
72 std::vector<std::unique_ptr<Message>> messages;
73 std::vector<int> freeMessageSlots;
76 Message* addMessage(std::unique_ptr<Message>& mess);
78 std::unique_ptr<Message> extractMessage(
int index);
79 void freeMessage(
int index);
88 std::shared_ptr<Federate> fedptr;
90 std::vector<std::unique_ptr<InputObject>> inputs;
91 std::vector<std::unique_ptr<PublicationObject>> pubs;
92 std::vector<std::unique_ptr<EndpointObject>> epts;
93 std::vector<std::unique_ptr<FilterObject>> filters;
94 std::pair<std::string, std::string> commandBuffer;
106 std::shared_ptr<ValueFederate> fedptr;
107 Input* inputPtr{
nullptr};
114 std::shared_ptr<ValueFederate> fedptr;
122 std::shared_ptr<MessageFederate> fedptr;
132 Filter* filtPtr{
nullptr};
133 std::unique_ptr<Filter> uFilter;
134 std::shared_ptr<Federate> fedptr;
135 std::shared_ptr<Core> corePtr;
145 bool activeAsync{
false};
154 #define HELICS_ERROR_CHECK(err, retval) \
156 if (((err) != nullptr) && ((err)->error_code != 0)) { \
162 inline void assignError(
HelicsError* err,
int error_code,
const char*
string)
164 if (err !=
nullptr) {
170 extern const std::string gEmptyStr;
171 extern const std::string gNullStringArgument;
172 #define AS_STRING(str) ((str) != nullptr) ? std::string(str) : gEmptyStr
174 #define AS_STRING_VIEW(str) ((str) != nullptr) ? std::string_view(str) : std::string_view(gEmptyStr)
176 #define CHECK_NULL_STRING(str, retval) \
178 if ((str) == nullptr) { \
179 assignError(err, HELICS_ERROR_INVALID_ARGUMENT, gNullStringArgument.c_str()); \
191 HelicsMessage createAPIMessage(std::unique_ptr<helics::Message>& mess);
198 void helicsErrorHandler(
HelicsError* err) noexcept;
205 bool checkOutputArgString(
const char* outputString,
int maxlen,
HelicsError* err);
210 guarded<std::deque<std::unique_ptr<helics::BrokerObject>>> brokers;
211 guarded<std::deque<std::unique_ptr<helics::CoreObject>>> cores;
212 guarded<std::deque<std::unique_ptr<helics::FedObject>>> feds;
213 gmlc::concurrency::TripWireDetector tripDetect;
214 guarded<std::deque<std::string>> errorStrings;
220 int addBroker(std::unique_ptr<helics::BrokerObject> broker);
222 int addCore(std::unique_ptr<helics::CoreObject> core);
224 int addFed(std::unique_ptr<helics::FedObject> fed);
225 void clearBroker(
int index);
226 void clearCore(
int index);
227 void clearFed(
int index);
229 void abortAll(
int errorCode,
const std::string& error);
235 std::shared_ptr<MasterObjectHolder> getMasterHolder();
236 void clearAllObjects();
Definition: api_objects.h:70
std::vector< std::unique_ptr< FilterObject > > filters
list of filters created directly through the core
Definition: api_objects.h:56
Definition: api_objects.h:118
std::string target
the target of the query
Definition: api_objects.h:141
FedObject * getFedObject(HelicsFederate fed, HelicsError *err) noexcept
Definition: FederateExport.cpp:27
Definition: application_api/ValueFederate.hpp:25
const char * message
Definition: api-data.h:162
QueryId asyncIndexCode
the index to use for the queryComplete call
Definition: api_objects.h:147
void * HelicsFederate
Definition: api-data.h:60
Definition: api_objects.h:139
bool custom
indicator that the filter is a custom filter and requires a callback
Definition: api_objects.h:130
Definition: Endpoints.hpp:21
Definition: application_api/MessageFederate.hpp:22
Definition: core/Core.hpp:42
BrokerObject * getBrokerObject(HelicsBroker broker, HelicsError *err) noexcept
Definition: helicsExport.cpp:221
void * HelicsBroker
Definition: api-data.h:55
int addBroker(std::unique_ptr< helics::BrokerObject > broker)
Definition: helicsExport.cpp:1130
std::string query
the actual query itself
Definition: api_objects.h:142
Definition: api_objects.h:83
Definition: api_objects.h:43
CoreObject * getCoreObject(HelicsCore core, HelicsError *err) noexcept
Definition: helicsExport.cpp:204
const char * addErrorString(std::string newError)
Definition: helicsExport.cpp:1265
HelicsSequencingModes
Definition: helics_enums.h:363
Definition: api_objects.h:208
Definition: api_objects.h:53
void * HelicsMessage
Definition: api-data.h:84
Definition: Publications.hpp:24
Definition: api-data.h:160
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
HelicsSequencingModes mode
the ordering mode used for the query
Definition: api_objects.h:146
bool cloning
indicator that the filter is a cloning filter
Definition: api_objects.h:129
@ HELICS_SEQUENCING_MODE_FAST
Definition: helics_enums.h:365
void * HelicsCore
Definition: api-data.h:49
Definition: api_objects.h:127
std::shared_ptr< Federate > activeFed
pointer to the fed with the active Query
Definition: api_objects.h:144
Definition: application_api/Federate.hpp:47
Definition: core/Broker.hpp:18
int addCore(std::unique_ptr< helics::CoreObject > core)
Definition: helicsExport.cpp:1139
std::string response
the response to the query
Definition: api_objects.h:143
Definition: api_objects.h:111
FederateType
Definition: api_objects.h:40
int32_t error_code
Definition: api-data.h:161
Definition: core-data.hpp:29
int addFed(std::unique_ptr< helics::FedObject > fed)
Definition: helicsExport.cpp:1148