helics  3.5.2
FilterInfo.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 "basic_CoreTypes.hpp"
10 
11 #include <memory>
12 #include <string>
13 #include <utility>
14 #include <vector>
15 
16 namespace helics {
18  GlobalHandle id;
19  std::string key;
20  std::string type;
21  EptInformation() = default;
22  EptInformation(GlobalHandle gid, std::string_view key_, std::string_view type_):
23  id(gid), key(key_), type(type_)
24  {
25  }
26 };
27 
29 class FilterInfo {
30  public:
33  InterfaceHandle handle_,
34  std::string_view key_,
35  std::string_view type_in_,
36  std::string_view type_out_,
37  bool destFilter_):
38  core_id(core_id_), handle(handle_), key(key_), inputType(type_in_), outputType(type_out_),
39  dest_filter(destFilter_)
40  {
41  }
44 
45  const std::string key;
46  const std::string inputType;
47  const std::string outputType;
48  std::vector<GlobalHandle> sourceTargets;
49  std::vector<GlobalHandle> destTargets;
50  const bool dest_filter = false;
51  bool cloning = false;
52  uint16_t flags = 0;
53  // there is a 4 byte gap here
54  std::shared_ptr<FilterOperator> filterOp;
55  private:
56  std::vector<EptInformation>
57  sourceEndpoints;
58  std::vector<EptInformation>
59  destEndpoints;
60  mutable std::string sourceEpts;
61  mutable std::string destEpts;
62 
63  public:
66  std::string_view destName,
67  std::string_view destType);
70  std::string_view sourceName,
71  std::string_view sourceType);
73  void removeTarget(GlobalHandle targetId);
75  const std::string& getSourceEndpoints() const;
77  const std::string& getDestinationEndpoints() const;
78 };
79 } // namespace helics
Definition: FilterInfo.hpp:29
uint16_t flags
flags for the filter
Definition: FilterInfo.hpp:52
FilterInfo(GlobalBrokerId core_id_, InterfaceHandle handle_, std::string_view key_, std::string_view type_in_, std::string_view type_out_, bool destFilter_)
Definition: FilterInfo.hpp:32
void addSourceEndpoint(GlobalHandle dest, std::string_view sourceName, std::string_view sourceType)
Definition: FilterInfo.cpp:37
bool cloning
indicator that the filter is a destination filter
Definition: FilterInfo.hpp:51
const GlobalBrokerId core_id
id of the core that manages the filter
Definition: FilterInfo.hpp:42
std::shared_ptr< FilterOperator > filterOp
the callback operation of the filter
Definition: FilterInfo.hpp:54
void removeTarget(GlobalHandle targetId)
Definition: FilterInfo.cpp:57
void addDestinationEndpoint(GlobalHandle dest, std::string_view destName, std::string_view destType)
Definition: FilterInfo.cpp:17
const std::string key
the identifier of the filter
Definition: FilterInfo.hpp:45
const std::string & getDestinationEndpoints() const
Definition: FilterInfo.cpp:104
const std::string & getSourceEndpoints() const
Definition: FilterInfo.cpp:85
const std::string outputType
the outputType of data of the filter
Definition: FilterInfo.hpp:47
const std::string inputType
the type of data for the filter
Definition: FilterInfo.hpp:46
const InterfaceHandle handle
id handle of the filter
Definition: FilterInfo.hpp:43
Definition: GlobalFederateId.hpp:30
Definition: GlobalFederateId.hpp:147
Definition: LocalFederateId.hpp:65
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
Definition: FilterInfo.hpp:17