00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_DCPS_DOMAIN_PARTICIPANT_FACTORY_IMPL_H 00009 #define OPENDDS_DCPS_DOMAIN_PARTICIPANT_FACTORY_IMPL_H 00010 00011 #include "Definitions.h" 00012 #include "dds/DdsDcpsDomainC.h" 00013 #include "ace/Recursive_Thread_Mutex.h" 00014 #include "dds/DCPS/LocalObject.h" 00015 #include "dds/DCPS/PoolAllocator.h" 00016 00017 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00018 #pragma once 00019 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00020 00021 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00022 00023 namespace OpenDDS { 00024 namespace DCPS { 00025 00026 class DomainParticipantImpl; 00027 00028 /** 00029 * @class DomainParticipantFactoryImpl 00030 * 00031 * @brief Implements the OpenDDS::DCPS::DomainParticipantFactory 00032 * interfaces. 00033 * 00034 * This class acts as factory of the DomainParticipant. 00035 * 00036 * See the DDS specification, OMG formal/04-12-02, for a description of 00037 * the interface this class is implementing. 00038 * 00039 */ 00040 class OpenDDS_Dcps_Export DomainParticipantFactoryImpl 00041 : public virtual OpenDDS::DCPS::LocalObject<DDS::DomainParticipantFactory> { 00042 public: 00043 00044 typedef OPENDDS_SET(RcHandle<DomainParticipantImpl>) DPSet; 00045 typedef OPENDDS_MAP(DDS::DomainId_t, DPSet) DPMap; 00046 00047 DomainParticipantFactoryImpl(); 00048 00049 virtual ~DomainParticipantFactoryImpl(); 00050 00051 virtual DDS::DomainParticipant_ptr create_participant( 00052 DDS::DomainId_t domainId, 00053 const DDS::DomainParticipantQos & qos, 00054 DDS::DomainParticipantListener_ptr a_listener, 00055 DDS::StatusMask mask); 00056 00057 virtual DDS::ReturnCode_t delete_participant( 00058 DDS::DomainParticipant_ptr a_participant); 00059 00060 virtual DDS::DomainParticipant_ptr lookup_participant( 00061 DDS::DomainId_t domainId); 00062 00063 virtual DDS::ReturnCode_t set_default_participant_qos( 00064 const DDS::DomainParticipantQos & qos); 00065 00066 virtual DDS::ReturnCode_t get_default_participant_qos( 00067 DDS::DomainParticipantQos & qos); 00068 00069 virtual DDS::DomainParticipantFactory_ptr get_instance(); 00070 00071 virtual DDS::ReturnCode_t set_qos( 00072 const DDS::DomainParticipantFactoryQos & qos); 00073 00074 virtual DDS::ReturnCode_t get_qos( 00075 DDS::DomainParticipantFactoryQos & qos); 00076 00077 /// Expose the participants for reading. 00078 const DPMap& participants() const; 00079 00080 void cleanup(); 00081 00082 private: 00083 00084 DDS::DomainParticipantFactoryQos qos_; 00085 00086 /// The default qos value of DomainParticipant. 00087 DDS::DomainParticipantQos default_participant_qos_; 00088 00089 /// The collection of domain participants. 00090 DPMap participants_; 00091 00092 /// Protect the participant collection. 00093 /// Use recursive mutex to allow nested acquisition and 00094 /// release of a mutex that occurs in the same thread. 00095 ACE_Recursive_Thread_Mutex participants_protector_; 00096 }; 00097 00098 } // namespace DCPS 00099 } // namespace OpenDDS 00100 00101 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00102 00103 #endif /* OPENDDS_DCPS_DOMAIN_PARTICIPANT_FACTORY_IMPL_H */