| 382 | } |
| 383 | |
| 384 | DDS::DataReader_var |
| 385 | OpenDDS::Model::Entities::reader( |
| 386 | const OPENDDS_STRING& name, |
| 387 | const OPENDDS_STRING& transportConfig) |
| 388 | { |
| 389 | StringToDataReaderMap::const_iterator which |
| 390 | = this->readerByString_.find( name); |
| 391 | if( which != this->readerByString_.end()) { |
| 392 | return DDS::DataReader::_duplicate( which->second); |
| 393 | } |
| 394 | |
| 395 | // See if there is a configuration profile for it. |
| 396 | Config::ReaderProfileMap::const_iterator where |
| 397 | = this->config_.readerProfileMap().find( name); |
| 398 | if( where == this->config_.readerProfileMap().end()) { |
| 399 | ACE_ERROR((LM_ERROR, |
| 400 | ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ") |
| 401 | ACE_TEXT("unable to find profile to configure ") |
| 402 | ACE_TEXT("reader: [%C].\n"), |
| 403 | name.c_str() |
| 404 | )); |
| 405 | return 0; |
| 406 | } |
| 407 | ReaderProfile* profile = where->second; |
| 408 | |
| 409 | // Find the containing Subscriber. |
| 410 | DDS::Subscriber_var subscriber = this->subscriber(profile->subscriber, |
| 411 | transportConfig); |
| 412 | if( !subscriber) { |
| 413 | ACE_ERROR((LM_ERROR, |
| 414 | ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ") |
| 415 | ACE_TEXT("unable to find subscriber: [%C] for reader [%C].\n"), |
| 416 | profile->subscriber.c_str(), name.c_str() |
| 417 | )); |
| 418 | return 0; |
| 419 | } |
| 420 | |
| 421 | // We need the *name* of the participant in order to look up the Topic. |
| 422 | // This should be Ok since we will only be configuring Readers that have |
| 423 | // been successfully defined in a configuration file, implying that there |
| 424 | // exists a defined [subscriber] profile. |
| 425 | Config::SubscriberProfileMap::const_iterator location |
| 426 | = this->config_.subscriberProfileMap().find( profile->subscriber); |
| 427 | if( location == this->config_.subscriberProfileMap().end()) { |
| 428 | ACE_ERROR((LM_ERROR, |
| 429 | ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ") |
| 430 | ACE_TEXT("unable to find profile to configure ") |
| 431 | ACE_TEXT("subscriber: [%C] for reader [%C].\n"), |
| 432 | profile->subscriber.c_str(), name.c_str() |
| 433 | )); |
| 434 | return 0; |
| 435 | } |
| 436 | SubscriberProfile* subscriberProfile = location->second; |
| 437 | |
| 438 | // Find the Topic. |
| 439 | DDS::Topic_var topic |
| 440 | = this->topic(profile->topic, |
| 441 | subscriberProfile->participant, |