| helics 3.6.1

FilterInfo.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 "basic_CoreTypes.hpp"
10
11 #include <memory>
12 #include <string>
13 #include <utility>
14 #include <vector>
15
16 namespace helics {
17 struct EptInformation {
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:
32 FilterInfo(GlobalBrokerId core_id_,
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 }
42 const GlobalBrokerId core_id;
43 const InterfaceHandle handle;
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:
65 void addDestinationEndpoint(GlobalHandle dest,
66 std::string_view destName,
67 std::string_view destType);
69 void addSourceEndpoint(GlobalHandle dest,
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
helics::FilterInfo
Definition: FilterInfo.hpp:29
helics::FilterInfo::flags
uint16_t flags
flags for the filter
Definition: FilterInfo.hpp:52
helics::FilterInfo::FilterInfo
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
helics::FilterInfo::addSourceEndpoint
void addSourceEndpoint(GlobalHandle dest, std::string_view sourceName, std::string_view sourceType)
Definition: FilterInfo.cpp:38
helics::FilterInfo::cloning
bool cloning
indicator that the filter is a destination filter
Definition: FilterInfo.hpp:51
helics::FilterInfo::core_id
const GlobalBrokerId core_id
id of the core that manages the filter
Definition: FilterInfo.hpp:42
helics::FilterInfo::filterOp
std::shared_ptr< FilterOperator > filterOp
the callback operation of the filter
Definition: FilterInfo.hpp:54
helics::FilterInfo::removeTarget
void removeTarget(GlobalHandle targetId)
Definition: FilterInfo.cpp:58
helics::FilterInfo::addDestinationEndpoint
void addDestinationEndpoint(GlobalHandle dest, std::string_view destName, std::string_view destType)
Definition: FilterInfo.cpp:18
helics::FilterInfo::key
const std::string key
the identifier of the filter
Definition: FilterInfo.hpp:45
helics::FilterInfo::getDestinationEndpoints
const std::string & getDestinationEndpoints() const
Definition: FilterInfo.cpp:105
helics::FilterInfo::getSourceEndpoints
const std::string & getSourceEndpoints() const
Definition: FilterInfo.cpp:86
helics::FilterInfo::outputType
const std::string outputType
the outputType of data of the filter
Definition: FilterInfo.hpp:47
helics::FilterInfo::inputType
const std::string inputType
the type of data for the filter
Definition: FilterInfo.hpp:46
helics::FilterInfo::handle
const InterfaceHandle handle
id handle of the filter
Definition: FilterInfo.hpp:43
helics::GlobalBrokerId
Definition: GlobalFederateId.hpp:30
helics::GlobalHandle
Definition: GlobalFederateId.hpp:147
helics::InterfaceHandle
Definition: LocalFederateId.hpp:65
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::EptInformation
Definition: FilterInfo.hpp:17