OpenDDS  Snapshot(2023/04/28-20:55)
LocatorCacheKey.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef OPENDDS_DCPS_TRANSPORT_RTPS_UDP_LOCATORCACHEKEY_H
9 #define OPENDDS_DCPS_TRANSPORT_RTPS_UDP_LOCATORCACHEKEY_H
10 
11 #include "Rtps_Udp_Export.h"
12 
13 #include "dds/DCPS/GuidConverter.h"
14 #include "dds/DCPS/PoolAllocator.h"
15 #include "dds/DCPS/AddressCache.h"
16 #include "dds/DCPS/Hash.h"
17 
18 #if defined ACE_HAS_CPP11
19 #include <functional>
20 #endif
21 
23 
24 namespace OpenDDS {
25 namespace DCPS {
26 
27 #pragma pack(push, 1)
28 
30  LocatorCacheKey(const GUID_t& remote, const GUID_t& local, bool prefer_unicast)
31  : remote_(remote)
32  , local_(local)
33  , prefer_unicast_(prefer_unicast)
34  {
35  }
36 
38  : remote_(val.remote_)
39  , local_(val.local_)
40  , prefer_unicast_(val.prefer_unicast_)
41  {
42  }
43 
44  bool operator<(const LocatorCacheKey& rhs) const
45  {
46  return std::memcmp(static_cast<const void*>(this), static_cast<const void*>(&rhs), sizeof (LocatorCacheKey)) < 0;
47  }
48 
49  bool operator==(const LocatorCacheKey& rhs) const
50  {
51  return std::memcmp(static_cast<const void*>(this), static_cast<const void*>(&rhs), sizeof (LocatorCacheKey)) == 0;
52  }
53 
54  void get_contained_guids(GuidSet& set) const
55  {
56  set.clear();
57  set.insert(remote_);
58  set.insert(local_);
59  }
60 
64 };
65 
66 #pragma pack(pop)
67 
68 }
69 }
70 
72 
73 #if defined ACE_HAS_CPP11
75 #endif
76 
77 #endif /* OPENDDS_DCPS_TRANSPORT_RTPS_UDP_LOCATORCACHEKEY_H */
LocatorCacheKey(const LocatorCacheKey &val)
void get_contained_guids(GuidSet &set) const
LocatorCacheKey(const GUID_t &remote, const GUID_t &local, bool prefer_unicast)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
bool operator<(const LocatorCacheKey &rhs) const
bool operator==(const LocatorCacheKey &rhs) const
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
#define OpenDDS_Rtps_Udp_Export