| helics 3.6.1

core/Broker.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 #pragma once
8
9 #include "helicsTime.hpp"
10
11 #include <chrono>
12 #include <functional>
13 #include <string>
14 #include <vector>
15
16 namespace helics {
18 class Broker {
19 public:
21 Broker() = default;
23 virtual ~Broker() = default;
24
27 virtual bool connect() = 0;
30 virtual void disconnect() = 0;
31
33 virtual bool isConnected() const = 0;
36 virtual void setAsRoot() = 0;
39 virtual bool isRoot() const = 0;
40
43 virtual bool isOpenToNewFederates() const = 0;
45 virtual void configure(std::string_view configureString) = 0;
48 virtual void configureFromArgs(int argc, char* argv[]) = 0;
52 virtual void configureFromVector(std::vector<std::string> args) = 0;
54 virtual const std::string& getIdentifier() const = 0;
56 virtual const std::string& getAddress() const = 0;
58 virtual void setLoggingLevel(int logLevel) = 0;
64 virtual void setLoggingCallback(
65 std::function<void(int, std::string_view, std::string_view)> logFunction) = 0;
66
68 virtual void setLogFile(std::string_view lfile) = 0;
69
74 virtual bool waitForDisconnect(
75 std::chrono::milliseconds msToWait = std::chrono::milliseconds(0)) const = 0;
87 virtual std::string query(std::string_view target,
88 std::string_view queryStr,
89 HelicsSequencingModes mode = HELICS_SEQUENCING_MODE_FAST) = 0;
90
98 virtual void setGlobal(std::string_view valueName, std::string_view value) = 0;
99
108 virtual void sendCommand(std::string_view target,
109 std::string_view commandStr,
110 HelicsSequencingModes mode = HELICS_SEQUENCING_MODE_FAST) = 0;
111
114 virtual void makeConnections(const std::string& file) = 0;
118 virtual void linkEndpoints(std::string_view source, std::string_view target) = 0;
122 virtual void dataLink(std::string_view source, std::string_view target) = 0;
127 virtual void addSourceFilterToEndpoint(std::string_view filter, std::string_view target) = 0;
132 virtual void addDestinationFilterToEndpoint(std::string_view filter,
133 std::string_view target) = 0;
139 virtual void addAlias(std::string_view interfaceKey, std::string_view alias) = 0;
141 virtual void setTimeBarrier(Time barrierTime) = 0;
142
144 virtual void clearTimeBarrier() = 0;
145
151 virtual void globalError(int32_t errorCode, std::string_view errorString) = 0;
152 };
153 } // namespace helics
helics::Broker
Definition: core/Broker.hpp:18
helics::Broker::makeConnections
virtual void makeConnections(const std::string &file)=0
helics::Broker::isOpenToNewFederates
virtual bool isOpenToNewFederates() const =0
helics::Broker::getIdentifier
virtual const std::string & getIdentifier() const =0
helics::Broker::addAlias
virtual void addAlias(std::string_view interfaceKey, std::string_view alias)=0
helics::Broker::~Broker
virtual ~Broker()=default
helics::Broker::configureFromArgs
virtual void configureFromArgs(int argc, char *argv[])=0
helics::Broker::configure
virtual void configure(std::string_view configureString)=0
helics::Broker::sendCommand
virtual void sendCommand(std::string_view target, std::string_view commandStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)=0
helics::Broker::waitForDisconnect
virtual bool waitForDisconnect(std::chrono::milliseconds msToWait=std::chrono::milliseconds(0)) const =0
helics::Broker::setLoggingCallback
virtual void setLoggingCallback(std::function< void(int, std::string_view, std::string_view)> logFunction)=0
helics::Broker::linkEndpoints
virtual void linkEndpoints(std::string_view source, std::string_view target)=0
helics::Broker::setAsRoot
virtual void setAsRoot()=0
helics::Broker::query
virtual std::string query(std::string_view target, std::string_view queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)=0
helics::Broker::globalError
virtual void globalError(int32_t errorCode, std::string_view errorString)=0
helics::Broker::setLoggingLevel
virtual void setLoggingLevel(int logLevel)=0
helics::Broker::addSourceFilterToEndpoint
virtual void addSourceFilterToEndpoint(std::string_view filter, std::string_view target)=0
helics::Broker::addDestinationFilterToEndpoint
virtual void addDestinationFilterToEndpoint(std::string_view filter, std::string_view target)=0
helics::Broker::connect
virtual bool connect()=0
helics::Broker::setGlobal
virtual void setGlobal(std::string_view valueName, std::string_view value)=0
helics::Broker::setLogFile
virtual void setLogFile(std::string_view lfile)=0
helics::Broker::setTimeBarrier
virtual void setTimeBarrier(Time barrierTime)=0
helics::Broker::isRoot
virtual bool isRoot() const =0
helics::Broker::isConnected
virtual bool isConnected() const =0
helics::Broker::clearTimeBarrier
virtual void clearTimeBarrier()=0
helics::Broker::dataLink
virtual void dataLink(std::string_view source, std::string_view target)=0
helics::Broker::disconnect
virtual void disconnect()=0
helics::Broker::Broker
Broker()=default
helics::Broker::configureFromVector
virtual void configureFromVector(std::vector< std::string > args)=0
helics::Broker::getAddress
virtual const std::string & getAddress() const =0
helicsTime.hpp
HelicsSequencingModes
HelicsSequencingModes
Definition: helics_enums.h:427
HELICS_SEQUENCING_MODE_FAST
@ HELICS_SEQUENCING_MODE_FAST
Definition: helics_enums.h:429
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::Time
TimeRepresentation< count_time< 9 > > Time
Definition: helicsTime.hpp:27