OpenDDS_Domain_Manager::OpenDDS_Domain_Manager (int & argc, ACE_TCHAR* argv[], DDS::DomainId_t domain_id, const DDS::DomainParticipantQos & qos) : dp_ (DDS::DomainParticipant::_nil ()), shutdown_lock_ (0), exit_handler_ (shutdown_lock_) { // get the domain participant factory from the singleton DDS::DomainParticipantFactory_var dpf = OpenDDS::DCPS::Service_Participant::instance ()-> get_domain_participant_factory (argc, argv); this->parse_args (argc, argv); // create the participant named 'participant'. dp_ = dpf->create_participant (domain_id, qos, DDS::DomainParticipantListener::_nil (), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); // check for successful creation if (CORBA::is_nil (dp_.in ())) throw Manager_Exception ("Failed to create domain participant."); // add a the handler for the SIGINT signal here ACE_Sig_Handler sig_handler; sig_handler.register_handler (SIGINT, &exit_handler_); }
void OpenDDS_Subscription_Manager::register_transport ( OpenDDS::DCPS::TransportIdType transport_id) { // Initialize the transport OpenDDS::DCPS::TransportImpl_rch transport_impl = OpenDDS::DCPS::TransportFactory::instance ()->obtain ( transport_id); // Attach the subscriber to the transport. OpenDDS::DCPS::SubscriberImpl* sub_impl = dynamic_cast<OpenDDS::DCPS::SubscriberImpl*> (sub_.in ()); if (0 == sub_impl) { throw Manager_Exception ("Failed to obtain subscriber servant"); } OpenDDS::DCPS::AttachStatus status = sub_impl->attach_transport(transport_impl.in()); if (status != OpenDDS::DCPS::ATTACH_OK) { std::string status_str; switch (status) { case OpenDDS::DCPS::ATTACH_BAD_TRANSPORT: status_str = "ATTACH_BAD_TRANSPORT"; break; case OpenDDS::DCPS::ATTACH_ERROR: status_str = "ATTACH_ERROR"; break; case OpenDDS::DCPS::ATTACH_INCOMPATIBLE_QOS: status_str = "ATTACH_INCOMPATIBLE_QOS"; break; default: status_str = "Unknown Status"; break; } std::string error_msg ( "Failed to attach subscriber to the transport. Status == "); error_msg += status_str.c_str(); throw Manager_Exception (error_msg); } }
void OpenDDS_Subscription_Manager::init (const DDS::SubscriberQos & qos) { // create the subscriber using default QoS. sub_ = dm_.participant ()->create_subscriber (qos, DDS::SubscriberListener::_nil (), OpenDDS::DCPS::DEFAULT_STATUS_MASK); // check for successful creation if (CORBA::is_nil (sub_.in ())) throw Manager_Exception ("Failed to create subscriber."); }