| 229 | } |
| 230 | |
| 231 | bool |
| 232 | TAO_DDS_DCPSInfo_i::add_topic(const OpenDDS::DCPS::GUID_t& topicId, |
| 233 | DDS::DomainId_t domainId, |
| 234 | const OpenDDS::DCPS::GUID_t& participantId, |
| 235 | const char* topicName, |
| 236 | const char* dataTypeName, |
| 237 | const DDS::TopicQos& qos) |
| 238 | { |
| 239 | ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, guard, this->lock_, false); |
| 240 | |
| 241 | // Grab the domain. |
| 242 | DCPS_IR_Domain_Map::iterator where = this->domains_.find(domainId); |
| 243 | |
| 244 | if (where == this->domains_.end()) { |
| 245 | if (OpenDDS::DCPS::DCPS_debug_level > 4) { |
| 246 | ACE_DEBUG((LM_WARNING, |
| 247 | ACE_TEXT("(%P|%t) WARNING: TAO_DDS_DCPSInfo_i:add_topic: ") |
| 248 | ACE_TEXT("invalid domain %d.\n"), |
| 249 | domainId)); |
| 250 | } |
| 251 | |
| 252 | return false; |
| 253 | } |
| 254 | |
| 255 | // Grab the participant. |
| 256 | DCPS_IR_Participant* participantPtr |
| 257 | = where->second->participant(participantId); |
| 258 | |
| 259 | if (0 == participantPtr) { |
| 260 | if (OpenDDS::DCPS::DCPS_debug_level > 4) { |
| 261 | OpenDDS::DCPS::RepoIdConverter converter(participantId); |
| 262 | ACE_DEBUG((LM_WARNING, |
| 263 | ACE_TEXT("(%P|%t) WARNING: TAO_DDS_DCPSInfo_i:add_topic: ") |
| 264 | ACE_TEXT("invalid participant %C.\n"), |
| 265 | std::string(converter).c_str())); |
| 266 | } |
| 267 | |
| 268 | return false; |
| 269 | } |
| 270 | |
| 271 | OpenDDS::DCPS::TopicStatus topicStatus |
| 272 | = where->second->force_add_topic(topicId, topicName, dataTypeName, |
| 273 | qos, participantPtr); |
| 274 | |
| 275 | if (topicStatus != OpenDDS::DCPS::CREATED) { |
| 276 | return false; |
| 277 | } |
| 278 | |
| 279 | OpenDDS::DCPS::RepoIdConverter converter(topicId); |
| 280 | |
| 281 | // See if we are adding a topic that was created within this |
| 282 | // repository or a different repository. |
| 283 | if (converter.federationId() == federation_.id()) { |
| 284 | // Ensure the topic GUID_t values do not conflict. |
| 285 | participantPtr->last_topic_key(converter.entityKey()); |
| 286 | } |
| 287 | |
| 288 | return true; |
no test coverage detected