OpenDDS  Snapshot(2023/04/28-20:55)
ReceiveListenerSet.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_FRAMEWORK_RECEIVELISTENERSET_H
9 #define OPENDDS_DCPS_TRANSPORT_FRAMEWORK_RECEIVELISTENERSET_H
10 
11 #include "dds/DCPS/RcObject.h"
12 #include "dds/DdsDcpsInfoUtilsC.h"
13 #include "dds/DCPS/GuidUtils.h"
14 #include "dds/DCPS/PoolAllocator.h"
15 #include "ace/Synch_Traits.h"
16 #include "ace/Mutex.h"
17 
19 
20 namespace OpenDDS {
21 namespace DCPS {
22 
23 class TransportReceiveListener;
26 
28  public virtual RcObject {
29 public:
30 
33  SET_INCLUDED
34  };
35 
36  typedef OPENDDS_MAP_CMP(GUID_t, TransportReceiveListener_wrch, GUID_tKeyLessThan) MapType;
37 
40  ReceiveListenerSet& operator=(const ReceiveListenerSet&);
41  virtual ~ReceiveListenerSet();
42 
43  int insert(GUID_t subscriber_id,
44  const TransportReceiveListener_wrch& listener);
45  int remove(GUID_t subscriber_id);
46  void remove_all(const GUIDSeq& to_remove);
47 
48  ssize_t size() const;
49 
50  void data_received(const ReceivedDataSample& sample,
51  const RepoIdSet& incl_excl,
52  ConstrainReceiveSet constrain);
53  void data_received(const ReceivedDataSample& sample, const GUID_t& readerId);
54 
55  /// Give access to the underlying map for iteration purposes.
56  MapType& map();
57  const MapType& map() const;
58 
59  /// Check if the key is in the map and if it's the only left entry
60  /// in the map.
61  bool exist(const GUID_t& key, bool& last);
62  bool exist(const GUID_t& local_id);
63 
64  void get_keys(ReaderIdSeq & ids);
65 
66  void clear();
67 
68 private:
69 
72 
73  /// This lock will protect the map.
74  mutable LockType lock_;
75 
76  MapType map_;
77 };
78 
79 } // namespace DCPS
80 } // namespace OpenDDS
81 
83 
84 #if defined (__ACE_INLINE__)
85 #include "ReceiveListenerSet.inl"
86 #endif /* __ACE_INLINE__ */
87 
88 #endif /* OPENDDS_DCPS_RECEIVELISTENERSET_H */
#define ACE_SYNCH_MUTEX
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
sequence< octet > key
GuidSet RepoIdSet
Definition: GuidUtils.h:113
DDS::ReturnCode_t get_keys(DDS::DynamicType_ptr type, MemberPathVec &paths)
int ssize_t
sequence< GUID_t > ReaderIdSeq
LockType lock_
This lock will protect the map.
Holds a data sample received by the transport.
typedef OPENDDS_MAP_CMP(GUID_t, WriterCoherentSample, GUID_tKeyLessThan) GroupCoherentSamples
WeakRcHandle< TransportReceiveListener > TransportReceiveListener_wrch
sequence< GUID_t > GUIDSeq
Definition: DdsDcpsGuid.idl:62
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
int insert(Container &c, const ValueType &v)
Definition: Util.h:105
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28