| 104 | } |
| 105 | |
| 106 | DDS::Topic_var |
| 107 | OpenDDS::Model::Entities::topic( |
| 108 | const OPENDDS_STRING& name, |
| 109 | const OPENDDS_STRING& participant, |
| 110 | const OPENDDS_STRING& transportConfig |
| 111 | ) |
| 112 | { |
| 113 | // See if its already here. |
| 114 | StringToTopicMap::const_iterator which |
| 115 | = this->topicByParticipant_[ participant].find( name); |
| 116 | if( which != this->topicByParticipant_[ participant].end()) { |
| 117 | return DDS::Topic::_duplicate( which->second); |
| 118 | } |
| 119 | |
| 120 | // See if there is a configuration profile for it. |
| 121 | Config::TopicProfileMap::const_iterator where |
| 122 | = this->config_.topicProfileMap().find( name); |
| 123 | if( where == this->config_.topicProfileMap().end()) { |
| 124 | ACE_ERROR((LM_ERROR, |
| 125 | ACE_TEXT("(%P|%t) ERROR: Entities::topic() - ") |
| 126 | ACE_TEXT("unable to find profile to configure ") |
| 127 | ACE_TEXT("topic: [%C] in participant: [%C].\n"), |
| 128 | name.c_str(), participant.c_str() |
| 129 | )); |
| 130 | return 0; |
| 131 | } |
| 132 | TopicProfile* profile = where->second; |
| 133 | |
| 134 | // Find the containing participant. |
| 135 | DDS::DomainParticipant_var p = this->participant(participant, |
| 136 | transportConfig); |
| 137 | if( !p) { |
| 138 | ACE_ERROR((LM_ERROR, |
| 139 | ACE_TEXT("(%P|%t) ERROR: Entities::topic() - ") |
| 140 | ACE_TEXT("unable to find participant: [%C] for topic [%C].\n"), |
| 141 | participant.c_str(), name.c_str() |
| 142 | )); |
| 143 | return 0; |
| 144 | } |
| 145 | |
| 146 | // Ensure that we have all available types registered for this |
| 147 | // participant. |
| 148 | this->registerTypes(participant, transportConfig); |
| 149 | |
| 150 | // Create it. |
| 151 | if( OpenDDS::DCPS::DCPS_debug_level>1) { |
| 152 | ACE_DEBUG((LM_DEBUG, |
| 153 | ACE_TEXT("(%P|%t) Entities::topic() - ") |
| 154 | ACE_TEXT("Creating topic [%C] in participant [%C] with type [%C].\n"), |
| 155 | name.c_str(), |
| 156 | participant.c_str(), |
| 157 | profile->type.c_str() |
| 158 | )); |
| 159 | } |
| 160 | this->topicByParticipant_[ participant][ name] |
| 161 | = this->delegate_.createTopic( |
| 162 | p, |
| 163 | name.c_str(), |