#include <Registered_Data_Types.h>
Public Member Functions | |
DDS::ReturnCode_t | register_type (DDS::DomainParticipant_ptr domain_participant, const char *type_name, TypeSupport_ptr the_type) |
DDS::ReturnCode_t | unregister_participant (DDS::DomainParticipant_ptr domain_participant) |
TypeSupport_ptr | lookup (DDS::DomainParticipant_ptr domain_participant, const char *type_name) const |
Static Public Member Functions | |
static Data_Types_Register * | instance () |
Return a singleton instance of this class. | |
Private Member Functions | |
Data_Types_Register () | |
~Data_Types_Register () | |
Private Attributes | |
ACE_SYNCH_MUTEX | lock_ |
ParticipantMap | participants_ |
Friends | |
class | ACE_Singleton< Data_Types_Register, ACE_SYNCH_MUTEX > |
Definition at line 35 of file Registered_Data_Types.h.
OpenDDS::DCPS::Data_Types_Register::Data_Types_Register | ( | ) | [private] |
OpenDDS::DCPS::Data_Types_Register::~Data_Types_Register | ( | ) | [private] |
Data_Types_Register * OpenDDS::DCPS::Data_Types_Register::instance | ( | ) | [static] |
TypeSupport_ptr OpenDDS::DCPS::Data_Types_Register::lookup | ( | DDS::DomainParticipant_ptr | domain_participant, | |
const char * | type_name | |||
) | const |
Find a data type by its type name.
Definition at line 68 of file Registered_Data_Types.cpp.
References lock_, and participants_.
00071 { 00072 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, lock_, 0); 00073 00074 ParticipantMap::const_iterator iter1 = participants_.find(domain_participant); 00075 if (iter1 == participants_.end()) { 00076 return 0; 00077 } 00078 00079 TypeSupportMap::const_iterator iter2 = iter1->second.find(type_name); 00080 if (iter2 == iter1->second.end()) { 00081 return 0; 00082 } 00083 00084 TypeSupport_var typeSupport = iter2->second; 00085 return typeSupport._retn(); 00086 }
DDS::ReturnCode_t OpenDDS::DCPS::Data_Types_Register::register_type | ( | DDS::DomainParticipant_ptr | domain_participant, | |
const char * | type_name, | |||
TypeSupport_ptr | the_type | |||
) |
Register a type.
Definition at line 36 of file Registered_Data_Types.cpp.
References lock_, participants_, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
00040 { 00041 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, lock_, DDS::RETCODE_ERROR); 00042 00043 TypeSupportMap& tsm = participants_[domain_participant]; 00044 const TypeSupport_var typeSupport = TypeSupport::_duplicate(the_type); 00045 00046 TypeSupportMap::iterator iter = tsm.find(type_name); 00047 if (iter == tsm.end()) { 00048 tsm[type_name] = typeSupport; 00049 return DDS::RETCODE_OK; 00050 } 00051 00052 if (std::strcmp(typeSupport->_interface_repository_id(), 00053 iter->second->_interface_repository_id()) == 0) { 00054 return DDS::RETCODE_OK; 00055 } 00056 00057 return DDS::RETCODE_ERROR; 00058 }
DDS::ReturnCode_t OpenDDS::DCPS::Data_Types_Register::unregister_participant | ( | DDS::DomainParticipant_ptr | domain_participant | ) |
Definition at line 60 of file Registered_Data_Types.cpp.
References lock_, participants_, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
00062 { 00063 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, lock_, DDS::RETCODE_ERROR); 00064 participants_.erase(domain_participant); 00065 return DDS::RETCODE_OK; 00066 }
friend class ACE_Singleton< Data_Types_Register, ACE_SYNCH_MUTEX > [friend] |
Definition at line 36 of file Registered_Data_Types.h.
ACE_SYNCH_MUTEX OpenDDS::DCPS::Data_Types_Register::lock_ [mutable, private] |
Definition at line 67 of file Registered_Data_Types.h.
Referenced by lookup(), register_type(), and unregister_participant().
ParticipantMap OpenDDS::DCPS::Data_Types_Register::participants_ [private] |
Definition at line 68 of file Registered_Data_Types.h.
Referenced by lookup(), register_type(), and unregister_participant().