| 171 | } |
| 172 | |
| 173 | DDS::Publisher_var |
| 174 | OpenDDS::Model::Entities::publisher( |
| 175 | const OPENDDS_STRING& name, |
| 176 | const OPENDDS_STRING& transportConfig) |
| 177 | { |
| 178 | StringToPublisherMap::const_iterator which |
| 179 | = this->publisherByString_.find( name); |
| 180 | if( which != this->publisherByString_.end()) { |
| 181 | return DDS::Publisher::_duplicate( which->second); |
| 182 | } |
| 183 | |
| 184 | // See if there is a configuration profile for it. |
| 185 | Config::PublisherProfileMap::const_iterator where |
| 186 | = this->config_.publisherProfileMap().find( name); |
| 187 | if( where == this->config_.publisherProfileMap().end()) { |
| 188 | ACE_ERROR((LM_ERROR, |
| 189 | ACE_TEXT("(%P|%t) ERROR: Entities::publisher() - ") |
| 190 | ACE_TEXT("unable to find profile to configure ") |
| 191 | ACE_TEXT("publisher: [%C].\n"), |
| 192 | name.c_str() |
| 193 | )); |
| 194 | return 0; |
| 195 | } |
| 196 | PublisherProfile* profile = where->second; |
| 197 | |
| 198 | // Find the containing participant. |
| 199 | DDS::DomainParticipant_var participant |
| 200 | = this->participant( profile->participant, transportConfig); |
| 201 | if( !participant) { |
| 202 | ACE_ERROR((LM_ERROR, |
| 203 | ACE_TEXT("(%P|%t) ERROR: Entities::publisher() - ") |
| 204 | ACE_TEXT("unable to find participant: [%C] for publisher [%C].\n"), |
| 205 | profile->participant.c_str(), name.c_str() |
| 206 | )); |
| 207 | return 0; |
| 208 | } |
| 209 | |
| 210 | if( OpenDDS::DCPS::DCPS_debug_level>1) { |
| 211 | ACE_DEBUG((LM_DEBUG, |
| 212 | ACE_TEXT("(%P|%t) Entities::publisher() - ") |
| 213 | ACE_TEXT("Creating publisher [%C] in participant [%C].\n"), |
| 214 | name.c_str(), |
| 215 | profile->participant.c_str() |
| 216 | )); |
| 217 | } |
| 218 | this->publisherByString_[ name] |
| 219 | = this->delegate_.createPublisher( |
| 220 | participant, |
| 221 | profile->qos, |
| 222 | OpenDDS::DCPS::DEFAULT_STATUS_MASK, |
| 223 | transportConfig |
| 224 | ); |
| 225 | |
| 226 | return this->publisherByString_[ name]; |
| 227 | } |
| 228 | |
| 229 | DDS::Subscriber_var |
| 230 | OpenDDS::Model::Entities::subscriber( |