9#include "LocalFederateId.hpp"
36 constexpr explicit GlobalBrokerId(BaseType val)
noexcept: gid(val) {}
38 constexpr BaseType
baseValue()
const {
return gid; }
46 constexpr bool isFederate()
const
51 constexpr bool isValid()
const
53 return (gid != invalid_global_broker_id && gid != detail::gInvalidInterfaceHandle);
55 BaseType localIndex()
const
61 BaseType gid = invalid_global_broker_id;
62 friend class GlobalFederateId;
63 static constexpr BaseType invalid_global_broker_id{-2'010'000'000};
73std::ostream&
operator<<(std::ostream& os, GlobalBrokerId
id);
87 constexpr BaseType
baseValue()
const {
return gid; }
114 return (gid != invalid_global_fed_id && gid != detail::gInvalidInterfaceHandle);
127 static constexpr BaseType invalid_global_fed_id{-2'010'000'000};
128 BaseType gid{invalid_global_fed_id};
135 GlobalBrokerId::BaseType index)
144std::ostream&
operator<<(std::ostream& os, GlobalFederateId
id);
157 explicit operator uint64_t()
const
160 key +=
static_cast<uint64_t
>(
handle.
baseValue()) & (0x0000'0000'FFFF'FFFF);
184std::ostream&
operator<<(std::ostream& os, GlobalHandle
id);
193 constexpr explicit route_id(BaseType val)
noexcept: rid(val) {}
203 constexpr bool isValid()
const {
return (rid != invalid_route_id); }
206 static constexpr BaseType invalid_route_id{-1'295'148'000};
207 BaseType rid{invalid_route_id};
210constexpr route_id parent_route_id{0};
211constexpr route_id control_route{-1};
213constexpr route_id generateRouteId(int32_t route_type_code, int32_t index)
215 return route_id(route_type_code * 256 * 256 * 256 + index);
218constexpr int32_t getRouteTypeCode(route_id rid)
220 return (rid.baseValue() >> 24);
223constexpr int32_t normal_route_code{0};
224constexpr int32_t json_route_code{10};
227std::ostream&
operator<<(std::ostream& os, route_id
id);
235struct hash<
helics::GlobalFederateId> {
237 using result_type = std::size_t;
239 result_type operator()(argument_type
const& key)
const noexcept
241 return std::hash<helics::GlobalFederateId::BaseType>{}(key.baseValue());
248struct hash<
helics::GlobalBrokerId> {
250 using result_type = std::size_t;
252 result_type operator()(argument_type
const& key)
const noexcept
254 return std::hash<helics::GlobalBrokerId::BaseType>{}(key.baseValue());
261struct hash<
helics::route_id> {
263 using result_type = std::size_t;
265 result_type operator()(argument_type
const& key)
const noexcept
267 return std::hash<helics::route_id::BaseType>{}(key.baseValue());
275struct hash<
helics::GlobalHandle> {
277 using result_type = std::size_t;
279 result_type operator()(argument_type
const& key)
const noexcept
281 return std::hash<uint64_t>{}(
static_cast<uint64_t
>(key));
Definition GlobalFederateId.hpp:30
constexpr bool operator==(GlobalBrokerId id) const noexcept
Definition GlobalFederateId.hpp:40
constexpr bool operator<(GlobalBrokerId id) const noexcept
Definition GlobalFederateId.hpp:44
constexpr BaseType baseValue() const
Definition GlobalFederateId.hpp:38
constexpr bool operator!=(GlobalBrokerId id) const noexcept
Definition GlobalFederateId.hpp:42
constexpr GlobalBrokerId()=default
Definition GlobalFederateId.hpp:75
constexpr bool isFederate() const
Definition GlobalFederateId.hpp:105
BaseType * getBaseTypePointer()
Definition GlobalFederateId.hpp:124
constexpr bool operator>(GlobalFederateId id) const noexcept
Definition GlobalFederateId.hpp:95
constexpr bool operator<(GlobalBrokerId id) const noexcept
Definition GlobalFederateId.hpp:101
constexpr bool isValid() const
Definition GlobalFederateId.hpp:112
constexpr GlobalFederateId(GlobalBrokerId id) noexcept
Definition GlobalFederateId.hpp:83
constexpr bool operator==(GlobalFederateId id) const noexcept
Definition GlobalFederateId.hpp:89
constexpr BaseType baseValue() const
Definition GlobalFederateId.hpp:87
constexpr bool operator!=(GlobalFederateId id) const noexcept
Definition GlobalFederateId.hpp:91
constexpr bool operator>(GlobalBrokerId id) const noexcept
Definition GlobalFederateId.hpp:103
constexpr BaseType localIndex() const
Definition GlobalFederateId.hpp:118
constexpr bool operator==(GlobalBrokerId id) const noexcept
Definition GlobalFederateId.hpp:97
constexpr bool operator<(GlobalFederateId id) const noexcept
Definition GlobalFederateId.hpp:93
constexpr GlobalFederateId()=default
constexpr bool operator!=(GlobalBrokerId id) const noexcept
Definition GlobalFederateId.hpp:99
constexpr bool isBroker() const
Definition GlobalFederateId.hpp:110
Definition GlobalFederateId.hpp:147
constexpr GlobalHandle(GlobalFederateId fed, InterfaceHandle hand)
Definition GlobalFederateId.hpp:154
GlobalFederateId fed_id
the federate id component
Definition GlobalFederateId.hpp:149
InterfaceHandle handle
the interface handle component
Definition GlobalFederateId.hpp:150
constexpr bool isValid() const
Definition GlobalFederateId.hpp:179
constexpr bool operator<(GlobalHandle id) const noexcept
Definition GlobalFederateId.hpp:174
constexpr bool operator==(GlobalHandle id) const noexcept
Definition GlobalFederateId.hpp:164
constexpr bool operator!=(GlobalHandle id) const noexcept
Definition GlobalFederateId.hpp:169
constexpr GlobalHandle()=default
Definition LocalFederateId.hpp:65
constexpr BaseType baseValue() const
Definition LocalFederateId.hpp:73
Definition GlobalFederateId.hpp:187
constexpr route_id(BaseType val) noexcept
Definition GlobalFederateId.hpp:193
constexpr bool operator==(route_id id) const noexcept
Definition GlobalFederateId.hpp:197
constexpr BaseType baseValue() const
Definition GlobalFederateId.hpp:195
constexpr route_id()=default
constexpr bool operator<(route_id id) const noexcept
Definition GlobalFederateId.hpp:201
constexpr bool operator!=(route_id id) const noexcept
Definition GlobalFederateId.hpp:199
constexpr bool isValid() const
Definition GlobalFederateId.hpp:203
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition AsyncFedCallInfo.hpp:14
constexpr IdentifierBaseType gGlobalPriorityBlockSize
Definition GlobalFederateId.hpp:26
constexpr GlobalFederateId getSpecialFederateId(GlobalBrokerId broker, GlobalBrokerId::BaseType index)
Definition GlobalFederateId.hpp:134
std::ostream & operator<<(std::ostream &out, const ActionMessage &command)
Definition ActionMessage.cpp:965
constexpr GlobalBrokerId gRootBrokerID
Definition GlobalFederateId.hpp:69
constexpr GlobalFederateId gDirectCoreId
Definition GlobalFederateId.hpp:131
constexpr IdentifierBaseType gGlobalBrokerIdShift
Definition GlobalFederateId.hpp:24
constexpr GlobalBrokerId parent_broker_id
Definition GlobalFederateId.hpp:67
int32_t IdentifierBaseType
Definition LocalFederateId.hpp:15
constexpr IdentifierBaseType gGlobalFederateIdShift
Definition GlobalFederateId.hpp:22