00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OPENDDS_DCPS_RECEIVELISTENERSET_H
00009 #define OPENDDS_DCPS_RECEIVELISTENERSET_H
00010
00011 #include "dds/DCPS/RcObject_T.h"
00012 #include "dds/DdsDcpsInfoUtilsC.h"
00013 #include "dds/DCPS/GuidUtils.h"
00014 #include "dds/DCPS/PoolAllocator.h"
00015
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 ReceiveListenerSet :
00025 public RcObject<ACE_SYNCH_MUTEX> {
00026 public:
00027
00028 enum ConstrainReceiveSet {
00029 SET_EXCLUDED,
00030 SET_INCLUDED
00031 };
00032
00033 typedef OPENDDS_MAP_CMP(RepoId, TransportReceiveListener*, GUID_tKeyLessThan) MapType;
00034
00035 ReceiveListenerSet();
00036 ReceiveListenerSet(const ReceiveListenerSet&);
00037 ReceiveListenerSet& operator=(const ReceiveListenerSet&);
00038 virtual ~ReceiveListenerSet();
00039
00040 int insert(RepoId subscriber_id,
00041 TransportReceiveListener* listener);
00042 int remove(RepoId subscriber_id);
00043 void remove_all(const GUIDSeq& to_remove);
00044
00045 ssize_t size() const;
00046
00047 void data_received(const ReceivedDataSample& sample,
00048 const RepoIdSet& incl_excl,
00049 ConstrainReceiveSet constrain);
00050 void data_received(const ReceivedDataSample& sample, const RepoId& readerId);
00051
00052
00053 MapType& map();
00054 const MapType& map() const;
00055
00056
00057
00058 bool exist(const RepoId& key, bool& last);
00059 bool exist(const RepoId& local_id);
00060
00061 void get_keys(ReaderIdSeq & ids);
00062
00063 void clear();
00064
00065 private:
00066
00067 typedef ACE_SYNCH_MUTEX LockType;
00068 typedef ACE_Guard<LockType> GuardType;
00069
00070
00071 mutable LockType lock_;
00072
00073 MapType map_;
00074 };
00075
00076 }
00077 }
00078
00079 #if defined (__ACE_INLINE__)
00080 #include "ReceiveListenerSet.inl"
00081 #endif
00082
00083 #endif