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