helics  3.5.2
PotentialInterfacesManager.hpp
1 /*
2 Copyright (c) 2017-2024,
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 <string>
13 #include <string_view>
14 #include <unordered_map>
15 #include <utility>
16 #include <vector>
17 
18 namespace Json {
19 class Value;
20 }
21 
22 namespace helics {
23 class Core;
24 class Federate;
25 
27  public:
30  void loadPotentialInterfaces(Json::Value& json);
32  std::string generateQueryResponse(std::string_view query);
34  void processCommand(std::pair<std::string, std::string> command);
35 
37  void initialize();
38 
39  bool hasExtraCommands() const;
40 
41  std::pair<std::string, std::string> getCommand();
42 
43  private:
44  Core* corePtr{nullptr};
45  Federate* fedPtr{nullptr};
46  std::atomic<bool> respondedToCommand{false};
47  using iMap = std::unordered_map<std::string, Json::Value>;
48  std::map<std::string, iMap> potInterfaces;
49  std::map<std::string, iMap> potInterfaceTemplates;
51  std::deque<std::pair<std::string, std::string>> extraCommands;
52 };
53 } // namespace helics
Definition: core/Core.hpp:41
Definition: application_api/Federate.hpp:48
Definition: PotentialInterfacesManager.hpp:26
void processCommand(std::pair< std::string, std::string > command)
Definition: PotentialInterfacesManager.cpp:96
void initialize()
Definition: PotentialInterfacesManager.cpp:60
void loadPotentialInterfaces(Json::Value &json)
Definition: PotentialInterfacesManager.cpp:23
std::string generateQueryResponse(std::string_view query)
Definition: PotentialInterfacesManager.cpp:68
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14