| 126 | |
| 127 | |
| 128 | void |
| 129 | PubDriver::initialize(int& argc, ACE_TCHAR *argv[]) |
| 130 | { |
| 131 | ::DDS::DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv); |
| 132 | |
| 133 | ::DDS::ReturnCode_t ret = ::DDS::RETCODE_OK; |
| 134 | |
| 135 | ::Xyz::FooTypeSupport_var fts (new ::Xyz::FooTypeSupportImpl); |
| 136 | |
| 137 | participant_ = |
| 138 | dpf->create_participant(MY_DOMAIN, |
| 139 | PARTICIPANT_QOS_DEFAULT, |
| 140 | ::DDS::DomainParticipantListener::_nil(), |
| 141 | ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); |
| 142 | TEST_CHECK (! CORBA::is_nil (participant_.in ())); |
| 143 | // NOTE: A participant may not contain itself |
| 144 | TEST_CHECK (!participant_->contains_entity(participant_->get_instance_handle())); |
| 145 | |
| 146 | if (::DDS::RETCODE_OK != fts->register_type(participant_.in (), MY_TYPE)) |
| 147 | { |
| 148 | ACE_ERROR ((LM_ERROR, |
| 149 | ACE_TEXT ("Failed to register the FooTypeSupport."))); |
| 150 | } |
| 151 | |
| 152 | |
| 153 | ::DDS::TopicQos default_topic_qos; |
| 154 | participant_->get_default_topic_qos(default_topic_qos); |
| 155 | |
| 156 | ::DDS::TopicQos new_topic_qos = default_topic_qos; |
| 157 | new_topic_qos.reliability.kind = ::DDS::RELIABLE_RELIABILITY_QOS; |
| 158 | |
| 159 | TEST_CHECK (! (new_topic_qos == default_topic_qos)); |
| 160 | |
| 161 | participant_->set_default_topic_qos(new_topic_qos); |
| 162 | |
| 163 | topic_ = participant_->create_topic (MY_TOPIC, |
| 164 | MY_TYPE, |
| 165 | TOPIC_QOS_DEFAULT, |
| 166 | ::DDS::TopicListener::_nil(), |
| 167 | ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); |
| 168 | TEST_CHECK (! CORBA::is_nil (topic_.in ())); |
| 169 | TEST_CHECK (participant_->contains_entity(topic_->get_instance_handle())); |
| 170 | |
| 171 | publisher_ = |
| 172 | participant_->create_publisher(PUBLISHER_QOS_DEFAULT, |
| 173 | ::DDS::PublisherListener::_nil(), |
| 174 | ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); |
| 175 | TEST_CHECK (! CORBA::is_nil (publisher_.in ())); |
| 176 | |
| 177 | { |
| 178 | OpenDDS::DCPS::RestoreOutputStreamState ross(std::cout); |
| 179 | std::cout << std::hex << "0x" << publisher_->get_instance_handle() << std::endl; |
| 180 | } |
| 181 | |
| 182 | TEST_CHECK (participant_->contains_entity(publisher_->get_instance_handle())); |
| 183 | |
| 184 | ::DDS::PublisherQos pub_qos_got; |
| 185 | publisher_->get_qos (pub_qos_got); |