 |
helics
2.8.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"
22 static const int coreValidationIdentifier = 0x378424EC;
23 static const int brokerValidationIdentifier = 0xA3467D20;
30 class MessageFederate;
39 enum class vtype : int { generic_fed, value_fed, message_fed, combination_fed, invalid_fed };
44 std::shared_ptr<Broker> brokerptr;
54 std::shared_ptr<Core> coreptr;
55 std::vector<std::unique_ptr<FilterObject>>
filters;
58 CoreObject() =
default;
66 class PublicationObject;
71 std::vector<std::unique_ptr<Message>> messages;
72 std::vector<int> freeMessageSlots;
75 Message* addMessage(std::unique_ptr<Message>& mess);
77 std::unique_ptr<Message> extractMessage(
int index);
78 void freeMessage(
int index);
84 vtype type = vtype::invalid_fed;
87 std::shared_ptr<Federate> fedptr;
89 std::vector<std::unique_ptr<InputObject>> inputs;
90 std::vector<std::unique_ptr<PublicationObject>> pubs;
91 std::vector<std::unique_ptr<EndpointObject>> epts;
92 std::vector<std::unique_ptr<FilterObject>> filters;
104 std::shared_ptr<ValueFederate> fedptr;
105 Input* inputPtr{
nullptr};
112 std::shared_ptr<ValueFederate> fedptr;
120 std::shared_ptr<MessageFederate> fedptr;
130 Filter* filtPtr{
nullptr};
131 std::unique_ptr<Filter> uFilter;
132 std::shared_ptr<Federate> fedptr;
133 std::shared_ptr<Core> corePtr;
143 bool activeAsync{
false};
152 #define HELICS_ERROR_CHECK(err, retval) \
154 if (((err) != nullptr) && ((err)->error_code != 0)) { \
160 inline void assignError(
helics_error* err,
int errorCode,
const char*
string)
162 if (err !=
nullptr) {
168 extern const std::string emptyStr;
169 extern const std::string nullStringArgument;
170 #define AS_STRING(str) ((str) != nullptr) ? std::string(str) : emptyStr
172 #define CHECK_NULL_STRING(str, retval) \
174 if ((str) == nullptr) { \
175 assignError(err, helics_error_invalid_argument, nullStringArgument.c_str()); \
201 bool checkOutArgString(
const char* outputString,
int maxlen,
helics_error* err);
206 guarded<std::deque<std::unique_ptr<helics::BrokerObject>>> brokers;
207 guarded<std::deque<std::unique_ptr<helics::CoreObject>>> cores;
208 guarded<std::deque<std::unique_ptr<helics::FedObject>>> feds;
209 gmlc::concurrency::TripWireDetector tripDetect;
210 guarded<std::deque<std::string>> errorStrings;
216 int addBroker(std::unique_ptr<helics::BrokerObject> broker);
218 int addCore(std::unique_ptr<helics::CoreObject> core);
220 int addFed(std::unique_ptr<helics::FedObject>
fed);
221 void clearBroker(
int index);
222 void clearCore(
int index);
223 void clearFed(
int index);
225 void abortAll(
int errorCode,
const std::string&
error);
231 std::shared_ptr<MasterObjectHolder> getMasterHolder();
232 void clearAllObjects();
Definition: api_objects.h:69
std::vector< std::unique_ptr< FilterObject > > filters
list of filters created directly through the core
Definition: api_objects.h:55
Definition: api_objects.h:116
std::string target
the target of the query
Definition: api_objects.h:139
Definition: application_api/ValueFederate.hpp:25
void * helics_message_object
Definition: api-data.h:76
Definition: api_objects.h:137
void * helics_core
Definition: api-data.h:46
vtype
Definition: api_objects.h:39
bool custom
indicator that the filter is a custom filter and requires a callback
Definition: api_objects.h:128
Definition: Endpoints.hpp:18
query_id_t asyncIndexCode
the index to use for the queryComplete call
Definition: api_objects.h:145
Definition: application_api/MessageFederate.hpp:20
helics_sequencing_mode
Definition: helics_enums.h:333
Definition: core/Core.hpp:42
int addBroker(std::unique_ptr< helics::BrokerObject > broker)
Definition: helicsExport.cpp:1093
std::string query
the actual query itself
Definition: api_objects.h:140
Definition: api_objects.h:82
Definition: api_objects.h:42
@ fed
special logging command for message coming from a fed
Definition: loggingHelper.hpp:32
const char * addErrorString(std::string newError)
Definition: helicsExport.cpp:1228
Definition: api_objects.h:204
Definition: api_objects.h:52
Definition: api-data.h:166
Definition: Publications.hpp:23
FedObject * getFedObject(helics_federate fed, helics_error *err) noexcept
Definition: FederateExport.cpp:27
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
CoreObject * getCoreObject(helics_core core, helics_error *err) noexcept
Definition: helicsExport.cpp:204
@ error
only print errors
Definition: loggingHelper.hpp:22
bool cloning
indicator that the filter is a cloning filter
Definition: api_objects.h:127
Definition: api_objects.h:125
std::shared_ptr< Federate > activeFed
pointer to the fed with the active Query
Definition: api_objects.h:142
int32_t error_code
Definition: api-data.h:167
Definition: application_api/Federate.hpp:44
void * helics_broker
Definition: api-data.h:51
const char * message
Definition: api-data.h:168
Definition: core/Broker.hpp:18
int addCore(std::unique_ptr< helics::CoreObject > core)
Definition: helicsExport.cpp:1102
@ helics_sequencing_mode_fast
Definition: helics_enums.h:335
std::string response
the response to the query
Definition: api_objects.h:141
Definition: api_objects.h:109
BrokerObject * getBrokerObject(helics_broker broker, helics_error *err) noexcept
Definition: helicsExport.cpp:221
helics_sequencing_mode mode
the ordering mode used for the query
Definition: api_objects.h:144
Definition: core-data.hpp:146
void * helics_federate
Definition: api-data.h:56
int addFed(std::unique_ptr< helics::FedObject > fed)
Definition: helicsExport.cpp:1111