helics  2.8.1
BasicHandleInfo.hpp
1 /*
2 Copyright (c) 2017-2021,
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_core_types.hpp"
10 #include "flagOperations.hpp"
11 
12 #include <string>
13 
14 namespace helics {
16 enum class handle_type : char {
17  unknown = 'u',
18  publication = 'p',
19  input = 'i',
20  endpoint = 'e',
21  filter = 'f',
22 };
23 
26  mapped_flag = extra_flag1,
28  extra_flag2,
30  extra_flag3,
32 };
34 
37  public:
42  interface_handle handle_id,
43  handle_type type_of_handle,
44  const std::string& key_name,
45  const std::string& type_name,
46  const std::string& unit_name):
47  handle{federate_id, handle_id},
48  handleType(type_of_handle), key(key_name), type(type_name), units(unit_name), type_in(type),
50 
51  {
52  /* NOTE:: all current cases already have std::string they are passing into the function and
53  most are short,so we are taking by reference to avoid a copy then move and just have a
54  copy*/
55  }
56 
59  const handle_type handleType{handle_type::unknown};
60  bool used{false};
61  uint16_t flags{
62  0};
63 
64  const std::string key;
65  const std::string type;
66  const std::string units;
67  std::string interface_info;
68  const std::string& type_in;
69  const std::string& type_out;
70 
75  void setInfoField(std::string& info) { interface_info = info; }
76 };
77 } // namespace helics
extra_flag3
@ extra_flag3
extra flag
Definition: flagOperations.hpp:31
helics::BasicHandleInfo::getInterfaceHandle
interface_handle getInterfaceHandle() const
Definition: BasicHandleInfo.hpp:71
helics::local_federate_id
Definition: federate_id.hpp:22
helics::global_federate_id
Definition: global_federate_id.hpp:68
helics::BasicHandleInfo::type_out
const std::string & type_out
the output type of a filter
Definition: BasicHandleInfo.hpp:69
helics::BasicHandleInfo::interface_info
std::string interface_info
storage for a user info string
Definition: BasicHandleInfo.hpp:67
extra_flag2
@ extra_flag2
extra flag
Definition: flagOperations.hpp:27
helics::handle_flag_definitions
handle_flag_definitions
Definition: BasicHandleInfo.hpp:25
helics::global_handle::fed_id
global_federate_id fed_id
the federate id component
Definition: global_federate_id.hpp:130
helics::has_source_filter_flag
@ has_source_filter_flag
indicator that an endpoint or message has a source filter
Definition: BasicHandleInfo.hpp:27
helics::handle_type::filter
@ filter
handle to a filter
helics::global_handle::handle
interface_handle handle
the interface handle component
Definition: global_federate_id.hpp:131
helics::BasicHandleInfo::getFederateId
global_federate_id getFederateId() const
Definition: BasicHandleInfo.hpp:73
helics::global_handle
Definition: global_federate_id.hpp:128
helics::BasicHandleInfo::handleType
const handle_type handleType
the type of the handle
Definition: BasicHandleInfo.hpp:59
extra_flag1
@ extra_flag1
extra flag
Definition: flagOperations.hpp:23
helics::BasicHandleInfo
Definition: BasicHandleInfo.hpp:36
helics::BasicHandleInfo::local_fed_id
local_federate_id local_fed_id
the local federate id of the handle
Definition: BasicHandleInfo.hpp:58
helics::BasicHandleInfo::type_in
const std::string & type_in
the input type of a filter
Definition: BasicHandleInfo.hpp:68
helics::interface_handle
Definition: federate_id.hpp:65
helics::handle_type
handle_type
Definition: BasicHandleInfo.hpp:16
helics::handle_type::input
@ input
handle to a input interface
helics::has_non_cloning_dest_filter_flag
@ has_non_cloning_dest_filter_flag
Definition: BasicHandleInfo.hpp:31
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::BasicHandleInfo::handle
const global_handle handle
the global federate id for the creator of the handle
Definition: BasicHandleInfo.hpp:57
helics::BasicHandleInfo::flags
uint16_t flags
flags corresponding to the flags used in ActionMessages +some extra ones
Definition: BasicHandleInfo.hpp:61
extra_flag4
@ extra_flag4
extra flag
Definition: flagOperations.hpp:32
helics::BasicHandleInfo::BasicHandleInfo
BasicHandleInfo(global_federate_id federate_id, interface_handle handle_id, handle_type type_of_handle, const std::string &key_name, const std::string &type_name, const std::string &unit_name)
Definition: BasicHandleInfo.hpp:41
helics::BasicHandleInfo::BasicHandleInfo
BasicHandleInfo() noexcept
Definition: BasicHandleInfo.hpp:39
helics::BasicHandleInfo::type
const std::string type
the type of data used by the handle
Definition: BasicHandleInfo.hpp:65
helics::BasicHandleInfo::units
const std::string units
the units associated with the handle
Definition: BasicHandleInfo.hpp:66
helics::handle_type::endpoint
@ endpoint
handle to an endpoint
helics::BasicHandleInfo::used
bool used
indicator that the handle is being used to link with another federate
Definition: BasicHandleInfo.hpp:60
flagOperations.hpp
helics::BasicHandleInfo::key
const std::string key
the name of the handle
Definition: BasicHandleInfo.hpp:64
helics::handle_type::publication
@ publication
handle to output interface
helics::has_dest_filter_flag
@ has_dest_filter_flag
indicator that an endpoint or message has a destination filter
Definition: BasicHandleInfo.hpp:29
helics::BasicHandleInfo::setInfoField
void setInfoField(std::string &info)
Definition: BasicHandleInfo.hpp:75