00001
00002
00003
00004
00005
00006
00007
00008 #include "DCPS/DdsDcps_pch.h"
00009 #include "Discovery.h"
00010 #include "Service_Participant.h"
00011 #include "BuiltInTopicUtils.h"
00012 #include "Registered_Data_Types.h"
00013 #include "DdsDcpsCoreC.h"
00014 #include "Marked_Default_Qos.h"
00015
00016 #ifndef DDS_HAS_MINIMUM_BIT
00017 #include "DdsDcpsCoreTypeSupportImpl.h"
00018 #endif
00019
00020 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00021
00022 namespace OpenDDS {
00023 namespace DCPS {
00024
00025 const char* Discovery::DEFAULT_REPO = "DEFAULT_REPO";
00026 const char* Discovery::DEFAULT_RTPS = "DEFAULT_RTPS";
00027 const char* Discovery::DEFAULT_STATIC = "DEFAULT_STATIC";
00028
00029 DDS::ReturnCode_t
00030 Discovery::create_bit_topics(DomainParticipantImpl* participant)
00031 {
00032 #ifndef DDS_HAS_MINIMUM_BIT
00033
00034 TypeSupport_var type_support =
00035 Registered_Data_Types->lookup(participant, BUILT_IN_PARTICIPANT_TOPIC_TYPE);
00036
00037 if (CORBA::is_nil(type_support)) {
00038
00039 DDS::ParticipantBuiltinTopicDataTypeSupport_var ts =
00040 new DDS::ParticipantBuiltinTopicDataTypeSupportImpl;
00041
00042 DDS::ReturnCode_t ret = ts->register_type(participant,
00043 BUILT_IN_PARTICIPANT_TOPIC_TYPE);
00044
00045 if (ret != DDS::RETCODE_OK) {
00046 ACE_ERROR_RETURN((LM_ERROR,
00047 ACE_TEXT("(%P|%t) ")
00048 ACE_TEXT("Discovery::create_bit_topics, ")
00049 ACE_TEXT("register BUILT_IN_PARTICIPANT_TOPIC_TYPE returned %d.\n"),
00050 ret),
00051 ret);
00052 }
00053 }
00054
00055 DDS::Topic_var bit_part_topic =
00056 participant->create_topic(BUILT_IN_PARTICIPANT_TOPIC,
00057 BUILT_IN_PARTICIPANT_TOPIC_TYPE,
00058 TOPIC_QOS_DEFAULT,
00059 DDS::TopicListener::_nil(),
00060 DEFAULT_STATUS_MASK);
00061
00062 if (CORBA::is_nil(bit_part_topic)) {
00063 ACE_ERROR_RETURN((LM_ERROR,
00064 ACE_TEXT("(%P|%t) ")
00065 ACE_TEXT("Discovery::create_bit_topics, ")
00066 ACE_TEXT("Nil %C Topic\n"),
00067 BUILT_IN_PARTICIPANT_TOPIC),
00068 DDS::RETCODE_ERROR);
00069 }
00070
00071
00072 type_support =
00073 Registered_Data_Types->lookup(participant, BUILT_IN_TOPIC_TOPIC_TYPE);
00074
00075 if (CORBA::is_nil(type_support)) {
00076 DDS::TopicBuiltinTopicDataTypeSupport_var ts =
00077 new DDS::TopicBuiltinTopicDataTypeSupportImpl;
00078
00079 DDS::ReturnCode_t ret = ts->register_type(participant,
00080 BUILT_IN_TOPIC_TOPIC_TYPE);
00081
00082 if (ret != DDS::RETCODE_OK) {
00083 ACE_ERROR_RETURN((LM_ERROR,
00084 ACE_TEXT("(%P|%t) ")
00085 ACE_TEXT("Discovery::create_bit_topics, ")
00086 ACE_TEXT("register BUILT_IN_TOPIC_TOPIC_TYPE returned %d.\n"),
00087 ret),
00088 ret);
00089 }
00090 }
00091
00092 DDS::Topic_var bit_topic_topic =
00093 participant->create_topic(BUILT_IN_TOPIC_TOPIC,
00094 BUILT_IN_TOPIC_TOPIC_TYPE,
00095 TOPIC_QOS_DEFAULT,
00096 DDS::TopicListener::_nil(),
00097 DEFAULT_STATUS_MASK);
00098
00099 if (CORBA::is_nil(bit_topic_topic)) {
00100 ACE_ERROR_RETURN((LM_ERROR,
00101 ACE_TEXT("(%P|%t) ")
00102 ACE_TEXT("Discovery::create_bit_topics, ")
00103 ACE_TEXT("Nil %C Topic\n"),
00104 BUILT_IN_TOPIC_TOPIC),
00105 DDS::RETCODE_ERROR);
00106 }
00107
00108
00109 type_support =
00110 Registered_Data_Types->lookup(participant, BUILT_IN_SUBSCRIPTION_TOPIC_TYPE);
00111
00112 if (CORBA::is_nil(type_support)) {
00113 DDS::SubscriptionBuiltinTopicDataTypeSupport_var ts =
00114 new DDS::SubscriptionBuiltinTopicDataTypeSupportImpl;
00115
00116 DDS::ReturnCode_t ret = ts->register_type(participant,
00117 BUILT_IN_SUBSCRIPTION_TOPIC_TYPE);
00118
00119 if (ret != DDS::RETCODE_OK) {
00120 ACE_ERROR_RETURN((LM_ERROR,
00121 ACE_TEXT("(%P|%t) ")
00122 ACE_TEXT("Discovery::create_bit_topics, ")
00123 ACE_TEXT("register BUILT_IN_SUBSCRIPTION_TOPIC_TYPE returned %d.\n"),
00124 ret),
00125 ret);
00126 }
00127 }
00128
00129 DDS::Topic_var bit_sub_topic =
00130 participant->create_topic(BUILT_IN_SUBSCRIPTION_TOPIC,
00131 BUILT_IN_SUBSCRIPTION_TOPIC_TYPE,
00132 TOPIC_QOS_DEFAULT,
00133 DDS::TopicListener::_nil(),
00134 DEFAULT_STATUS_MASK);
00135
00136 if (CORBA::is_nil(bit_sub_topic)) {
00137 ACE_ERROR_RETURN((LM_ERROR,
00138 ACE_TEXT("(%P|%t) ")
00139 ACE_TEXT("Discovery::create_bit_topics, ")
00140 ACE_TEXT("Nil %C Topic\n"),
00141 BUILT_IN_SUBSCRIPTION_TOPIC),
00142 DDS::RETCODE_ERROR);
00143 }
00144
00145
00146 type_support =
00147 Registered_Data_Types->lookup(participant, BUILT_IN_PUBLICATION_TOPIC_TYPE);
00148
00149 if (CORBA::is_nil(type_support)) {
00150 DDS::PublicationBuiltinTopicDataTypeSupport_var ts =
00151 new DDS::PublicationBuiltinTopicDataTypeSupportImpl;
00152
00153 DDS::ReturnCode_t ret = ts->register_type(participant,
00154 BUILT_IN_PUBLICATION_TOPIC_TYPE);
00155
00156 if (ret != DDS::RETCODE_OK) {
00157 ACE_ERROR_RETURN((LM_ERROR,
00158 ACE_TEXT("(%P|%t) ")
00159 ACE_TEXT("Discovery::create_bit_topics, ")
00160 ACE_TEXT("register BUILT_IN_PUBLICATION_TOPIC_TYPE returned %d.\n"),
00161 ret),
00162 ret);
00163 }
00164 }
00165
00166 DDS::Topic_var bit_pub_topic =
00167 participant->create_topic(BUILT_IN_PUBLICATION_TOPIC,
00168 BUILT_IN_PUBLICATION_TOPIC_TYPE,
00169 TOPIC_QOS_DEFAULT,
00170 DDS::TopicListener::_nil(),
00171 DEFAULT_STATUS_MASK);
00172
00173 if (CORBA::is_nil(bit_pub_topic)) {
00174 ACE_ERROR_RETURN((LM_ERROR,
00175 ACE_TEXT("(%P|%t) ERROR: Discovery::create_bit_topics, ")
00176 ACE_TEXT("Nil %C Topic\n"),
00177 BUILT_IN_PUBLICATION_TOPIC),
00178 DDS::RETCODE_ERROR);
00179 }
00180
00181 bit_part_topic->enable();
00182 bit_topic_topic->enable();
00183 bit_sub_topic->enable();
00184 bit_pub_topic->enable();
00185 #else
00186 ACE_UNUSED_ARG(participant);
00187 #endif
00188
00189 return DDS::RETCODE_OK;
00190 }
00191
00192 Discovery::Config::~Config()
00193 {
00194 }
00195
00196 }
00197 }
00198
00199 OPENDDS_END_VERSIONED_NAMESPACE_DECL