| 227 | } |
| 228 | |
| 229 | DDS::Subscriber_var |
| 230 | OpenDDS::Model::Entities::subscriber( |
| 231 | const OPENDDS_STRING& name, |
| 232 | const OPENDDS_STRING& transportConfig) |
| 233 | { |
| 234 | StringToSubscriberMap::const_iterator which |
| 235 | = this->subscriberByString_.find( name); |
| 236 | if( which != this->subscriberByString_.end()) { |
| 237 | return DDS::Subscriber::_duplicate( which->second); |
| 238 | } |
| 239 | |
| 240 | // See if there is a configuration profile for it. |
| 241 | Config::SubscriberProfileMap::const_iterator where |
| 242 | = this->config_.subscriberProfileMap().find( name); |
| 243 | if( where == this->config_.subscriberProfileMap().end()) { |
| 244 | ACE_ERROR((LM_ERROR, |
| 245 | ACE_TEXT("(%P|%t) ERROR: Entities::subscriber() - ") |
| 246 | ACE_TEXT("unable to find profile to configure ") |
| 247 | ACE_TEXT("subscriber: [%C].\n"), |
| 248 | name.c_str() |
| 249 | )); |
| 250 | return 0; |
| 251 | } |
| 252 | SubscriberProfile* profile = where->second; |
| 253 | |
| 254 | // Find the containing participant. |
| 255 | DDS::DomainParticipant_var participant |
| 256 | = this->participant( profile->participant, transportConfig); |
| 257 | if( !participant) { |
| 258 | ACE_ERROR((LM_ERROR, |
| 259 | ACE_TEXT("(%P|%t) ERROR: Entities::subscriber() - ") |
| 260 | ACE_TEXT("unable to find participant: [%C] for subscriber [%C].\n"), |
| 261 | profile->participant.c_str(), name.c_str() |
| 262 | )); |
| 263 | return 0; |
| 264 | } |
| 265 | |
| 266 | if( OpenDDS::DCPS::DCPS_debug_level>1) { |
| 267 | ACE_DEBUG((LM_DEBUG, |
| 268 | ACE_TEXT("(%P|%t) Entities::subscriber() - ") |
| 269 | ACE_TEXT("Creating subscriber [%C] in participant [%C].\n"), |
| 270 | name.c_str(), |
| 271 | profile->participant.c_str() |
| 272 | )); |
| 273 | } |
| 274 | this->subscriberByString_[ name] |
| 275 | = this->delegate_.createSubscriber( |
| 276 | participant, |
| 277 | profile->qos, |
| 278 | OpenDDS::DCPS::DEFAULT_STATUS_MASK, |
| 279 | transportConfig |
| 280 | ); |
| 281 | |
| 282 | return this->subscriberByString_[ name]; |
| 283 | } |
| 284 | |
| 285 | DDS::DataWriter_var |
| 286 | OpenDDS::Model::Entities::writer( |