void TransportRegistry::register_type(const TransportType_rch& type) { DBG_ENTRY_LVL("TransportRegistry", "register_type", 6); int result; const OPENDDS_STRING name = type->name(); { GuardType guard(this->lock_); result = OpenDDS::DCPS::bind(type_map_, name, type); } // Check to see if it worked. // // 0 means it worked, 1 means it is a duplicate (and didn't work), and // -1 means something bad happened. if (result == 1) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: transport type=%C already registered ") ACE_TEXT("with TransportRegistry.\n"), name.c_str())); throw Transport::Duplicate(); } else if (result == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Failed to bind transport type=%C to ") ACE_TEXT("type_map_.\n"), name.c_str())); throw Transport::MiscProblem(); } }
DDS::Subscriber_var OpenDDS::Model::Entities::subscriber( const OPENDDS_STRING& name, const OPENDDS_STRING& transportConfig) { StringToSubscriberMap::const_iterator which = this->subscriberByString_.find( name); if( which != this->subscriberByString_.end()) { return DDS::Subscriber::_duplicate( which->second); } // See if there is a configuration profile for it. Config::SubscriberProfileMap::const_iterator where = this->config_.subscriberProfileMap().find( name); if( where == this->config_.subscriberProfileMap().end()) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Entities::subscriber() - ") ACE_TEXT("unable to find profile to configure ") ACE_TEXT("subscriber: [%C].\n"), name.c_str() )); return 0; } SubscriberProfile* profile = where->second; // Find the containing participant. DDS::DomainParticipant_var participant = this->participant( profile->participant, transportConfig); if( !participant) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Entities::subscriber() - ") ACE_TEXT("unable to find participant: [%C] for subscriber [%C].\n"), profile->participant.c_str(), name.c_str() )); return 0; } if( OpenDDS::DCPS::DCPS_debug_level>1) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Entities::subscriber() - ") ACE_TEXT("Creating subscriber [%C] in participant [%C].\n"), name.c_str(), profile->participant.c_str() )); } this->subscriberByString_[ name] = this->delegate_.createSubscriber( participant, profile->qos, OpenDDS::DCPS::DEFAULT_STATUS_MASK, transportConfig ); return this->subscriberByString_[ name]; }
bool RecorderImpl::lookup_instance_handles(const WriterIdSeq& ids, DDS::InstanceHandleSeq & hdls) { if (DCPS_debug_level > 9) { CORBA::ULong const size = ids.length(); OPENDDS_STRING separator = ""; OPENDDS_STRING buffer; for (unsigned long i = 0; i < size; ++i) { buffer += separator + OPENDDS_STRING(GuidConverter(ids[i])); separator = ", "; } ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) RecorderImpl::lookup_instance_handles: ") ACE_TEXT("searching for handles for writer Ids: %C.\n"), buffer.c_str())); } CORBA::ULong const num_wrts = ids.length(); hdls.length(num_wrts); for (CORBA::ULong i = 0; i < num_wrts; ++i) { hdls[i] = this->participant_servant_->get_handle(ids[i]); } return true; }
void OpenDDS::Model::Entities::registerTypes( const OPENDDS_STRING& participant, const OPENDDS_STRING& transportConfig) { OPENDDS_QUEUE(DDS::TypeSupport_ptr)& queue = this->typeSupport_[ participant]; if( queue.empty()) { return; } DDS::DomainParticipant_var p = this->participant(participant, transportConfig); if( !p) { return; } while( !queue.empty()) { if( OpenDDS::DCPS::DCPS_debug_level>1) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Entities::registerTypes() - ") ACE_TEXT("Registering type [%C] in participant [%C].\n"), queue.front()->get_type_name(), participant.c_str() )); } DDS::ReturnCode_t result = queue.front()->register_type(p, ""); if (result != DDS::RETCODE_OK) { ACE_ERROR((LM_ERROR, "(%P|%t) Entities::registerTypes() - " "register_type returned %d\n", result)); } queue.pop(); } }
bool ::DDS_TEST::supports(const OpenDDS::DCPS::TransportClient* tc, const OPENDDS_STRING& name) { if (tc == 0) { ACE_ERROR_RETURN((LM_INFO, ACE_TEXT("(%P|%t) Null transport client.\n")), 0); } OPENDDS_STRING supported; for (OPENDDS_VECTOR(OpenDDS::DCPS::TransportImpl_rch)::const_iterator it = tc->impls_.begin(), end = tc->impls_.end(); it != end;) { supported += (*it)->config()->name(); if (++it != end) { supported += ", "; } } ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Check if '%C' is among supported [%C]?\n"), name.c_str(), supported.c_str())); for (OPENDDS_VECTOR(OpenDDS::DCPS::TransportImpl_rch)::const_iterator it = tc->impls_.begin(); it != tc->impls_.end(); ++it) { if ((*it)->config()->name() == name) { // ACE_ERROR_RETURN((LM_DEBUG, // ACE_TEXT("(%P|%t) Yes. Transport '%C' is supported.\n"), // name.c_str()), // true); return true; } } // ACE_ERROR_RETURN((LM_DEBUG, // ACE_TEXT("(%P|%t) No. Transport '%C' is not supported.\n"), // name.c_str()), // false); return false; }
DDS::DomainParticipant_var OpenDDS::Model::Entities::participant( const OPENDDS_STRING& name, const OPENDDS_STRING& transportConfig ) { // See if its already here. StringToParticipantMap::const_iterator which = this->participantByString_.find( name); if( which != this->participantByString_.end()) { return DDS::DomainParticipant::_duplicate( which->second); } // See if there is a configuration profile for it. Config::ParticipantProfileMap::const_iterator where = this->config_.participantProfileMap().find( name); if( where == this->config_.participantProfileMap().end()) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Entities::participant() - ") ACE_TEXT("unable to find profile to configure participant: [%C].\n"), name.c_str() )); return 0; } // Create it. ParticipantProfile* profile = where->second; if( OpenDDS::DCPS::DCPS_debug_level>1) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Entities::participant() - ") ACE_TEXT("Creating participant [%C].\n"), name.c_str() )); } this->participantByString_[ name] = this->delegate_.createParticipant( profile->domainId, profile->qos, OpenDDS::DCPS::DEFAULT_STATUS_MASK, transportConfig ); return DDS::DomainParticipant::_duplicate( this->participantByString_[ name] ); }
TransportInst_rch TransportRegistry::create_inst(const OPENDDS_STRING& name, const OPENDDS_STRING& transport_type) { GuardType guard(this->lock_); TransportType_rch type; if (find(this->type_map_, transport_type, type) != 0) { #if !defined(ACE_AS_STATIC_LIBS) guard.release(); // Not present, try to load library this->load_transport_lib(transport_type); guard.acquire(); // Try to find it again if (find(this->type_map_, transport_type, type) != 0) { #endif ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::create_inst: ") ACE_TEXT("transport_type=%C is not registered.\n"), transport_type.c_str())); return TransportInst_rch(); #if !defined(ACE_AS_STATIC_LIBS) } #endif } if (this->inst_map_.count(name)) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::create_inst: ") ACE_TEXT("name=%C is already in use.\n"), name.c_str())); return TransportInst_rch(); } TransportInst_rch inst = type->new_inst(name); this->inst_map_[name] = inst; return inst; }
void MessageTracker::wait_messages_pending(OPENDDS_STRING& caller_message) { ACE_Time_Value pending_timeout = TheServiceParticipant->pending_timeout(); ACE_Time_Value* pTimeout = 0; if (pending_timeout != ACE_Time_Value::zero) { pTimeout = &pending_timeout; pending_timeout += ACE_OS::gettimeofday(); } ACE_GUARD(ACE_Thread_Mutex, guard, this->lock_); const bool report = DCPS_debug_level > 0 && pending_messages(); if (report) { ACE_TCHAR date_time[50]; ACE_TCHAR* const time = MessageTracker::timestamp(pending_timeout, date_time, 50); ACE_DEBUG((LM_DEBUG, ACE_TEXT("%T (%P|%t) MessageTracker::wait_messages_pending ") ACE_TEXT("from source=%C will wait until %s.\n"), msg_src_.c_str(), (pTimeout == 0 ? ACE_TEXT("(no timeout)") : time))); } while (true) { if (!pending_messages()) break; if (done_condition_.wait(pTimeout) == -1 && pending_messages()) { if (DCPS_debug_level) { ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) %T MessageTracker::") ACE_TEXT("wait_messages_pending (Redmine Issue# 1446) %p (caller: %s)\n"), ACE_TEXT("Timed out waiting for messages to be transported"), caller_message.c_str())); } break; } } if (report) { ACE_DEBUG((LM_DEBUG, "%T (%P|%t) MessageTracker::wait_messages_pending done\n")); } }
TransportConfig_rch TransportRegistry::create_config(const OPENDDS_STRING& name) { GuardType guard(this->lock_); if (this->config_map_.count(name)) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::create_config: ") ACE_TEXT("name=%C is already in use.\n"), name.c_str())); return TransportConfig_rch(); } TransportConfig_rch inst = new TransportConfig(name); this->config_map_[name] = inst; return inst; }
OPENDDS_STRING WriterInfo::get_state_str() const { OPENDDS_STRING ret; switch (this->state_) { case WriterInfo::NOT_SET: ret += "NOT_SET"; break; case WriterInfo::ALIVE: ret += "ALIVE"; break; case WriterInfo::DEAD: ret += "DEAD"; break; default: ret += "UNSPECIFIED("; ret += to_dds_string(int(this->state_)); ret += ")"; } return ret.c_str(); }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { if (parse_args(argc, argv) != 0) return 1; try { ACE_Argv_Type_Converter converter(argc, argv); CORBA::ORB_var orb = CORBA::ORB_init(converter.get_argc(), converter.get_ASCII_argv(), ""); CORBA::Object_var tmp = orb->string_to_object (ACE_TEXT_ALWAYS_CHAR(ior)); OpenDDS::DCPS::DCPSInfo_var info = OpenDDS::DCPS::DCPSInfo::_narrow (tmp.in ()); if (CORBA::is_nil(info.in()) ) { ACE_ERROR_RETURN ((LM_DEBUG, "Nil OpenDDS::DCPS::DCPSInfo reference <%s>\n", ior), 1); } OPENDDS_STRING state = info->dump_to_string(); std::cout << state.c_str() << std::endl; // clean up the orb orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught in publisher.cpp:"); return 1; } return 0; }
void OpenDDS::DCPS::RepoIdSetMap::dump() { DBG_ENTRY_LVL("RepoIdSetMap","dump",6); for (MapType::iterator itr = map_.begin(); itr != map_.end(); ++itr) { RepoIdSet_rch set = itr->second; for (RepoIdSet::MapType::iterator it = set->map().begin(); it != set->map().end(); ++it) { OPENDDS_STRING buffer; buffer + "key "; buffer += to_string(itr->first); buffer + " - value "; buffer += to_string(it->first); ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) %C \n"), buffer.c_str())); } } }
int TransportRegistry::load_transport_configuration(const OPENDDS_STRING& file_name, ACE_Configuration_Heap& cf) { const ACE_Configuration_Section_Key &root = cf.root_section(); // Create a vector to hold configuration information so we can populate // them after the transports instances are created. typedef std::pair<TransportConfig_rch, OPENDDS_VECTOR(OPENDDS_STRING) > ConfigInfo; OPENDDS_VECTOR(ConfigInfo) configInfoVec; // Record the transport instances created, so we can place them // in the implicit transport configuration for this file. OPENDDS_LIST(TransportInst_rch) instances; ACE_TString sect_name; for (int index = 0; cf.enumerate_sections(root, index, sect_name) == 0; ++index) { if (ACE_OS::strcmp(sect_name.c_str(), TRANSPORT_SECTION_NAME) == 0) { // found the [transport/*] section, now iterate through subsections... ACE_Configuration_Section_Key sect; if (cf.open_section(root, sect_name.c_str(), 0, sect) != 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("failed to open section %s\n"), sect_name.c_str()), -1); } else { // Ensure there are no properties in this section ValueMap vm; if (pullValues(cf, sect, vm) > 0) { // There are values inside [transport] ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("transport sections must have a section name\n"), sect_name.c_str()), -1); } // Process the subsections of this section (the individual transport // impls). KeyList keys; if (processSections( cf, sect, keys ) != 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("too many nesting layers in [%s] section.\n"), sect_name.c_str()), -1); } for (KeyList::const_iterator it=keys.begin(); it != keys.end(); ++it) { OPENDDS_STRING transport_id = (*it).first; ACE_Configuration_Section_Key inst_sect = (*it).second; ValueMap values; if (pullValues( cf, (*it).second, values ) != 0) { // Get the factory_id for the transport. OPENDDS_STRING transport_type; ValueMap::const_iterator vm_it = values.find("transport_type"); if (vm_it != values.end()) { transport_type = (*vm_it).second; } else { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("missing transport_type in [transport/%C] section.\n"), transport_id.c_str()), -1); } // Create the TransportInst object and load the transport // configuration in ACE_Configuration_Heap to the TransportInst // object. TransportInst_rch inst = this->create_inst(transport_id, transport_type); if (inst == 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("Unable to create transport instance in [transport/%C] section.\n"), transport_id.c_str()), -1); } instances.push_back(inst); inst->load(cf, inst_sect); } else { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("missing transport_type in [transport/%C] section.\n"), transport_id.c_str()), -1); } } } } else if (ACE_OS::strcmp(sect_name.c_str(), CONFIG_SECTION_NAME) == 0) { // found the [config/*] section, now iterate through subsections... ACE_Configuration_Section_Key sect; if (cf.open_section(root, sect_name.c_str(), 0, sect) != 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("failed to open section [%s]\n"), sect_name.c_str()), -1); } else { // Ensure there are no properties in this section ValueMap vm; if (pullValues(cf, sect, vm) > 0) { // There are values inside [config] ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("config sections must have a section name\n"), sect_name.c_str()), -1); } // Process the subsections of this section (the individual config // impls). KeyList keys; if (processSections( cf, sect, keys ) != 0) { // Don't allow multiple layers of nesting ([config/x/y]). ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("too many nesting layers in [%s] section.\n"), sect_name.c_str()), -1); } for (KeyList::const_iterator it=keys.begin(); it != keys.end(); ++it) { OPENDDS_STRING config_id = (*it).first; // Create a TransportConfig object. TransportConfig_rch config = this->create_config(config_id); if (config == 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("Unable to create transport config in [config/%C] section.\n"), config_id.c_str()), -1); } ValueMap values; pullValues( cf, (*it).second, values ); ConfigInfo configInfo; configInfo.first = config; for (ValueMap::const_iterator it=values.begin(); it != values.end(); ++it) { OPENDDS_STRING name = (*it).first; if (name == "transports") { OPENDDS_STRING value = (*it).second; char delim = ','; size_t pos = 0; OPENDDS_STRING token; while ((pos = value.find(delim)) != OPENDDS_STRING::npos) { token = value.substr(0, pos); configInfo.second.push_back(token); value.erase(0, pos + 1); } configInfo.second.push_back(value); configInfoVec.push_back(configInfo); } else if (name == "swap_bytes") { OPENDDS_STRING value = (*it).second; if ((value == "1") || (value == "true")) { config->swap_bytes_ = true; } else if ((value != "0") && (value != "false")) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("Illegal value for swap_bytes (%C) in [config/%C] section.\n"), value.c_str(), config_id.c_str()), -1); } } else if (name == "passive_connect_duration") { OPENDDS_STRING value = (*it).second; if (!convertToInteger(value, config->passive_connect_duration_)) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("Illegal integer value for passive_connect_duration (%s) in [config/%C] section.\n"), value.c_str(), config_id.c_str()), -1); } } else { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("Unexpected entry (%C) in [config/%C] section.\n"), name.c_str(), config_id.c_str()), -1); } } if (configInfo.second.size() == 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("No transport instances listed in [config/%C] section.\n"), config_id.c_str()), -1); } } } } else if (ACE_OS::strncmp(sect_name.c_str(), OLD_TRANSPORT_PREFIX.c_str(), OLD_TRANSPORT_PREFIX.length()) == 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ") ACE_TEXT("Obsolete transport configuration found (%s).\n"), sect_name.c_str()), -1); } } // Populate the configurations with instances for (unsigned int i = 0; i < configInfoVec.size(); ++i) { TransportConfig_rch config = configInfoVec[i].first; OPENDDS_VECTOR(OPENDDS_STRING)& insts = configInfoVec[i].second; for (unsigned int j = 0; j < insts.size(); ++j) { TransportInst_rch inst = this->get_inst(insts[j]); if (inst == 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("The inst (%C) in [config/%C] section is undefined.\n"), insts[j].c_str(), config->name().c_str()), -1); } config->instances_.push_back(inst); } } // Create and populate the default configuration for this // file with all the instances from this file. if (!instances.empty()) { TransportConfig_rch config = this->create_config(file_name); if (config == 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) TransportRegistry::load_transport_configuration: ") ACE_TEXT("Unable to create default transport config.\n"), file_name.c_str()), -1); } instances.sort(predicate); for (OPENDDS_LIST(TransportInst_rch)::const_iterator it = instances.begin(); it != instances.end(); ++it) { config->instances_.push_back(*it); } } return 0; }
DDS::DataReader_var OpenDDS::Model::Entities::reader( const OPENDDS_STRING& name, const OPENDDS_STRING& transportConfig) { StringToDataReaderMap::const_iterator which = this->readerByString_.find( name); if( which != this->readerByString_.end()) { return DDS::DataReader::_duplicate( which->second); } // See if there is a configuration profile for it. Config::ReaderProfileMap::const_iterator where = this->config_.readerProfileMap().find( name); if( where == this->config_.readerProfileMap().end()) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ") ACE_TEXT("unable to find profile to configure ") ACE_TEXT("reader: [%C].\n"), name.c_str() )); return 0; } ReaderProfile* profile = where->second; // Find the containing Subscriber. DDS::Subscriber_var subscriber = this->subscriber(profile->subscriber, transportConfig); if( !subscriber) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ") ACE_TEXT("unable to find subscriber: [%C] for reader [%C].\n"), profile->subscriber.c_str(), name.c_str() )); return 0; } // We need the *name* of the participant in order to look up the Topic. // This should be Ok since we will only be configuring Readers that have // been successfully defined in a configuration file, implying that there // exists a defined [subscriber] profile. Config::SubscriberProfileMap::const_iterator location = this->config_.subscriberProfileMap().find( profile->subscriber); if( location == this->config_.subscriberProfileMap().end()) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ") ACE_TEXT("unable to find profile to configure ") ACE_TEXT("subscriber: [%C] for reader [%C].\n"), profile->subscriber.c_str(), name.c_str() )); return 0; } SubscriberProfile* subscriberProfile = location->second; // Find the Topic. DDS::Topic_var topic = this->topic(profile->topic, subscriberProfile->participant, transportConfig); if( !topic) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ") ACE_TEXT("unable to find topic: [%C] for reader [%C] in participant [%C].\n"), profile->topic.c_str(), name.c_str(), subscriberProfile->participant.c_str() )); return 0; } DDS::DataReaderQos readerQos; DDS::TopicQos topicQos; topic->get_qos( topicQos); subscriber->get_default_datareader_qos( readerQos); subscriber->copy_from_topic_qos( readerQos, topicQos); profile->copyToReaderQos( readerQos); if( OpenDDS::DCPS::DCPS_debug_level>1) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Entities::reader() - ") ACE_TEXT("Creating reader [%C] in subscriber [%C] in participant [%C] ") ACE_TEXT("with topic [%C].\n"), name.c_str(), profile->subscriber.c_str(), subscriberProfile->participant.c_str(), profile->topic.c_str() )); } this->readerByString_[ name] = this->delegate_.createReader( subscriber, topic, readerQos, OpenDDS::DCPS::DEFAULT_STATUS_MASK, transportConfig ); return this->readerByString_[ name]; }
DDS::Topic_var OpenDDS::Model::Entities::topic( const OPENDDS_STRING& name, const OPENDDS_STRING& participant, const OPENDDS_STRING& transportConfig ) { // See if its already here. StringToTopicMap::const_iterator which = this->topicByParticipant_[ participant].find( name); if( which != this->topicByParticipant_[ participant].end()) { return DDS::Topic::_duplicate( which->second); } // See if there is a configuration profile for it. Config::TopicProfileMap::const_iterator where = this->config_.topicProfileMap().find( name); if( where == this->config_.topicProfileMap().end()) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Entities::topic() - ") ACE_TEXT("unable to find profile to configure ") ACE_TEXT("topic: [%C] in participant: [%C].\n"), name.c_str(), participant.c_str() )); return 0; } TopicProfile* profile = where->second; // Find the containing participant. DDS::DomainParticipant_var p = this->participant(participant, transportConfig); if( !p) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Entities::topic() - ") ACE_TEXT("unable to find participant: [%C] for topic [%C].\n"), participant.c_str(), name.c_str() )); return 0; } // Ensure that we have all available types registered for this // participant. this->registerTypes(participant, transportConfig); // Create it. if( OpenDDS::DCPS::DCPS_debug_level>1) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Entities::topic() - ") ACE_TEXT("Creating topic [%C] in participant [%C] with type [%C].\n"), name.c_str(), participant.c_str(), profile->type.c_str() )); } this->topicByParticipant_[ participant][ name] = this->delegate_.createTopic( p, name.c_str(), this->typeNameByString_[profile->type], profile->qos, OpenDDS::DCPS::DEFAULT_STATUS_MASK ); return DDS::Topic::_duplicate( this->topicByParticipant_[ participant][ name] ); }
bool ::DDS_TEST::negotiated(const OpenDDS::DCPS::TransportClient* ctc, const OPENDDS_STRING& name) { if (ctc == 0) { ACE_ERROR_RETURN((LM_INFO, ACE_TEXT("(%P|%t) Null transport client.\n")), false); } OpenDDS::DCPS::TransportClient* tc = const_cast<OpenDDS::DCPS::TransportClient*> (ctc); if (tc == 0) { ACE_ERROR_RETURN((LM_INFO, ACE_TEXT("(%P|%t) Null transport client.\n")), false); } if (tc->links_.map().size() == 0) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) No negotiated protocols?!.\n")), false); } OPENDDS_STRING negotiated; for (OpenDDS::DCPS::DataLinkSet::MapType::iterator iter = tc->links_.map().begin(), end = tc->links_.map().end(); iter != end;) { const OpenDDS::DCPS::DataLink_rch& datalink = iter->second; negotiated += datalink->impl()->config()->name(); if (++iter != end) { negotiated += ", "; } } ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Check if '%C' is among negotiated [%C]?\n"), name.c_str(), negotiated.c_str())); for (OpenDDS::DCPS::DataLinkSet::MapType::iterator iter = tc->links_.map().begin(), end = tc->links_.map().end(); iter != end; ++iter) { const OpenDDS::DCPS::DataLink_rch& datalink = iter->second; if (datalink->impl()->config()->name() == name) { // ACE_ERROR_RETURN((LM_DEBUG, // ACE_TEXT("(%P|%t) Yes. Transport '%C' was negotiated.\n"), // name.c_str()), // true); return true; } } // ACE_ERROR_RETURN((LM_DEBUG, // ACE_TEXT("(%P|%t) No. Transport '%C' was not negotiated.\n"), // name.c_str()), // false); return false; }