| helics 3.6.1

PotentialInterfacesManager.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 <atomic>
10 #include <deque>
11 #include <map>
12 #include <nlohmann/json_fwd.hpp>
13 #include <string>
14 #include <string_view>
15 #include <unordered_map>
16 #include <utility>
17 #include <vector>
18
19 namespace helics {
20 class Core;
21 class Federate;
22
23 class PotentialInterfacesManager {
24 public:
25 PotentialInterfacesManager(Core* core, Federate* fed);
27 void loadPotentialInterfaces(const nlohmann::json& json);
29 std::string generateQueryResponse(std::string_view query);
31 void processCommand(std::pair<std::string, std::string> command);
32
34 void initialize();
35
36 bool hasExtraCommands() const;
37
38 std::pair<std::string, std::string> getCommand();
39
40 private:
41 Core* corePtr{nullptr};
42 Federate* fedPtr{nullptr};
43 std::atomic<bool> respondedToCommand{false};
44 bool hasPotentialTargetting{true};
45 using iMap = std::unordered_map<std::string, nlohmann::json>;
46 std::map<std::string, iMap> potInterfaces;
47 std::map<std::string, iMap> potInterfaceTemplates;
49 std::deque<std::pair<std::string, std::string>> extraCommands;
50 };
51 } // namespace helics
helics::Core
Definition: core/Core.hpp:41
helics::Federate
Definition: application_api/Federate.hpp:48
helics::PotentialInterfacesManager
Definition: PotentialInterfacesManager.hpp:23
helics::PotentialInterfacesManager::processCommand
void processCommand(std::pair< std::string, std::string > command)
Definition: PotentialInterfacesManager.cpp:123
helics::PotentialInterfacesManager::initialize
void initialize()
Definition: PotentialInterfacesManager.cpp:83
helics::PotentialInterfacesManager::loadPotentialInterfaces
void loadPotentialInterfaces(const nlohmann::json &json)
Definition: PotentialInterfacesManager.cpp:25
helics::PotentialInterfacesManager::generateQueryResponse
std::string generateQueryResponse(std::string_view query)
Definition: PotentialInterfacesManager.cpp:91
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14