helics 3.7.0
Loading...
Searching...
No Matches
TypedBrokerServer.hpp
1/*
2Copyright (c) 2017-2026,
3Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Energy
4Innovation LLC. See the top-level NOTICE for additional details. All rights reserved.
5SPDX-License-Identifier: BSD-3-Clause
6*/
7
8#pragma once
9
10#include "../core/ActionMessage.hpp"
11
12#include <memory>
13#include <nlohmann/json_fwd.hpp>
14#include <string>
15#include <tuple>
16#include <vector>
17
18namespace helics {
19class Broker;
20namespace apps {
21
22 using portData = std::vector<std::tuple<int, bool, std::shared_ptr<Broker>>>;
25 public:
26 virtual ~TypedBrokerServer() = default;
28 virtual void startServer(const nlohmann::json* val,
29 const std::shared_ptr<TypedBrokerServer>& ptr) = 0;
31 virtual void stopServer() = 0;
33 virtual void processArgs(std::string_view args);
34
35 protected:
37 static ActionMessage
38 generateMessageResponse(const ActionMessage& rxcmd, portData& pdata, CoreType ctype);
40 static int getOpenPort(portData& portDataList);
41 /* assign a port in the portData structure*/
42 static void assignPort(portData& portDataList, int pnumber, std::shared_ptr<Broker>& brk);
43 /* log a message to the console */
44 static void logMessage(std::string_view message);
45 };
46} // namespace apps
47} // namespace helics
Definition ActionMessage.hpp:30
Definition TypedBrokerServer.hpp:24
virtual void processArgs(std::string_view args)
Definition TypedBrokerServer.cpp:103
virtual void startServer(const nlohmann::json *val, const std::shared_ptr< TypedBrokerServer > &ptr)=0
static ActionMessage generateMessageResponse(const ActionMessage &rxcmd, portData &pdata, CoreType ctype)
Definition TypedBrokerServer.cpp:67
static int getOpenPort(portData &portDataList)
Definition TypedBrokerServer.cpp:106
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition AsyncFedCallInfo.hpp:14
CoreType
Definition CoreTypes.hpp:46