OpenDDS  Snapshot(2023/04/28-20:55)
ReceiveListenerSetMap.inl
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 #include "ReceivedDataSample.h"
9 #include "EntryExit.h"
10 #include "dds/DCPS/Util.h"
11 #include "dds/DCPS/GuidConverter.h"
12 
15 {
16  DBG_ENTRY_LVL("ReceiveListenerSetMap","ReceiveListenerSetMap",6);
17 }
18 
21 {
22  DBG_ENTRY_LVL("ReceiveListenerSetMap","find",6);
23  ReceiveListenerSet_rch listener_set;
24 
25  if (OpenDDS::DCPS::find(map_, publisher_id, listener_set) != 0) {
26  return ReceiveListenerSet_rch();
27  }
28  return listener_set;
29 }
30 
33 {
34  DBG_ENTRY_LVL("ReceiveListenerSetMap","find_or_create",6);
35 
36  ReceiveListenerSet_rch& listener_set = map_[publisher_id];
37  if (!listener_set) {
38  listener_set = make_rch<ReceiveListenerSet>();
39  }
40  return listener_set;
41 }
42 
45 {
46  DBG_ENTRY_LVL("ReceiveListenerSetMap","remove_set",6);
47  ReceiveListenerSet_rch listener_set;
48 
49  if (unbind(map_, publisher_id, listener_set) != 0) {
50  VDBG((LM_DEBUG,
51  "(%P|%t) Unable to remove ReceiveListenerSet from the "
52  "ReceiveListenerSetMap for id %d.\n",
53  LogGuid(publisher_id).c_str()));
54  // Return a 'nil' ReceiveListenerSet*
55  return ReceiveListenerSet_rch();
56  }
57 
58  return listener_set;
59 }
60 
63 {
64  DBG_ENTRY_LVL("ReceiveListenerSetMap","size",6);
65  return map_.size();
66 }
67 
68 ACE_INLINE OpenDDS::DCPS::ReceiveListenerSetMap::MapType&
70 {
71  DBG_ENTRY_LVL("ReceiveListenerSetMap","map",6);
72  return map_;
73 }
74 
75 ACE_INLINE const OpenDDS::DCPS::ReceiveListenerSetMap::MapType&
77 {
78  DBG_ENTRY_LVL("ReceiveListenerSetMap","map",6);
79  return map_;
80 }
ReceiveListenerSet_rch remove_set(GUID_t publisher_id)
int ssize_t
RcHandle< ReceiveListenerSet > ReceiveListenerSet_rch
The type definition for the smart-pointer to the underlying type.
ReceiveListenerSet_rch find(GUID_t publisher_id) const
LM_DEBUG
#define VDBG(DBG_ARGS)
MapType & map()
Give access to the underlying map for iteration purposes.
ReceiveListenerSet_rch find_or_create(GUID_t publisher_id)
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
#define ACE_INLINE
int unbind(Container &c, const typename Container::key_type &k, typename Container::mapped_type &v)
Definition: Util.h:40
int find(Container &c, const Key &key, typename Container::mapped_type *&value)
Definition: Util.h:71