#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_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 > | 
A singleton class that keeps track of the registered DDS data types local to this process. Data types are registered by domain participant.
Definition at line 37 of file Registered_Data_Types.h.
| OpenDDS::DCPS::Data_Types_Register::Data_Types_Register | ( | ) |  [private] | 
        
Definition at line 24 of file Registered_Data_Types.cpp.
| OpenDDS::DCPS::Data_Types_Register::~Data_Types_Register | ( | ) |  [private] | 
        
Definition at line 28 of file Registered_Data_Types.cpp.
| Data_Types_Register * OpenDDS::DCPS::Data_Types_Register::instance | ( | void | ) |  [static] | 
        
Return a singleton instance of this class.
Definition at line 33 of file Registered_Data_Types.cpp.
00034 { 00035 return ACE_Singleton<Data_Types_Register, ACE_SYNCH_MUTEX>::instance(); 00036 }
| 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 95 of file Registered_Data_Types.cpp.
References lock_, and participants_.
00098 { 00099 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, lock_, 0); 00100 00101 ParticipantMap::const_iterator iter1 = participants_.find(domain_participant); 00102 if (iter1 == participants_.end()) { 00103 return 0; 00104 } 00105 00106 TypeSupportMap::const_iterator iter2 = iter1->second.find(type_name); 00107 if (iter2 == iter1->second.end()) { 00108 return 0; 00109 } 00110 00111 TypeSupport_var typeSupport = iter2->second; 00112 return typeSupport._retn(); 00113 }
| 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 38 of file Registered_Data_Types.cpp.
References lock_, participants_, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
00042 { 00043 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, lock_, DDS::RETCODE_ERROR); 00044 00045 TypeSupportMap& tsm = participants_[domain_participant]; 00046 const TypeSupport_var typeSupport = TypeSupport::_duplicate(the_type); 00047 00048 TypeSupportMap::iterator iter = tsm.find(type_name); 00049 if (iter == tsm.end()) { 00050 tsm[type_name] = typeSupport; 00051 return DDS::RETCODE_OK; 00052 } 00053 00054 if (std::strcmp(typeSupport->_interface_repository_id(), 00055 iter->second->_interface_repository_id()) == 0) { 00056 return DDS::RETCODE_OK; 00057 } 00058 00059 return DDS::RETCODE_ERROR; 00060 }
| DDS::ReturnCode_t OpenDDS::DCPS::Data_Types_Register::unregister_participant | ( | DDS::DomainParticipant_ptr | domain_participant | ) | 
Definition at line 87 of file Registered_Data_Types.cpp.
References lock_, participants_, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
00089 { 00090 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, lock_, DDS::RETCODE_ERROR); 00091 participants_.erase(domain_participant); 00092 return DDS::RETCODE_OK; 00093 }
| DDS::ReturnCode_t OpenDDS::DCPS::Data_Types_Register::unregister_type | ( | DDS::DomainParticipant_ptr | domain_participant, | |
| const char * | type_name, | |||
| TypeSupport_ptr | the_type | |||
| ) | 
Unregister a type.
Definition at line 62 of file Registered_Data_Types.cpp.
References lock_, participants_, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
00066 { 00067 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, lock_, DDS::RETCODE_ERROR); 00068 00069 TypeSupportMap& tsm = participants_[domain_participant]; 00070 00071 TypeSupportMap::iterator iter = tsm.find(type_name); 00072 if (iter == tsm.end()) { 00073 // Not in the map, can't delete 00074 return DDS::RETCODE_ERROR; 00075 } 00076 else { 00077 if (std::strcmp(the_type->_interface_repository_id(), iter->second->_interface_repository_id()) == 0) { 00078 tsm.erase(iter); 00079 return DDS::RETCODE_OK; 00080 } 00081 else { 00082 return DDS::RETCODE_ERROR; 00083 } 00084 } 00085 }
friend class ACE_Singleton< Data_Types_Register, ACE_SYNCH_MUTEX > [friend] | 
        
Definition at line 38 of file Registered_Data_Types.h.
ACE_SYNCH_MUTEX OpenDDS::DCPS::Data_Types_Register::lock_ [mutable, private] | 
        
Definition at line 80 of file Registered_Data_Types.h.
Referenced by lookup(), register_type(), unregister_participant(), and unregister_type().
ParticipantMap OpenDDS::DCPS::Data_Types_Register::participants_ [private] | 
        
Definition at line 81 of file Registered_Data_Types.h.
Referenced by lookup(), register_type(), unregister_participant(), and unregister_type().
 1.6.1