| 283 | } |
| 284 | |
| 285 | DDS::DataWriter_var |
| 286 | OpenDDS::Model::Entities::writer( |
| 287 | const OPENDDS_STRING& name, |
| 288 | const OPENDDS_STRING& transportConfig) |
| 289 | { |
| 290 | StringToDataWriterMap::const_iterator which |
| 291 | = this->writerByString_.find( name); |
| 292 | if( which != this->writerByString_.end()) { |
| 293 | return DDS::DataWriter::_duplicate( which->second); |
| 294 | } |
| 295 | |
| 296 | // See if there is a configuration profile for it. |
| 297 | Config::WriterProfileMap::const_iterator where |
| 298 | = this->config_.writerProfileMap().find( name); |
| 299 | if( where == this->config_.writerProfileMap().end()) { |
| 300 | ACE_ERROR((LM_ERROR, |
| 301 | ACE_TEXT("(%P|%t) ERROR: Entities::writer() - ") |
| 302 | ACE_TEXT("unable to find profile to configure ") |
| 303 | ACE_TEXT("writer: [%C].\n"), |
| 304 | name.c_str() |
| 305 | )); |
| 306 | return 0; |
| 307 | } |
| 308 | WriterProfile* profile = where->second; |
| 309 | |
| 310 | // Find the containing Publisher. |
| 311 | DDS::Publisher_var publisher = this->publisher(profile->publisher, |
| 312 | transportConfig); |
| 313 | if( !publisher) { |
| 314 | ACE_ERROR((LM_ERROR, |
| 315 | ACE_TEXT("(%P|%t) ERROR: Entities::writer() - ") |
| 316 | ACE_TEXT("unable to find publisher: [%C] for writer [%C].\n"), |
| 317 | profile->publisher.c_str(), name.c_str() |
| 318 | )); |
| 319 | return 0; |
| 320 | } |
| 321 | |
| 322 | // We need the *name* of the participant in order to look up the Topic. |
| 323 | // This should be Ok since we will only be configuring Writers that have |
| 324 | // been successfully defined in a configuration file, implying that there |
| 325 | // exists a defined [publisher] profile. |
| 326 | Config::PublisherProfileMap::const_iterator location |
| 327 | = this->config_.publisherProfileMap().find( profile->publisher); |
| 328 | if( location == this->config_.publisherProfileMap().end()) { |
| 329 | ACE_ERROR((LM_ERROR, |
| 330 | ACE_TEXT("(%P|%t) ERROR: Entities::writer() - ") |
| 331 | ACE_TEXT("unable to find profile to configure ") |
| 332 | ACE_TEXT("publisher: [%C] for writer [%C].\n"), |
| 333 | profile->publisher.c_str(), name.c_str() |
| 334 | )); |
| 335 | return 0; |
| 336 | } |
| 337 | PublisherProfile* publisherProfile = location->second; |
| 338 | |
| 339 | // Find the Topic. |
| 340 | DDS::Topic_var topic |
| 341 | = this->topic( profile->topic, |
| 342 | publisherProfile->participant, |