OpenDDS  Snapshot(2023/04/28-20:55)
ConstSharedRepoIdSet.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_CONSTSHAREDREPOIDSET_H
9 #define OPENDDS_DCPS_TRANSPORT_RTPS_UDP_CONSTSHAREDREPOIDSET_H
10 
11 #include <dds/DCPS/GuidUtils.h>
12 #include <dds/DCPS/RcObject.h>
13 
15 
16 namespace OpenDDS {
17 namespace DCPS {
18 
19 struct ConstSharedRepoIdSet : public virtual RcObject {
21  : guids_()
22 #if defined ACE_HAS_CPP11
23  , hash_(0)
24  , valid_hash_(false)
25 #endif
26  {}
27 
29  : guids_(guids)
30 #if defined ACE_HAS_CPP11
31  , hash_(0)
32  , valid_hash_(false)
33 #endif
34  {}
35 
37 
38 #if defined ACE_HAS_CPP11
39  uint32_t hash()
40  {
41  if (guids_.empty()) {
42  return 0;
43  }
44 
45  if (!valid_hash_) {
46  uint32_t hash = 0;
47  for (RepoIdSet::const_iterator it = guids_.begin(), limit = guids_.end(); it != limit; ++it) {
48  hash = one_at_a_time_hash(reinterpret_cast<const uint8_t*>(&(*it)), sizeof (OpenDDS::DCPS::GUID_t), hash);
49  }
50  hash_ = hash;
51  valid_hash_ = true;
52  }
53  return hash_;
54  }
55 
56  uint32_t hash_;
57  bool valid_hash_;
58 #endif
59 };
60 
61 } // namespace DCPS
62 } // namespace OpenDDS
63 
65 
66 #endif /* OPENDDS_DCPS_TRANSPORT_RTPS_UDP_CONSTSHAREDREPOIDSET_H */
if(!(yy_init))
int hash(const std::vector< const DDS::OctetSeq *> &src, DDS::OctetSeq &dst)
GuidSet RepoIdSet
Definition: GuidUtils.h:113
ConstSharedRepoIdSet(const RepoIdSet &guids)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28