OpenDDS  Snapshot(2023/04/07-19:43)
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
OpenDDS::DCPS::InternalTopic< T > Class Template Reference

#include <InternalTopic.h>

Inheritance diagram for OpenDDS::DCPS::InternalTopic< T >:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::InternalTopic< T >:
Collaboration graph
[legend]

Public Types

typedef RcHandle< InternalDataWriter< T > > InternalDataWriter_rch
 
typedef WeakRcHandle< InternalDataWriter< T > > InternalDataWriter_wrch
 
typedef RcHandle< InternalDataReader< T > > InternalDataReader_rch
 
typedef WeakRcHandle< InternalDataReader< T > > InternalDataReader_wrch
 

Public Member Functions

void connect (InternalDataWriter_rch writer)
 
void connect (InternalDataReader_rch reader)
 
void disconnect (InternalDataWriter_rch writer)
 
void disconnect (InternalDataReader_rch reader)
 
- Public Member Functions inherited from OpenDDS::DCPS::RcObject
virtual ~RcObject ()
 
virtual void _add_ref ()
 
virtual void _remove_ref ()
 
long ref_count () const
 
WeakObject_get_weak_object () const
 

Private Member Functions

typedef OPENDDS_SET (InternalDataWriter_wrch) WriterSet
 
typedef OPENDDS_SET (InternalDataReader_wrch) ReaderSet
 

Private Attributes

WriterSet writers_
 
ReaderSet readers_
 
ACE_Thread_Mutex mutex_
 

Additional Inherited Members

- Protected Member Functions inherited from OpenDDS::DCPS::RcObject
 RcObject ()
 

Detailed Description

template<typename T>
class OpenDDS::DCPS::InternalTopic< T >

Definition at line 28 of file InternalTopic.h.

Member Typedef Documentation

◆ InternalDataReader_rch

Definition at line 32 of file InternalTopic.h.

◆ InternalDataReader_wrch

Definition at line 33 of file InternalTopic.h.

◆ InternalDataWriter_rch

Definition at line 30 of file InternalTopic.h.

◆ InternalDataWriter_wrch

Definition at line 31 of file InternalTopic.h.

Member Function Documentation

◆ connect() [1/2]

template<typename T>
void OpenDDS::DCPS::InternalTopic< T >::connect ( InternalDataWriter_rch  writer)
inline

Definition at line 35 of file InternalTopic.h.

36  {
38  const std::pair<typename WriterSet::iterator, bool> p = writers_.insert(writer);
39 
40  if (p.second) {
41  for (typename ReaderSet::const_iterator pos = readers_.begin(), limit = readers_.end(); pos != limit; ++pos) {
42  InternalDataReader_rch reader = pos->lock();
43  if (reader) {
44  writer->add_reader(reader);
45  }
46  }
47  }
48  }
#define ACE_GUARD(MUTEX, OBJ, LOCK)
RcHandle< InternalDataReader< T > > InternalDataReader_rch
Definition: InternalTopic.h:32

◆ connect() [2/2]

template<typename T>
void OpenDDS::DCPS::InternalTopic< T >::connect ( InternalDataReader_rch  reader)
inline

Definition at line 50 of file InternalTopic.h.

51  {
53  const std::pair<typename ReaderSet::iterator, bool> p = readers_.insert(reader);
54 
55  if (p.second) {
56  for (typename WriterSet::const_iterator pos = writers_.begin(), limit = writers_.end(); pos != limit; ++pos) {
57  InternalDataWriter_rch writer = pos->lock();
58  if (writer) {
59  writer->add_reader(reader);
60  }
61  }
62  }
63  }
#define ACE_GUARD(MUTEX, OBJ, LOCK)
RcHandle< InternalDataWriter< T > > InternalDataWriter_rch
Definition: InternalTopic.h:30

◆ disconnect() [1/2]

template<typename T>
void OpenDDS::DCPS::InternalTopic< T >::disconnect ( InternalDataWriter_rch  writer)
inline

Definition at line 65 of file InternalTopic.h.

66  {
68 
69  if (writers_.erase(writer)) {
70  for (typename ReaderSet::const_iterator pos = readers_.begin(), limit = readers_.end(); pos != limit; ++pos) {
71  InternalDataReader_rch reader = pos->lock();
72  if (reader) {
73  writer->remove_reader(reader);
74  }
75  }
76  }
77  }
#define ACE_GUARD(MUTEX, OBJ, LOCK)
RcHandle< InternalDataReader< T > > InternalDataReader_rch
Definition: InternalTopic.h:32

◆ disconnect() [2/2]

template<typename T>
void OpenDDS::DCPS::InternalTopic< T >::disconnect ( InternalDataReader_rch  reader)
inline

Definition at line 79 of file InternalTopic.h.

80  {
82 
83  if (readers_.erase(reader)) {
84  for (typename WriterSet::const_iterator pos = writers_.begin(), limit = writers_.end(); pos != limit; ++pos) {
85  InternalDataWriter_rch writer = pos->lock();
86  if (writer) {
87  writer->remove_reader(reader);
88  }
89  }
90  }
91  }
#define ACE_GUARD(MUTEX, OBJ, LOCK)
RcHandle< InternalDataWriter< T > > InternalDataWriter_rch
Definition: InternalTopic.h:30

◆ OPENDDS_SET() [1/2]

template<typename T>
typedef OpenDDS::DCPS::InternalTopic< T >::OPENDDS_SET ( InternalDataWriter_wrch  )
private

◆ OPENDDS_SET() [2/2]

template<typename T>
typedef OpenDDS::DCPS::InternalTopic< T >::OPENDDS_SET ( InternalDataReader_wrch  )
private

Member Data Documentation

◆ mutex_

template<typename T>
ACE_Thread_Mutex OpenDDS::DCPS::InternalTopic< T >::mutex_
mutableprivate

◆ readers_

template<typename T>
ReaderSet OpenDDS::DCPS::InternalTopic< T >::readers_
private

◆ writers_

template<typename T>
WriterSet OpenDDS::DCPS::InternalTopic< T >::writers_
private

The documentation for this class was generated from the following file: