ReceiveListenerSetMap.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_RECEIVELISTENERSETMAP_H
00009 #define OPENDDS_DCPS_RECEIVELISTENERSETMAP_H
00010 
00011 #include "dds/DCPS/dcps_export.h"
00012 #include "ReceiveListenerSet.h"
00013 #include "ReceiveListenerSet_rch.h"
00014 #include "dds/DCPS/Definitions.h"
00015 #include "dds/DCPS/PoolAllocator.h"
00016 #include "ace/Synch.h"
00017 
00018 namespace OpenDDS {
00019 namespace DCPS {
00020 
00021 class TransportReceiveListener;
00022 class ReceivedDataSample;
00023 
00024 class OpenDDS_Dcps_Export ReceiveListenerSetMap {
00025 public:
00026 
00027   typedef OPENDDS_MAP_CMP(RepoId, ReceiveListenerSet_rch, GUID_tKeyLessThan) MapType;
00028 
00029   ReceiveListenerSetMap();
00030   virtual ~ReceiveListenerSetMap();
00031 
00032   int insert(RepoId                    publisher_id,
00033              RepoId                    subscriber_id,
00034              TransportReceiveListener* receive_listener);
00035 
00036   ReceiveListenerSet* find(RepoId publisher_id) const;
00037 
00038   int remove(RepoId publisher_id, RepoId subscriber_id);
00039 
00040   /// This method is called when the (remote) subscriber is being
00041   /// released.  This method will return a 0 if the subscriber_id is
00042   /// successfully disassociated with the publisher_id *and* there
00043   /// are still other subscribers associated with the publisher_id.
00044   /// This method will return 1 if, after the disassociation, the
00045   /// publisher_id is no longer associated with any subscribers (which
00046   /// also means it's element was removed from our map_).
00047   int release_subscriber(RepoId publisher_id, RepoId subscriber_id);
00048 
00049   ReceiveListenerSet* remove_set(RepoId publisher_id);
00050 
00051   ssize_t size() const;
00052 
00053   /// Give access to the underlying map for iteration purposes.
00054   MapType& map();
00055   const MapType& map() const;
00056 
00057   void operator= (const ReceiveListenerSetMap& rh);
00058 
00059   void clear();
00060 
00061 private:
00062 
00063   ReceiveListenerSet* find_or_create(RepoId publisher_id);
00064 
00065   MapType map_;
00066 };
00067 
00068 } // namespace DCPS
00069 } // namespace OpenDDS
00070 
00071 #if defined (__ACE_INLINE__)
00072 #include "ReceiveListenerSetMap.inl"
00073 #endif /* __ACE_INLINE__ */
00074 
00075 #endif /* OPENDDS_DCPS_RECEIVELISTENERSETMAP_H */

Generated on Fri Feb 12 20:05:25 2016 for OpenDDS by  doxygen 1.4.7