| helics 3.6.1

cpp98/Federate.hpp
1 /*
2 Copyright (c) 2017-2025,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable
4 Energy, LLC. See the top-level NOTICE for additional details. All rights reserved.
5 SPDX-License-Identifier: BSD-3-Clause
6 */
7 #ifndef HELICS_CPP98_FEDERATE_HPP_
8 #define HELICS_CPP98_FEDERATE_HPP_
9 #pragma once
10
11 #include "Filter.hpp"
12 #include "Translator.hpp"
13 #include "config.hpp"
14 #include "helics/helics.h"
15 #include "helicsExceptions.hpp"
16
17 #include <complex>
18 #include <string>
19 #include <vector>
20
21 #if defined(HELICS_HAS_FUNCTIONAL) && HELICS_HAS_FUNCTIONAL != 0
22 # include <functional>
23 # include <utility>
24 #endif
25
26 namespace helicscpp {
28 class FederateInfo {
29 public:
31 FederateInfo() { fedInfo = helicsCreateFederateInfo(); }
34 explicit FederateInfo(const std::string& coretype)
35 {
36 fedInfo = helicsCreateFederateInfo();
37 helicsFederateInfoSetCoreTypeFromString(fedInfo, coretype.c_str(), hThrowOnError());
38 }
41 explicit FederateInfo(int coretype)
42 {
43 fedInfo = helicsCreateFederateInfo();
44 helicsFederateInfoSetCoreType(fedInfo, coretype, hThrowOnError());
45 }
47 FederateInfo(const FederateInfo& otherFedInfo)
48 {
49 fedInfo = helicsFederateClone(otherFedInfo.fedInfo, hThrowOnError());
50 }
52 FederateInfo& operator=(const FederateInfo& otherFedInfo)
53 {
54 HelicsFederateInfo fi_new = helicsFederateClone(otherFedInfo.fedInfo, hThrowOnError());
55 helicsFederateInfoFree(fedInfo);
56 fedInfo = fi_new;
57 return *this;
58 }
59 #ifdef HELICS_HAS_RVALUE_REFS
61 FederateInfo(FederateInfo&& otherFedInfo) HELICS_NOTHROW
62 {
63 fedInfo = otherFedInfo.fedInfo;
64 otherFedInfo.fedInfo = HELICS_NULL_POINTER;
65 }
67 FederateInfo& operator=(FederateInfo&& otherFedInfo) HELICS_NOTHROW
68 {
69 helicsFederateInfoFree(fedInfo);
70 fedInfo = otherFedInfo.fedInfo;
71 otherFedInfo.fedInfo = HELICS_NULL_POINTER;
72 return *this;
73 }
74 #endif
76 ~FederateInfo() { helicsFederateInfoFree(fedInfo); }
77 void loadFromArgs(const std::string& argString)
78 {
79 helicsFederateInfoLoadFromString(fedInfo, argString.c_str(), HELICS_NULL_POINTER);
80 }
83 void setCoreName(const std::string& coreName)
84 {
85 helicsFederateInfoSetCoreName(fedInfo, coreName.c_str(), HELICS_NULL_POINTER);
86 }
88 void setSeparator(char sep)
89 {
90 helicsFederateInfoSetSeparator(fedInfo, sep, HELICS_NULL_POINTER);
91 }
94 void setCoreInit(const std::string& coreInit)
95 {
96 helicsFederateInfoSetCoreInitString(fedInfo, coreInit.c_str(), HELICS_NULL_POINTER);
97 }
99 void setBrokerInit(const std::string& brokerInit)
100 {
101 helicsFederateInfoSetBrokerInitString(fedInfo, brokerInit.c_str(), HELICS_IGNORE_ERROR);
102 }
106 void setCoreType(const std::string& coretype)
107 {
108 helicsFederateInfoSetCoreTypeFromString(fedInfo, coretype.c_str(), hThrowOnError());
109 }
113 void setCoreType(int coretype)
114 {
115 helicsFederateInfoSetCoreType(fedInfo, coretype, HELICS_NULL_POINTER);
116 }
120 void setBroker(const std::string& broker)
121 {
122 helicsFederateInfoSetBroker(fedInfo, broker.c_str(), HELICS_NULL_POINTER);
123 }
127 void setBrokerKey(const std::string& brokerkey)
128 {
129 helicsFederateInfoSetBrokerKey(fedInfo, brokerkey.c_str(), HELICS_NULL_POINTER);
130 }
135 void setFlagOption(int flag, bool value = true)
136 {
137 helicsFederateInfoSetFlagOption(fedInfo,
138 flag,
139 value ? HELICS_TRUE : HELICS_FALSE,
140 HELICS_NULL_POINTER);
141 }
146 void setProperty(int timeProperty, HelicsTime timeValue)
147 {
148 helicsFederateInfoSetTimeProperty(fedInfo, timeProperty, timeValue, HELICS_NULL_POINTER);
149 }
154 void setProperty(int integerProperty, int propertyValue)
155 {
156 helicsFederateInfoSetIntegerProperty(fedInfo,
157 integerProperty,
158 propertyValue,
159 HELICS_NULL_POINTER);
160 }
161
163 HelicsFederateInfo getInfo() { return fedInfo; }
164
165 private:
166 HelicsFederateInfo fedInfo;
167 };
168
169 #if defined(HELICS_HAS_FUNCTIONAL) && HELICS_HAS_FUNCTIONAL != 0
170 namespace details {
172 inline void helicCppQueryCallbackExecutor(const char* query,
173 int stringSize,
174 HelicsQueryBuffer buffer,
175 void* userData)
176 {
177 auto cback = reinterpret_cast<std::function<std::string(const std::string&)>*>(userData);
178 std::string val(query, stringSize);
179 std::string result = (*cback)(val);
180 helicsQueryBufferFill(buffer, result.c_str(), static_cast<int>(result.size()), nullptr);
181 }
182
184 inline void
185 helicCppTimeUpdateCallbackExecutor(HelicsTime time, HelicsBool iterating, void* userData)
186 {
187 auto cback = reinterpret_cast<std::function<void(HelicsTime, bool)>*>(userData);
188 (*cback)(time, iterating == HELICS_TRUE);
189 }
190
192 inline void helicCppStateChangeCallbackExecutor(HelicsFederateState newState,
193 HelicsFederateState oldState,
194 void* userData)
195 {
196 auto cback =
197 reinterpret_cast<std::function<void(HelicsFederateState, HelicsFederateState)>*>(
198 userData);
199 (*cback)(newState, oldState);
200 }
201
203 inline void helicCppTimeRequestEntryCallbackExecutor(HelicsTime currentTime,
204 HelicsTime requestTime,
205 HelicsBool iterating,
206 void* userData)
207 {
208 auto cback = reinterpret_cast<std::function<void(HelicsTime, HelicsTime, bool)>*>(userData);
209 (*cback)(currentTime, requestTime, iterating == HELICS_TRUE);
210 }
212 inline void helicCppTimeRequestReturnCallbackExecutor(HelicsTime newTime,
213 HelicsBool iterating,
214 void* userData)
215 {
216 auto cback = reinterpret_cast<std::function<void(HelicsTime, bool)>*>(userData);
217 (*cback)(newTime, iterating == HELICS_TRUE);
218 }
219 } // namespace details
220 #endif
221
223 typedef struct HelicsIterationTime {
224 HelicsTime grantedTime;
225 HelicsIterationResult status;
226 } HelicsIterationTime;
227
229 class Federate {
230 public:
232 Federate() HELICS_NOTHROW: fed(NULL), exec_async_iterate(false) {}
234 Federate(const Federate& fedObj): exec_async_iterate(fedObj.exec_async_iterate)
235 {
236 fed = helicsFederateClone(fedObj.fed, hThrowOnError());
237 }
239 Federate& operator=(const Federate& fedObj)
240 {
241 exec_async_iterate = fedObj.exec_async_iterate;
242 fed = helicsFederateClone(fedObj.fed, hThrowOnError());
243 return *this;
244 }
245 #ifdef HELICS_HAS_RVALUE_REFS
247 Federate(Federate&& fedObj) HELICS_NOTHROW:
248 fed(fedObj.fed),
249 exec_async_iterate(fedObj.exec_async_iterate)
250 {
251 fedObj.fed = HELICS_NULL_POINTER;
252 }
254 Federate& operator=(Federate&& fedObj) HELICS_NOTHROW
255 {
256 exec_async_iterate = fedObj.exec_async_iterate;
257 fed = fedObj.fed;
258 fedObj.fed = HELICS_NULL_POINTER;
259 return *this;
260 }
261 #endif
263 virtual ~Federate()
264 {
265 if (fed != HELICS_NULL_POINTER) {
266 helicsFederateFree(fed);
267 }
268 #if defined(HELICS_HAS_FUNCTIONAL) && HELICS_HAS_FUNCTIONAL != 0
269 freeCallbacks();
270 #endif
271 }
273 operator HelicsFederate() const { return fed; }
275 HelicsFederate baseObject() const { return fed; }
280 void setFlagOption(int flag, bool flagValue = true)
281 {
282 helicsFederateSetFlagOption(fed,
283 flag,
284 flagValue ? HELICS_TRUE : HELICS_FALSE,
285 hThrowOnError());
286 }
291 void setProperty(int tProperty, HelicsTime timeValue)
292 {
293 helicsFederateSetTimeProperty(fed, tProperty, timeValue, hThrowOnError());
294 }
299 void setProperty(int intProperty, int value)
300 {
301 helicsFederateSetIntegerProperty(fed, intProperty, value, hThrowOnError());
302 }
303
307 bool getFlagOption(int flag) const
308 {
309 return (helicsFederateGetFlagOption(fed, flag, hThrowOnError()) != HELICS_FALSE);
310 }
314 HelicsTime getTimeProperty(int tProperty) const
315 {
316 return helicsFederateGetTimeProperty(fed, tProperty, hThrowOnError());
317 }
321 int getIntegerProperty(int intProperty) const
322 {
323 return helicsFederateGetIntegerProperty(fed, intProperty, hThrowOnError());
324 }
332 void setSeparator(char sep) { helicsFederateSetSeparator(fed, sep, HELICS_NULL_POINTER); }
338 void registerInterfaces(const std::string& configString)
339 {
340 helicsFederateRegisterInterfaces(fed, configString.c_str(), hThrowOnError());
341 }
343 HelicsFederateState getCurrentMode() const
344 {
345 return helicsFederateGetState(fed, HELICS_NULL_POINTER);
346 }
351 bool isAsyncOperationCompleted() const
352 {
353 // returns int, 1 = true, 0 = false
354 return helicsFederateIsAsyncOperationCompleted(fed, HELICS_NULL_POINTER) != HELICS_FALSE;
355 }
359 void enterInitializingMode() { helicsFederateEnterInitializingMode(fed, hThrowOnError()); }
364 void enterInitializingModeAsync()
365 {
366 helicsFederateEnterInitializingModeAsync(fed, hThrowOnError());
367 }
368
372 void enterInitializingModeComplete()
373 {
374 helicsFederateEnterInitializingModeComplete(fed, hThrowOnError());
375 }
376
382 void enterInitializingModeIterative()
383 {
384 helicsFederateEnterInitializingModeIterative(fed, hThrowOnError());
385 }
390 void enterInitializingModeIterativeAsync()
391 {
392 helicsFederateEnterInitializingModeIterativeAsync(fed, hThrowOnError());
393 }
394
398 void enterInitializingModeIterativeComplete()
399 {
400 helicsFederateEnterInitializingModeIterativeComplete(fed, hThrowOnError());
401 }
402
407 HelicsIterationResult
408 enterExecutingMode(HelicsIterationRequest iterate = HELICS_ITERATION_REQUEST_NO_ITERATION)
409 {
410 HelicsIterationResult out_iterate = HELICS_ITERATION_RESULT_NEXT_STEP;
411 if (iterate == HELICS_ITERATION_REQUEST_NO_ITERATION) {
412 helicsFederateEnterExecutingMode(fed, hThrowOnError());
413 } else {
414 out_iterate = helicsFederateEnterExecutingModeIterative(fed, iterate, hThrowOnError());
415 }
416 return out_iterate;
417 }
423 void enterExecutingModeAsync(
424 HelicsIterationRequest iterate = HELICS_ITERATION_REQUEST_NO_ITERATION)
425 {
426 if (iterate == HELICS_ITERATION_REQUEST_NO_ITERATION) {
427 helicsFederateEnterExecutingModeAsync(fed, hThrowOnError());
428 exec_async_iterate = false;
429 } else {
430 helicsFederateEnterExecutingModeIterativeAsync(fed, iterate, hThrowOnError());
431 exec_async_iterate = true;
432 }
433 }
434
439 HelicsIterationResult enterExecutingModeComplete()
440 {
441 HelicsIterationResult out_iterate = HELICS_ITERATION_RESULT_NEXT_STEP;
442 if (exec_async_iterate) {
443 out_iterate = helicsFederateEnterExecutingModeIterativeComplete(fed, hThrowOnError());
444 } else {
445 helicsFederateEnterExecutingModeComplete(fed, hThrowOnError());
446 }
447 return out_iterate;
448 }
452 void finalize() { helicsFederateFinalize(fed, hThrowOnError()); }
455 void finalizeAsync() { helicsFederateFinalizeAsync(fed, hThrowOnError()); }
457 void finalizeComplete() { helicsFederateFinalizeComplete(fed, hThrowOnError()); }
459 HelicsTime getCurrentTime() { return helicsFederateGetCurrentTime(fed, hThrowOnError()); }
463 HelicsTime requestTime(HelicsTime time)
464 {
465 return helicsFederateRequestTime(fed, time, hThrowOnError());
466 }
469 HelicsTime requestNextStep() { return helicsFederateRequestNextStep(fed, hThrowOnError()); }
470
474 HelicsTime requestTimeAdvance(HelicsTime timeDelta)
475 {
476 return helicsFederateRequestTimeAdvance(fed, timeDelta, hThrowOnError());
477 }
482 HelicsIterationTime requestTimeIterative(HelicsTime time, HelicsIterationRequest iterate)
483 {
484 HelicsIterationTime itTime;
485 itTime.grantedTime = helicsFederateRequestTimeIterative(
486 fed, time, iterate, &(itTime.status), hThrowOnError());
487 return itTime;
488 }
493 void requestTimeAsync(HelicsTime time)
494 {
495 helicsFederateRequestTimeAsync(fed, time, hThrowOnError());
496 }
497
504 void requestTimeIterativeAsync(HelicsTime time, HelicsIterationRequest iterate)
505 {
506 helicsFederateRequestTimeIterativeAsync(fed, time, iterate, hThrowOnError());
507 }
508
511 HelicsTime requestTimeComplete()
512 {
513 return helicsFederateRequestTimeComplete(fed, hThrowOnError());
514 }
515
519 HelicsIterationTime requestTimeIterativeComplete()
520 {
521 HelicsIterationTime itTime;
522 itTime.grantedTime =
523 helicsFederateRequestTimeIterativeComplete(fed, &(itTime.status), hThrowOnError());
524 return itTime;
525 }
526
527 void processCommunication(HelicsTime period)
528 {
529 helicsFederateProcessCommunications(fed, period, HELICS_IGNORE_ERROR);
530 }
532 const char* getName() const { return helicsFederateGetName(fed); }
533
535 void protect() { helicsFederateProtect(helicsFederateGetName(fed), HELICS_IGNORE_ERROR); }
536
538 void unProtect() { helicsFederateUnProtect(helicsFederateGetName(fed), HELICS_IGNORE_ERROR); }
539
553 std::string query(const std::string& target,
554 const std::string& queryStr,
555 HelicsSequencingModes mode = HELICS_SEQUENCING_MODE_FAST) const
556 {
557 // returns HelicsQuery
558 HelicsQuery q = helicsCreateQuery(target.c_str(), queryStr.c_str());
559 if (mode != HELICS_SEQUENCING_MODE_FAST) {
560 helicsQuerySetOrdering(q, mode, HELICS_IGNORE_ERROR);
561 }
562 std::string result(helicsQueryExecute(q, fed, hThrowOnError()));
563 helicsQueryFree(q);
564 return result;
565 }
566
580 std::string query(const std::string& queryStr,
581 HelicsSequencingModes mode = HELICS_SEQUENCING_MODE_FAST) const
582 {
583 // returns HelicsQuery
584 HelicsQuery q = helicsCreateQuery(HELICS_NULL_POINTER, queryStr.c_str());
585 if (mode != HELICS_SEQUENCING_MODE_FAST) {
586 helicsQuerySetOrdering(q, mode, HELICS_IGNORE_ERROR);
587 }
588 std::string result(helicsQueryExecute(q, fed, hThrowOnError()));
589 helicsQueryFree(q);
590 return result;
591 }
592
600 void sendCommand(const std::string& target, const std::string& cmd)
601 {
602 helicsFederateSendCommand(fed, target.c_str(), cmd.c_str(), HELICS_IGNORE_ERROR);
603 }
604
611 const char* getCommand() { return helicsFederateGetCommand(fed, HELICS_IGNORE_ERROR); }
612
619 const char* waitCommand() { return helicsFederateWaitCommand(fed, HELICS_IGNORE_ERROR); }
620
627 const char* getCommandSource()
628 {
629 return helicsFederateGetCommandSource(fed, HELICS_IGNORE_ERROR);
630 }
631
632 void setQueryCallback(
633 void (*queryAnswer)(const char* query, int querySize, HelicsQueryBuffer, void* userdata),
634 void* userdata)
635
636 {
637 helicsFederateSetQueryCallback(fed, queryAnswer, userdata, hThrowOnError());
638 }
639
640 void setTimeRequestEntryCallback(void (*timeRequestEntry)(HelicsTime currentTime,
641 HelicsTime requestTime,
642 HelicsBool iterating,
643 void* userdata),
644 void* userdata)
645
646 {
647 helicsFederateSetTimeRequestEntryCallback(fed, timeRequestEntry, userdata, hThrowOnError());
648 }
649
650 void setTimeUpdateCallback(void (*timeUpdate)(HelicsTime time,
651 HelicsBool iterating,
652 void* userdata),
653 void* userdata)
654
655 {
656 helicsFederateSetTimeUpdateCallback(fed, timeUpdate, userdata, hThrowOnError());
657 }
658
659 void setStateChangeCallback(void (*stateChange)(HelicsFederateState newState,
660 HelicsFederateState oldState,
661 void* userdata),
662 void* userdata)
663
664 {
665 helicsFederateSetStateChangeCallback(fed, stateChange, userdata, hThrowOnError());
666 }
667
668 void setTimeRequestReturnCallback(void (*timeRequestReturn)(HelicsTime newTime,
669 HelicsBool iterating,
670 void* userdata),
671 void* userdata)
672
673 {
674 helicsFederateSetTimeRequestReturnCallback(fed,
675 timeRequestReturn,
676 userdata,
677 hThrowOnError());
678 }
679 #if defined(HELICS_HAS_FUNCTIONAL) && HELICS_HAS_FUNCTIONAL != 0
680 void setQueryCallback(std::function<std::string(const std::string&)> callback)
681
682 {
683 checkCallbackAllocation();
684 callbackBuffers[queryCallbackLocation] =
685 new std::function<std::string(const std::string&)>(std::move(callback));
686 helicsFederateSetQueryCallback(fed,
687 details::helicCppQueryCallbackExecutor,
688 callbackBuffers[queryCallbackLocation],
689 hThrowOnError());
690 }
691
692 void setTimeRequestEntryCallback(
693 std::function<void(HelicsTime currentTime, HelicsTime requestTime, bool iterating)>
694 callback)
695
696 {
697 checkCallbackAllocation();
698 callbackBuffers[timeRequestEntryCallbackLocation] =
699 new std::function<void(HelicsTime, HelicsTime, bool)>(std::move(callback));
700 helicsFederateSetTimeRequestEntryCallback(fed,
701 details::helicCppTimeRequestEntryCallbackExecutor,
702 callbackBuffers[timeRequestEntryCallbackLocation],
703 hThrowOnError());
704 }
705
706 void setTimeUpdateCallback(std::function<void(HelicsTime time, bool iterating)> callback)
707
708 {
709 checkCallbackAllocation();
710 callbackBuffers[timeUpdateCallbackLocation] =
711 new std::function<void(HelicsTime time, bool iterating)>(std::move(callback));
712 helicsFederateSetTimeUpdateCallback(fed,
713 details::helicCppTimeUpdateCallbackExecutor,
714 callbackBuffers[timeUpdateCallbackLocation],
715 hThrowOnError());
716 }
717
718 void setStateChangeCallback(
719 std::function<void(HelicsFederateState, HelicsFederateState)> callback)
720
721 {
722 checkCallbackAllocation();
723 callbackBuffers[stateChangeCallbackLocation] =
724 new std::function<void(HelicsFederateState, HelicsFederateState)>(std::move(callback));
725 helicsFederateSetStateChangeCallback(fed,
726 details::helicCppStateChangeCallbackExecutor,
727 callbackBuffers[stateChangeCallbackLocation],
728 hThrowOnError());
729 }
730
731 void setTimeRequestReturnCallback(
732 std::function<void(HelicsTime newTime, bool iterating)> callback)
733
734 {
735 checkCallbackAllocation();
736 callbackBuffers[timeRequestReturnCallbackLocation] =
737 new std::function<void(HelicsTime, bool)>(std::move(callback));
738 helicsFederateSetTimeRequestReturnCallback(
739 fed,
740 details::helicCppTimeRequestReturnCallbackExecutor,
741 callbackBuffers[timeRequestReturnCallbackLocation],
742 hThrowOnError());
743 }
744 #endif
750 Filter registerFilter(HelicsFilterTypes type, const std::string& filterName = std::string())
751 {
752 return Filter(helicsFederateRegisterFilter(fed, type, filterName.c_str(), hThrowOnError()));
753 }
754
761 CloningFilter registerCloningFilter(const std::string& deliveryEndpoint)
762 {
763 return CloningFilter(
764 helicsFederateRegisterCloningFilter(fed, deliveryEndpoint.c_str(), hThrowOnError()));
765 }
771 Filter registerGlobalFilter(HelicsFilterTypes type,
772 const std::string& filterName = std::string())
773 {
774 return Filter(
775 helicsFederateRegisterGlobalFilter(fed, type, filterName.c_str(), hThrowOnError()));
776 }
777
784 CloningFilter registerGlobalCloningFilter(const std::string& deliveryEndpoint)
785 {
786 return CloningFilter(helicsFederateRegisterGlobalCloningFilter(fed,
787 deliveryEndpoint.c_str(),
788 hThrowOnError()));
789 }
791 int getFilterCount() const { return helicsFederateGetFilterCount(fed); }
795 Filter getFilter(const std::string& filterName)
796 {
797 return Filter(helicsFederateGetFilter(fed, filterName.c_str(), hThrowOnError()));
798 }
802 Filter getFilter(int index)
803 {
804 return Filter(helicsFederateGetFilterByIndex(fed, index, hThrowOnError()));
805 }
806
812 void setGlobal(const std::string& valueName, const std::string& value)
813 {
814 helicsFederateSetGlobal(fed, valueName.c_str(), value.c_str(), hThrowOnError());
815 }
816
821 void addAlias(const std::string& interfaceName, const std::string& alias)
822 {
823 helicsFederateAddAlias(fed, interfaceName.c_str(), alias.c_str(), hThrowOnError());
824 }
825
831 void setTag(const std::string& tag, const std::string& value)
832 {
833 helicsFederateSetTag(fed, tag.c_str(), value.c_str(), hThrowOnError());
834 }
841 const char* getTag(const std::string& tag) const
842 {
843 return helicsFederateGetTag(fed, tag.c_str(), hThrowOnError());
844 }
845
850 void addDependency(const std::string& fedName)
851 {
852 helicsFederateAddDependency(fed, fedName.c_str(), hThrowOnError());
853 }
854
859 void localError(int errorCode, const std::string& errorString)
860 {
861 helicsFederateLocalError(fed, errorCode, errorString.c_str(), hThrowOnError());
862 }
863
868 void globalError(int errorCode, const std::string& errorString)
869 {
870 helicsFederateGlobalError(fed, errorCode, errorString.c_str(), hThrowOnError());
871 }
872
874 void logErrorMessage(const std::string& message)
875 {
876 helicsFederateLogErrorMessage(fed, message.c_str(), hThrowOnError());
877 }
879 void logWarningMessage(const std::string& message)
880 {
881 helicsFederateLogWarningMessage(fed, message.c_str(), hThrowOnError());
882 }
884 void logInfoMessage(const std::string& message)
885 {
886 helicsFederateLogInfoMessage(fed, message.c_str(), hThrowOnError());
887 }
889 void logDebugMessage(const std::string& message)
890 {
891 helicsFederateLogDebugMessage(fed, message.c_str(), hThrowOnError());
892 }
894 void logMessage(int level, const std::string& message)
895 {
896 helicsFederateLogLevelMessage(fed, level, message.c_str(), hThrowOnError());
897 }
899 HelicsCore getCore() { return helicsFederateGetCore(fed, hThrowOnError()); }
901 HelicsFederate getObject() const { return fed; }
902
903 protected:
904 HelicsFederate fed;
905 bool exec_async_iterate;
906 #if defined(HELICS_HAS_FUNCTIONAL) && HELICS_HAS_FUNCTIONAL != 0
907 private:
908 static constexpr int numberOfCallbacks = 5;
909 static constexpr int timeRequestEntryCallbackLocation = 0;
910 static constexpr int timeUpdateCallbackLocation = 1;
911 static constexpr int stateChangeCallbackLocation = 2;
912 static constexpr int queryCallbackLocation = 3;
913 static constexpr int timeRequestReturnCallbackLocation = 4;
914 void** callbackBuffers{nullptr};
915
916 void checkCallbackAllocation()
917 {
918 if (callbackBuffers == nullptr) {
919 callbackBuffers = new void*[numberOfCallbacks];
920 for (int ii = 0; ii < numberOfCallbacks; ++ii) {
921 callbackBuffers[ii] = nullptr;
922 }
923 }
924 }
925 void freeCallbacks()
926 {
927 if (callbackBuffers == nullptr) {
928 return;
929 }
930 if (callbackBuffers[queryCallbackLocation] != nullptr) {
931 auto cback = reinterpret_cast<std::function<std::string(const std::string&)>*>(
932 callbackBuffers[queryCallbackLocation]);
933 delete cback;
934 }
935 if (callbackBuffers[timeRequestEntryCallbackLocation] != nullptr) {
936 auto cback = reinterpret_cast<std::function<void(HelicsTime, HelicsTime, bool)>*>(
937 callbackBuffers[timeRequestEntryCallbackLocation]);
938 delete cback;
939 }
940 if (callbackBuffers[timeUpdateCallbackLocation] != nullptr) {
941 auto cback = reinterpret_cast<std::function<void(HelicsTime, bool)>*>(
942 callbackBuffers[timeUpdateCallbackLocation]);
943 delete cback;
944 }
945 if (callbackBuffers[stateChangeCallbackLocation] != nullptr) {
946 auto cback =
947 reinterpret_cast<std::function<void(HelicsFederateState, HelicsFederateState)>*>(
948 callbackBuffers[stateChangeCallbackLocation]);
949 delete cback;
950 }
951 if (callbackBuffers[timeRequestReturnCallbackLocation] != nullptr) {
952 auto cback = reinterpret_cast<std::function<void(HelicsTime, bool)>*>(
953 callbackBuffers[timeRequestReturnCallbackLocation]);
954 delete cback;
955 }
956 delete[] callbackBuffers;
957 }
958 #endif
959 };
960
961 inline void protect(const std::string& name)
962 {
963 helicsFederateProtect(name.c_str(), hThrowOnError());
964 }
965 inline void unProtect(const std::string& name)
966 {
967 helicsFederateUnProtect(name.c_str(), hThrowOnError());
968 }
969
970 inline bool isProtected(const std::string& name)
971 {
972 return (helicsFederateIsProtected(name.c_str(), hThrowOnError()) == HELICS_TRUE) ? true : false;
973 }
974
975 } // namespace helicscpp
976
977 #endif
helicsFederateRegisterCloningFilter
HelicsFilter helicsFederateRegisterCloningFilter(HelicsFederate fed, const char *name, HelicsError *err)
Definition: MessageFiltersExport.cpp:167
helicsFederateGetFilterCount
int helicsFederateGetFilterCount(HelicsFederate fed)
Definition: MessageFiltersExport.cpp:255
helicsFederateRegisterGlobalCloningFilter
HelicsFilter helicsFederateRegisterGlobalCloningFilter(HelicsFederate fed, const char *name, HelicsError *err)
Definition: MessageFiltersExport.cpp:187
helicsFederateGetFilterByIndex
HelicsFilter helicsFederateGetFilterByIndex(HelicsFederate fed, int index, HelicsError *err)
Definition: MessageFiltersExport.cpp:264
helicsFederateGetFilter
HelicsFilter helicsFederateGetFilter(HelicsFederate fed, const char *name, HelicsError *err)
Definition: MessageFiltersExport.cpp:231
helicsFederateRegisterGlobalFilter
HelicsFilter helicsFederateRegisterGlobalFilter(HelicsFederate fed, HelicsFilterTypes type, const char *name, HelicsError *err)
Definition: MessageFiltersExport.cpp:124
helicsFederateRegisterFilter
HelicsFilter helicsFederateRegisterFilter(HelicsFederate fed, HelicsFilterTypes type, const char *name, HelicsError *err)
Definition: MessageFiltersExport.cpp:103
HelicsFederateInfo
void * HelicsFederateInfo
Definition: api-data.h:77
HelicsCore
void * HelicsCore
Definition: api-data.h:54
HelicsTime
double HelicsTime
Definition: api-data.h:106
HelicsIterationResult
HelicsIterationResult
Definition: api-data.h:137
HELICS_ITERATION_RESULT_NEXT_STEP
@ HELICS_ITERATION_RESULT_NEXT_STEP
Definition: api-data.h:138
HelicsBool
int HelicsBool
Definition: api-data.h:118
HelicsQuery
void * HelicsQuery
Definition: api-data.h:83
HelicsFederateState
HelicsFederateState
Definition: api-data.h:147
HelicsIterationRequest
HelicsIterationRequest
Definition: api-data.h:126
HELICS_ITERATION_REQUEST_NO_ITERATION
@ HELICS_ITERATION_REQUEST_NO_ITERATION
Definition: api-data.h:127
HelicsFederate
void * HelicsFederate
Definition: api-data.h:65
HELICS_FALSE
const HelicsBool HELICS_FALSE
Definition: api-data.h:121
HelicsQueryBuffer
void * HelicsQueryBuffer
Definition: api-data.h:94
HELICS_TRUE
const HelicsBool HELICS_TRUE
Definition: api-data.h:120
helicscpp::CloningFilter
Definition: Filter.hpp:126
helicscpp::FederateInfo
Definition: cpp98/Federate.hpp:28
helicscpp::FederateInfo::FederateInfo
FederateInfo(int coretype)
Definition: cpp98/Federate.hpp:41
helicscpp::FederateInfo::FederateInfo
FederateInfo(const FederateInfo &otherFedInfo)
Definition: cpp98/Federate.hpp:47
helicscpp::FederateInfo::setCoreType
void setCoreType(int coretype)
Definition: cpp98/Federate.hpp:113
helicscpp::FederateInfo::setProperty
void setProperty(int integerProperty, int propertyValue)
Definition: cpp98/Federate.hpp:154
helicscpp::FederateInfo::setProperty
void setProperty(int timeProperty, HelicsTime timeValue)
Definition: cpp98/Federate.hpp:146
helicscpp::FederateInfo::~FederateInfo
~FederateInfo()
Definition: cpp98/Federate.hpp:76
helicscpp::FederateInfo::operator=
FederateInfo & operator=(const FederateInfo &otherFedInfo)
Definition: cpp98/Federate.hpp:52
helicscpp::FederateInfo::setFlagOption
void setFlagOption(int flag, bool value=true)
Definition: cpp98/Federate.hpp:135
helicscpp::FederateInfo::setBrokerInit
void setBrokerInit(const std::string &brokerInit)
Set a string for the broker initialization in command line argument format.
Definition: cpp98/Federate.hpp:99
helicscpp::FederateInfo::setCoreName
void setCoreName(const std::string &coreName)
Definition: cpp98/Federate.hpp:83
helicscpp::FederateInfo::setBroker
void setBroker(const std::string &broker)
Definition: cpp98/Federate.hpp:120
helicscpp::FederateInfo::FederateInfo
FederateInfo(const std::string &coretype)
Definition: cpp98/Federate.hpp:34
helicscpp::FederateInfo::setBrokerKey
void setBrokerKey(const std::string &brokerkey)
Definition: cpp98/Federate.hpp:127
helicscpp::FederateInfo::setCoreType
void setCoreType(const std::string &coretype)
Definition: cpp98/Federate.hpp:106
helicscpp::FederateInfo::FederateInfo
FederateInfo()
Definition: cpp98/Federate.hpp:31
helicscpp::FederateInfo::setSeparator
void setSeparator(char sep)
Set the separator character.
Definition: cpp98/Federate.hpp:88
helicscpp::FederateInfo::getInfo
HelicsFederateInfo getInfo()
Definition: cpp98/Federate.hpp:163
helicscpp::FederateInfo::setCoreInit
void setCoreInit(const std::string &coreInit)
Definition: cpp98/Federate.hpp:94
helicscpp::Federate
Definition: cpp98/Federate.hpp:229
helicscpp::Federate::enterInitializingMode
void enterInitializingMode()
Definition: cpp98/Federate.hpp:359
helicscpp::Federate::getCurrentTime
HelicsTime getCurrentTime()
Definition: cpp98/Federate.hpp:459
helicscpp::Federate::registerGlobalFilter
Filter registerGlobalFilter(HelicsFilterTypes type, const std::string &filterName=std::string())
Definition: cpp98/Federate.hpp:771
helicscpp::Federate::unProtect
void unProtect()
Definition: cpp98/Federate.hpp:538
helicscpp::Federate::getName
const char * getName() const
Definition: cpp98/Federate.hpp:532
helicscpp::Federate::query
std::string query(const std::string &queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST) const
Definition: cpp98/Federate.hpp:580
helicscpp::Federate::fed
HelicsFederate fed
underlying HelicsFederate object
Definition: cpp98/Federate.hpp:904
helicscpp::Federate::getTimeProperty
HelicsTime getTimeProperty(int tProperty) const
Definition: cpp98/Federate.hpp:314
helicscpp::Federate::enterExecutingModeComplete
HelicsIterationResult enterExecutingModeComplete()
Definition: cpp98/Federate.hpp:439
helicscpp::Federate::getCommand
const char * getCommand()
Definition: cpp98/Federate.hpp:611
helicscpp::Federate::setProperty
void setProperty(int intProperty, int value)
Definition: cpp98/Federate.hpp:299
helicscpp::Federate::protect
void protect()
Definition: cpp98/Federate.hpp:535
helicscpp::Federate::enterInitializingModeComplete
void enterInitializingModeComplete()
Definition: cpp98/Federate.hpp:372
helicscpp::Federate::enterExecutingModeAsync
void enterExecutingModeAsync(HelicsIterationRequest iterate=HELICS_ITERATION_REQUEST_NO_ITERATION)
Definition: cpp98/Federate.hpp:423
helicscpp::Federate::requestTimeComplete
HelicsTime requestTimeComplete()
Definition: cpp98/Federate.hpp:511
helicscpp::Federate::logWarningMessage
void logWarningMessage(const std::string &message)
Definition: cpp98/Federate.hpp:879
helicscpp::Federate::registerInterfaces
void registerInterfaces(const std::string &configString)
Definition: cpp98/Federate.hpp:338
helicscpp::Federate::localError
void localError(int errorCode, const std::string &errorString)
Definition: cpp98/Federate.hpp:859
helicscpp::Federate::addAlias
void addAlias(const std::string &interfaceName, const std::string &alias)
Definition: cpp98/Federate.hpp:821
helicscpp::Federate::getObject
HelicsFederate getObject() const
Definition: cpp98/Federate.hpp:901
helicscpp::Federate::enterInitializingModeIterativeAsync
void enterInitializingModeIterativeAsync()
Definition: cpp98/Federate.hpp:390
helicscpp::Federate::requestTimeIterativeComplete
HelicsIterationTime requestTimeIterativeComplete()
Definition: cpp98/Federate.hpp:519
helicscpp::Federate::requestTimeAdvance
HelicsTime requestTimeAdvance(HelicsTime timeDelta)
Definition: cpp98/Federate.hpp:474
helicscpp::Federate::requestNextStep
HelicsTime requestNextStep()
Definition: cpp98/Federate.hpp:469
helicscpp::Federate::registerCloningFilter
CloningFilter registerCloningFilter(const std::string &deliveryEndpoint)
Definition: cpp98/Federate.hpp:761
helicscpp::Federate::getFilter
Filter getFilter(int index)
Definition: cpp98/Federate.hpp:802
helicscpp::Federate::getFlagOption
bool getFlagOption(int flag) const
Definition: cpp98/Federate.hpp:307
helicscpp::Federate::requestTimeAsync
void requestTimeAsync(HelicsTime time)
Definition: cpp98/Federate.hpp:493
helicscpp::Federate::getCurrentMode
HelicsFederateState getCurrentMode() const
Definition: cpp98/Federate.hpp:343
helicscpp::Federate::enterInitializingModeIterativeComplete
void enterInitializingModeIterativeComplete()
Definition: cpp98/Federate.hpp:398
helicscpp::Federate::Federate
Federate(const Federate &fedObj)
Copy constructor.
Definition: cpp98/Federate.hpp:234
helicscpp::Federate::isAsyncOperationCompleted
bool isAsyncOperationCompleted() const
Definition: cpp98/Federate.hpp:351
helicscpp::Federate::registerFilter
Filter registerFilter(HelicsFilterTypes type, const std::string &filterName=std::string())
Definition: cpp98/Federate.hpp:750
helicscpp::Federate::setProperty
void setProperty(int tProperty, HelicsTime timeValue)
Definition: cpp98/Federate.hpp:291
helicscpp::Federate::finalize
void finalize()
Definition: cpp98/Federate.hpp:452
helicscpp::Federate::getCommandSource
const char * getCommandSource()
Definition: cpp98/Federate.hpp:627
helicscpp::Federate::getIntegerProperty
int getIntegerProperty(int intProperty) const
Definition: cpp98/Federate.hpp:321
helicscpp::Federate::setGlobal
void setGlobal(const std::string &valueName, const std::string &value)
Definition: cpp98/Federate.hpp:812
helicscpp::Federate::getFilterCount
int getFilterCount() const
Definition: cpp98/Federate.hpp:791
helicscpp::Federate::setFlagOption
void setFlagOption(int flag, bool flagValue=true)
Definition: cpp98/Federate.hpp:280
helicscpp::Federate::baseObject
HelicsFederate baseObject() const
Definition: cpp98/Federate.hpp:275
helicscpp::Federate::getTag
const char * getTag(const std::string &tag) const
Definition: cpp98/Federate.hpp:841
helicscpp::Federate::setTag
void setTag(const std::string &tag, const std::string &value)
Definition: cpp98/Federate.hpp:831
helicscpp::Federate::logErrorMessage
void logErrorMessage(const std::string &message)
Definition: cpp98/Federate.hpp:874
helicscpp::Federate::logInfoMessage
void logInfoMessage(const std::string &message)
Definition: cpp98/Federate.hpp:884
helicscpp::Federate::registerGlobalCloningFilter
CloningFilter registerGlobalCloningFilter(const std::string &deliveryEndpoint)
Definition: cpp98/Federate.hpp:784
helicscpp::Federate::requestTimeIterativeAsync
void requestTimeIterativeAsync(HelicsTime time, HelicsIterationRequest iterate)
Definition: cpp98/Federate.hpp:504
helicscpp::Federate::logDebugMessage
void logDebugMessage(const std::string &message)
Definition: cpp98/Federate.hpp:889
helicscpp::Federate::logMessage
void logMessage(int level, const std::string &message)
Definition: cpp98/Federate.hpp:894
helicscpp::Federate::addDependency
void addDependency(const std::string &fedName)
Definition: cpp98/Federate.hpp:850
helicscpp::Federate::exec_async_iterate
bool exec_async_iterate
indicator that the federate is in an async operation
Definition: cpp98/Federate.hpp:905
helicscpp::Federate::sendCommand
void sendCommand(const std::string &target, const std::string &cmd)
Definition: cpp98/Federate.hpp:600
helicscpp::Federate::enterInitializingModeAsync
void enterInitializingModeAsync()
Definition: cpp98/Federate.hpp:364
helicscpp::Federate::enterInitializingModeIterative
void enterInitializingModeIterative()
Definition: cpp98/Federate.hpp:382
helicscpp::Federate::operator=
Federate & operator=(const Federate &fedObj)
Copy assignment operator.
Definition: cpp98/Federate.hpp:239
helicscpp::Federate::~Federate
virtual ~Federate()
Definition: cpp98/Federate.hpp:263
helicscpp::Federate::getFilter
Filter getFilter(const std::string &filterName)
Definition: cpp98/Federate.hpp:795
helicscpp::Federate::query
std::string query(const std::string &target, const std::string &queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST) const
Definition: cpp98/Federate.hpp:553
helicscpp::Federate::globalError
void globalError(int errorCode, const std::string &errorString)
Definition: cpp98/Federate.hpp:868
helicscpp::Federate::setSeparator
void setSeparator(char sep)
Definition: cpp98/Federate.hpp:332
helicscpp::Federate::requestTimeIterative
HelicsIterationTime requestTimeIterative(HelicsTime time, HelicsIterationRequest iterate)
Definition: cpp98/Federate.hpp:482
helicscpp::Federate::requestTime
HelicsTime requestTime(HelicsTime time)
Definition: cpp98/Federate.hpp:463
helicscpp::Federate::finalizeAsync
void finalizeAsync()
Definition: cpp98/Federate.hpp:455
helicscpp::Federate::finalizeComplete
void finalizeComplete()
Definition: cpp98/Federate.hpp:457
helicscpp::Federate::waitCommand
const char * waitCommand()
Definition: cpp98/Federate.hpp:619
helicscpp::Federate::enterExecutingMode
HelicsIterationResult enterExecutingMode(HelicsIterationRequest iterate=HELICS_ITERATION_REQUEST_NO_ITERATION)
Definition: cpp98/Federate.hpp:408
helicscpp::Federate::Federate
Federate() HELICS_NOTHROW
Default constructor.
Definition: cpp98/Federate.hpp:232
helicscpp::Federate::getCore
HelicsCore getCore()
Definition: cpp98/Federate.hpp:899
helicscpp::Filter
Definition: Filter.hpp:18
helicscpp::hThrowOnError
Definition: helicsExceptions.hpp:38
helicsFederateSetTimeRequestReturnCallback
void helicsFederateSetTimeRequestReturnCallback(HelicsFederate fed, void(*requestTimeReturn)(HelicsTime newTime, HelicsBool iterating, void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1382
helicsFederateSetTimeRequestEntryCallback
void helicsFederateSetTimeRequestEntryCallback(HelicsFederate fed, void(*requestTime)(HelicsTime currentTime, HelicsTime requestTime, HelicsBool iterating, void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1242
helicsFederateSetTimeUpdateCallback
void helicsFederateSetTimeUpdateCallback(HelicsFederate fed, void(*timeUpdate)(HelicsTime newTime, HelicsBool iterating, void *userdata), void *userdata, HelicsError *err)
Definition: helicsCallbacks.cpp:125
helicsFederateSetStateChangeCallback
void helicsFederateSetStateChangeCallback(HelicsFederate fed, void(*stateChange)(HelicsFederateState newState, HelicsFederateState oldState, void *userdata), void *userdata, HelicsError *err)
Definition: FederateExport.cpp:1268
helicsFederateSetQueryCallback
void helicsFederateSetQueryCallback(HelicsFederate fed, void(*queryAnswer)(const char *query, int querySize, HelicsQueryBuffer buffer, void *userdata), void *userdata, HelicsError *err)
Definition: helicsCallbacks.cpp:98
helicsQueryBufferFill
void helicsQueryBufferFill(HelicsQueryBuffer buffer, const char *queryResult, int strSize, HelicsError *err)
Definition: helicsCallbacks.cpp:149
helicsFederateAddAlias
void helicsFederateAddAlias(HelicsFederate fed, const char *interfaceName, const char *alias, HelicsError *err)
Definition: FederateExport.cpp:1630
helicsFederateEnterInitializingModeIterative
void helicsFederateEnterInitializingModeIterative(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:899
helicsFederateRequestTimeIterativeComplete
HelicsTime helicsFederateRequestTimeIterativeComplete(HelicsFederate fed, HelicsIterationResult *outIterate, HelicsError *err)
Definition: FederateExport.cpp:1185
helicsFederateIsProtected
HelicsBool helicsFederateIsProtected(const char *fedName, HelicsError *err)
Definition: FederateExport.cpp:689
helicsFederateSetGlobal
void helicsFederateSetGlobal(HelicsFederate fed, const char *valueName, const char *value, HelicsError *err)
Definition: FederateExport.cpp:1607
helicsFederateEnterInitializingModeIterativeAsync
void helicsFederateEnterInitializingModeIterativeAsync(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:913
helicsFederateEnterExecutingModeIterativeComplete
HelicsIterationResult helicsFederateEnterExecutingModeIterativeComplete(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1048
helicsFederateWaitCommand
const char * helicsFederateWaitCommand(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1807
helicsFederateGetCommand
const char * helicsFederateGetCommand(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1782
helicsFederateGetCore
HelicsCore helicsFederateGetCore(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:712
helicsFederateLogInfoMessage
void helicsFederateLogInfoMessage(HelicsFederate fed, const char *logmessage, HelicsError *err)
Definition: FederateExport.cpp:1754
helicsFederateRequestTimeIterativeAsync
void helicsFederateRequestTimeIterativeAsync(HelicsFederate fed, HelicsTime requestTime, HelicsIterationRequest iterate, HelicsError *err)
Definition: FederateExport.cpp:1171
helicsFederateGetTag
const char * helicsFederateGetTag(HelicsFederate fed, const char *tagName, HelicsError *err)
Definition: FederateExport.cpp:1675
helicsFederateEnterExecutingModeComplete
void helicsFederateEnterExecutingModeComplete(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1035
helicsFederateSetIntegerProperty
void helicsFederateSetIntegerProperty(HelicsFederate fed, int intProperty, int propertyVal, HelicsError *err)
Definition: FederateExport.cpp:1517
helicsFederateSetTag
void helicsFederateSetTag(HelicsFederate fed, const char *tagName, const char *value, HelicsError *err)
Definition: FederateExport.cpp:1655
helicsFederateEnterInitializingModeIterativeComplete
void helicsFederateEnterInitializingModeIterativeComplete(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:927
helicsFederateLogWarningMessage
void helicsFederateLogWarningMessage(HelicsFederate fed, const char *logmessage, HelicsError *err)
Definition: FederateExport.cpp:1749
helicsFederateInfoLoadFromString
void helicsFederateInfoLoadFromString(HelicsFederateInfo fedInfo, const char *args, HelicsError *err)
Definition: FederateExport.cpp:242
helicsFederateClone
HelicsFederate helicsFederateClone(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:630
helicsFederateInfoSetSeparator
void helicsFederateInfoSetSeparator(HelicsFederateInfo fedInfo, char separator, HelicsError *err)
Definition: FederateExport.cpp:446
helicsFederateAddDependency
void helicsFederateAddDependency(HelicsFederate fed, const char *fedName, HelicsError *err)
Definition: FederateExport.cpp:1698
helicsFederateGetCurrentTime
HelicsTime helicsFederateGetCurrentTime(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1596
helicsFederateFinalize
void helicsFederateFinalize(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:778
helicsCreateFederateInfo
HelicsFederateInfo helicsCreateFederateInfo(void)
Definition: FederateExport.cpp:176
helicsFederateRequestTimeAdvance
HelicsTime helicsFederateRequestTimeAdvance(HelicsFederate fed, HelicsTime timeDelta, HelicsError *err)
Definition: FederateExport.cpp:1080
helicsFederateInfoFree
void helicsFederateInfoFree(HelicsFederateInfo fedInfo)
Definition: FederateExport.cpp:212
helicsFederateSendCommand
void helicsFederateSendCommand(HelicsFederate fed, const char *target, const char *command, HelicsError *err)
Definition: FederateExport.cpp:1773
helicsFederateSetTimeProperty
void helicsFederateSetTimeProperty(HelicsFederate fed, int timeProperty, HelicsTime time, HelicsError *err)
Definition: FederateExport.cpp:1487
helicsFederateRequestTimeComplete
HelicsTime helicsFederateRequestTimeComplete(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1155
helicsFederateInfoSetFlagOption
void helicsFederateInfoSetFlagOption(HelicsFederateInfo fedInfo, int flag, HelicsBool value, HelicsError *err)
Definition: FederateExport.cpp:414
helicsFederateEnterInitializingModeComplete
void helicsFederateEnterInitializingModeComplete(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:885
helicsQuerySetOrdering
void helicsQuerySetOrdering(HelicsQuery query, int32_t mode, HelicsError *err)
Definition: helicsExport.cpp:1305
helicsFederateLogErrorMessage
void helicsFederateLogErrorMessage(HelicsFederate fed, const char *logmessage, HelicsError *err)
Definition: FederateExport.cpp:1744
helicsFederateEnterExecutingMode
void helicsFederateEnterExecutingMode(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:941
helicsFederateRequestNextStep
HelicsTime helicsFederateRequestNextStep(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1096
helicsFederateUnProtect
void helicsFederateUnProtect(const char *fedName, HelicsError *err)
Definition: FederateExport.cpp:674
helicsFederateRequestTime
HelicsTime helicsFederateRequestTime(HelicsFederate fed, HelicsTime requestTime, HelicsError *err)
Definition: FederateExport.cpp:1064
helicsFederateInfoSetBrokerInitString
void helicsFederateInfoSetBrokerInitString(HelicsFederateInfo fedInfo, const char *brokerInit, HelicsError *err)
Definition: FederateExport.cpp:284
helicsFederateGetCommandSource
const char * helicsFederateGetCommandSource(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1797
helicsFederateFinalizeAsync
void helicsFederateFinalizeAsync(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:783
helicsQueryFree
void helicsQueryFree(HelicsQuery query)
Definition: helicsExport.cpp:1314
helicsFederateLocalError
void helicsFederateLocalError(HelicsFederate fed, int errorCode, const char *errorString, HelicsError *err)
Definition: FederateExport.cpp:762
helicsFederateGetIntegerProperty
int helicsFederateGetIntegerProperty(HelicsFederate fed, int intProperty, HelicsError *err)
Definition: FederateExport.cpp:1570
helicsFederateGlobalError
void helicsFederateGlobalError(HelicsFederate fed, int errorCode, const char *errorString, HelicsError *err)
Definition: FederateExport.cpp:746
helicsFederateRegisterInterfaces
void helicsFederateRegisterInterfaces(HelicsFederate fed, const char *file, HelicsError *err)
Definition: FederateExport.cpp:728
helicsFederateGetFlagOption
HelicsBool helicsFederateGetFlagOption(HelicsFederate fed, int flag, HelicsError *err)
Definition: FederateExport.cpp:1552
helicsFederateRequestTimeIterative
HelicsTime helicsFederateRequestTimeIterative(HelicsFederate fed, HelicsTime requestTime, HelicsIterationRequest iterate, HelicsIterationResult *outIteration, HelicsError *err)
Definition: FederateExport.cpp:1112
helicsFederateLogDebugMessage
void helicsFederateLogDebugMessage(HelicsFederate fed, const char *logmessage, HelicsError *err)
Definition: FederateExport.cpp:1759
helicsFederateFree
void helicsFederateFree(HelicsFederate fed)
Definition: helicsExport.cpp:1059
helicsCreateQuery
HelicsQuery helicsCreateQuery(const char *target, const char *query)
Definition: helicsExport.cpp:1128
helicsFederateLogLevelMessage
void helicsFederateLogLevelMessage(HelicsFederate fed, int loglevel, const char *logmessage, HelicsError *err)
Definition: FederateExport.cpp:1764
helicsFederateEnterExecutingModeIterative
HelicsIterationResult helicsFederateEnterExecutingModeIterative(HelicsFederate fed, HelicsIterationRequest iterate, HelicsError *err)
Definition: FederateExport.cpp:991
helicsFederateGetTimeProperty
HelicsTime helicsFederateGetTimeProperty(HelicsFederate fed, int timeProperty, HelicsError *err)
Definition: FederateExport.cpp:1533
helicsFederateInfoSetBroker
void helicsFederateInfoSetBroker(HelicsFederateInfo fedInfo, const char *broker, HelicsError *err)
Definition: FederateExport.cpp:328
helicsFederateIsAsyncOperationCompleted
HelicsBool helicsFederateIsAsyncOperationCompleted(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:870
helicsFederateInfoSetCoreInitString
void helicsFederateInfoSetCoreInitString(HelicsFederateInfo fedInfo, const char *coreInit, HelicsError *err)
Definition: FederateExport.cpp:270
helicsFederateEnterExecutingModeIterativeAsync
void helicsFederateEnterExecutingModeIterativeAsync(HelicsFederate fed, HelicsIterationRequest iterate, HelicsError *err)
Definition: FederateExport.cpp:1021
helicsFederateSetFlagOption
void helicsFederateSetFlagOption(HelicsFederate fed, int flag, HelicsBool flagValue, HelicsError *err)
Definition: FederateExport.cpp:1501
helicsFederateGetName
const char * helicsFederateGetName(HelicsFederate fed)
Definition: FederateExport.cpp:1477
helicsFederateInfoSetCoreType
void helicsFederateInfoSetCoreType(HelicsFederateInfo fedInfo, int coretype, HelicsError *err)
Definition: FederateExport.cpp:298
helicsFederateInfoSetIntegerProperty
void helicsFederateInfoSetIntegerProperty(HelicsFederateInfo fedInfo, int intProperty, int propertyValue, HelicsError *err)
Definition: FederateExport.cpp:455
helicsQueryExecute
const char * helicsQueryExecute(HelicsQuery query, HelicsFederate fed, HelicsError *err)
Definition: helicsExport.cpp:1141
helicsFederateProtect
void helicsFederateProtect(const char *fedName, HelicsError *err)
Definition: FederateExport.cpp:663
helicsFederateFinalizeComplete
void helicsFederateFinalizeComplete(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:788
helicsFederateRequestTimeAsync
void helicsFederateRequestTimeAsync(HelicsFederate fed, HelicsTime requestTime, HelicsError *err)
Definition: FederateExport.cpp:1141
helicsFederateEnterInitializingModeAsync
void helicsFederateEnterInitializingModeAsync(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:856
helicsFederateInfoSetCoreName
void helicsFederateInfoSetCoreName(HelicsFederateInfo fedInfo, const char *corename, HelicsError *err)
Definition: FederateExport.cpp:256
helicsFederateInfoSetTimeProperty
void helicsFederateInfoSetTimeProperty(HelicsFederateInfo fedInfo, int timeProperty, HelicsTime propertyValue, HelicsError *err)
Definition: FederateExport.cpp:437
helicsFederateInfoSetBrokerKey
void helicsFederateInfoSetBrokerKey(HelicsFederateInfo fedInfo, const char *brokerkey, HelicsError *err)
Definition: FederateExport.cpp:342
helicsFederateEnterInitializingMode
void helicsFederateEnterInitializingMode(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:842
helicsFederateGetState
HelicsFederateState helicsFederateGetState(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1231
helicsFederateSetSeparator
void helicsFederateSetSeparator(HelicsFederate fed, char separator, HelicsError *err)
Definition: FederateExport.cpp:1587
helicsFederateInfoSetCoreTypeFromString
void helicsFederateInfoSetCoreTypeFromString(HelicsFederateInfo fedInfo, const char *coretype, HelicsError *err)
Definition: FederateExport.cpp:307
helicsFederateEnterExecutingModeAsync
void helicsFederateEnterExecutingModeAsync(HelicsFederate fed, HelicsError *err)
Definition: FederateExport.cpp:1007
helicsFederateProcessCommunications
void helicsFederateProcessCommunications(HelicsFederate fed, HelicsTime period, HelicsError *err)
Definition: FederateExport.cpp:1210
HelicsFilterTypes
HelicsFilterTypes
Definition: helics_enums.h:391
HelicsSequencingModes
HelicsSequencingModes
Definition: helics_enums.h:427
HELICS_SEQUENCING_MODE_FAST
@ HELICS_SEQUENCING_MODE_FAST
Definition: helics_enums.h:429
helicscpp
Definition: cpp98/Broker.hpp:18
helicscpp::HelicsIterationTime
struct helicscpp::HelicsIterationTime HelicsIterationTime
helicscpp::HelicsIterationTime
Definition: cpp98/Federate.hpp:223
helicscpp::HelicsIterationTime::status
HelicsIterationResult status
the convergence state
Definition: cpp98/Federate.hpp:225
helicscpp::HelicsIterationTime::grantedTime
HelicsTime grantedTime
the time of the granted step
Definition: cpp98/Federate.hpp:224