| 527 | |
| 528 | template< class TypeSupport> |
| 529 | void |
| 530 | Monitor::MonitorTask::createSubscription( |
| 531 | DDS::Subscriber_ptr subscriber, |
| 532 | const char* topicName, |
| 533 | int type |
| 534 | ) |
| 535 | { |
| 536 | DDS::Topic_var topic; |
| 537 | DDS::TopicQos topicQos; |
| 538 | DDS::DataReaderQos readerQos; |
| 539 | DDS::DataReader_var reader; |
| 540 | DDS::StatusCondition_var status; |
| 541 | |
| 542 | TypeSupport* typeSupport = new TypeSupport(); |
| 543 | typeSupport->register_type( this->participant_.in(), 0); |
| 544 | topic = this->participant_->create_topic( |
| 545 | topicName, |
| 546 | CORBA::String_var(typeSupport->get_type_name()), |
| 547 | TOPIC_QOS_DEFAULT, |
| 548 | DDS::TopicListener::_nil(), |
| 549 | OpenDDS::DCPS::DEFAULT_STATUS_MASK |
| 550 | ); |
| 551 | |
| 552 | topic->get_qos( topicQos); |
| 553 | subscriber->get_default_datareader_qos( readerQos); |
| 554 | subscriber->copy_from_topic_qos( readerQos, topicQos); |
| 555 | readerQos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS; |
| 556 | reader = subscriber->create_datareader( |
| 557 | topic, |
| 558 | readerQos, |
| 559 | ::DDS::DataReaderListener::_nil(), |
| 560 | ::OpenDDS::DCPS::DEFAULT_STATUS_MASK |
| 561 | ); |
| 562 | if( CORBA::is_nil( reader.in())) { |
| 563 | ACE_ERROR((LM_ERROR, |
| 564 | ACE_TEXT("(%P|%t) ERROR: MonitorTask::createSubscription() - ") |
| 565 | ACE_TEXT("failed to create a reader for %s.\n"), |
| 566 | topicName |
| 567 | )); |
| 568 | return; |
| 569 | } |
| 570 | |
| 571 | // Track the type by handle and process any initial data. |
| 572 | this->handleTypeMap_[ reader->get_instance_handle()] = type; |
| 573 | |
| 574 | status = reader->get_statuscondition(); |
| 575 | status->set_enabled_statuses( DDS::DATA_AVAILABLE_STATUS); |
| 576 | this->waiter_->attach_condition( status.in()); |
| 577 | |
| 578 | if( this->options_.verbose()) { |
| 579 | ACE_DEBUG((LM_DEBUG, |
| 580 | ACE_TEXT("(%P|%t) MonitorTask::createSubscription() - ") |
| 581 | ACE_TEXT("topic %C installed and mapped instance %d to type %d.\n"), |
| 582 | topicName, |
| 583 | reader->get_instance_handle(), |
| 584 | type |
| 585 | )); |
| 586 | } |
nothing calls this directly
no test coverage detected