diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2010-11-08 19:29:07 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2010-11-08 19:29:07 +0000 |
commit | 9b32c57e9bc36774d70eb9fd60c1495adef21dde (patch) | |
tree | c2a2d5d7441b86b9fe42c9cee55c4005bf8eaace /CIAO | |
parent | b50af7948a4a2a794f0c072721dd51f369bae708 (diff) | |
download | ATCD-9b32c57e9bc36774d70eb9fd60c1495adef21dde.tar.gz |
Mon Nov 8 19:25:53 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
Major refactoring of the dds4ccm library and the rti wrapping code
* connectors/dds4ccm/idl/ccm_dds.idl:
* connectors/dds4ccm/impl/CCM_DataReader.h:
* connectors/dds4ccm/impl/CCM_DataReader.cpp:
* connectors/dds4ccm/impl/CCM_DataWriter.h:
* connectors/dds4ccm/impl/CCM_DataWriter.cpp:
* connectors/dds4ccm/impl/ConditionManager_T.h:
* connectors/dds4ccm/impl/ConditionManager_T.cpp:
* connectors/dds4ccm/impl/ContentFilterSetting.h:
* connectors/dds4ccm/impl/ContentFilterSetting.cpp:
* connectors/dds4ccm/impl/DDS_Base_Connector_T.h:
* connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp:
* connectors/dds4ccm/impl/DDS_Subscriber_Base_T.h:
* connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp:
* connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h:
* connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp:
* connectors/dds4ccm/impl/DDS_Update_T.h:
* connectors/dds4ccm/impl/DDS_Update_T.cpp:
* connectors/dds4ccm/impl/DDS_Write_T.h:
* connectors/dds4ccm/impl/DDS_Write_T.cpp:
* connectors/dds4ccm/impl/DataReaderListener_T.h:
* connectors/dds4ccm/impl/DataReaderListener_T.cpp:
* connectors/dds4ccm/impl/DataReaderStateListener_T.h:
* connectors/dds4ccm/impl/DataReaderStateListener_T.cpp:
* connectors/dds4ccm/impl/Getter_T.h:
* connectors/dds4ccm/impl/Getter_T.cpp:
* connectors/dds4ccm/impl/InstanceHandleManager_T.h:
* connectors/dds4ccm/impl/InstanceHandleManager_T.cpp:
* connectors/dds4ccm/impl/Reader_T.h:
* connectors/dds4ccm/impl/Reader_T.cpp:
* connectors/dds4ccm/impl/TopicListener_T.cpp:
* connectors/dds4ccm/impl/ndds/ContentFilteredTopic.h:
* connectors/dds4ccm/impl/ndds/ContentFilteredTopic.cpp:
* connectors/dds4ccm/impl/ndds/DataReader.h:
* connectors/dds4ccm/impl/ndds/DataReader.cpp:
* connectors/dds4ccm/impl/ndds/DataReaderListener.h:
* connectors/dds4ccm/impl/ndds/DataReaderListener.cpp:
* connectors/dds4ccm/impl/ndds/DataReader_T.h:
* connectors/dds4ccm/impl/ndds/DataReader_T.cpp:
* connectors/dds4ccm/impl/ndds/DataWriter.h:
* connectors/dds4ccm/impl/ndds/DataWriter.cpp:
* connectors/dds4ccm/impl/ndds/DataWriterListener.h:
* connectors/dds4ccm/impl/ndds/DataWriterListener.cpp:
* connectors/dds4ccm/impl/ndds/DataWriter_T.h:
* connectors/dds4ccm/impl/ndds/DataWriter_T.cpp:
* connectors/dds4ccm/impl/ndds/DomainParticipant.h:
* connectors/dds4ccm/impl/ndds/DomainParticipant.cpp:
* connectors/dds4ccm/impl/ndds/DomainParticipantFactory.h:
* connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp:
* connectors/dds4ccm/impl/ndds/DomainParticipantListener.h:
* connectors/dds4ccm/impl/ndds/DomainParticipantListener.cpp:
* connectors/dds4ccm/impl/ndds/DomainParticipantManager.h:
* connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp:
* connectors/dds4ccm/impl/ndds/Publisher.h:
* connectors/dds4ccm/impl/ndds/Publisher.cpp:
* connectors/dds4ccm/impl/ndds/PublisherListener.h:
* connectors/dds4ccm/impl/ndds/PublisherListener.cpp:
* connectors/dds4ccm/impl/ndds/QueryCondition.h:
* connectors/dds4ccm/impl/ndds/QueryCondition.cpp:
* connectors/dds4ccm/impl/ndds/ReadCondition.h:
* connectors/dds4ccm/impl/ndds/ReadCondition.cpp:
* connectors/dds4ccm/impl/ndds/StatusCondition.h:
* connectors/dds4ccm/impl/ndds/StatusCondition.cpp:
* connectors/dds4ccm/impl/ndds/Subscriber.h:
* connectors/dds4ccm/impl/ndds/Subscriber.cpp:
* connectors/dds4ccm/impl/ndds/SubscriberListener.h:
* connectors/dds4ccm/impl/ndds/SubscriberListener.cpp:
* connectors/dds4ccm/impl/ndds/Topic.h:
* connectors/dds4ccm/impl/ndds/Topic.cpp:
* connectors/dds4ccm/impl/ndds/TopicDescription.h:
* connectors/dds4ccm/impl/ndds/TopicDescription.cpp:
* connectors/dds4ccm/impl/ndds/TopicListener.h:
* connectors/dds4ccm/impl/ndds/TopicListener.cpp:
* connectors/dds4ccm/impl/ndds/ndds.mpc:
* connectors/dds4ccm/impl/ndds/ContentFilteredTopic_T.h:
* connectors/dds4ccm/impl/ndds/ContentFilteredTopic_T.cpp:
* connectors/dds4ccm/impl/ndds/DDSDataReaderListener_T.h:
* connectors/dds4ccm/impl/ndds/DDSDataReaderListener_T.cpp:
* connectors/dds4ccm/impl/ndds/DDSDataWriterListener_T.h:
* connectors/dds4ccm/impl/ndds/DDSDataWriterListener_T.cpp:
* connectors/dds4ccm/impl/ndds/DDSDomainParticipantListener.h:
* connectors/dds4ccm/impl/ndds/DDSDomainParticipantListener.cpp:
* connectors/dds4ccm/impl/ndds/DDSPublisherListener_T.h:
* connectors/dds4ccm/impl/ndds/DDSPublisherListener_T.cpp:
* connectors/dds4ccm/impl/ndds/DDSSubscriberListener_T.h:
* connectors/dds4ccm/impl/ndds/DDSSubscriberListener_T.cpp:
* connectors/dds4ccm/impl/ndds/DDSTopicListener_T.h:
* connectors/dds4ccm/impl/ndds/DDSTopicListener_T.cpp:
* connectors/dds4ccm/impl/ndds/DomainParticipantFactory_T.h:
* connectors/dds4ccm/impl/ndds/DomainParticipantFactory_T.cpp:
* connectors/dds4ccm/impl/ndds/DomainParticipant_T.h:
* connectors/dds4ccm/impl/ndds/DomainParticipant_T.cpp:
* connectors/dds4ccm/impl/ndds/Publisher_T.h:
* connectors/dds4ccm/impl/ndds/Publisher_T.cpp:
* connectors/dds4ccm/impl/ndds/QueryCondition_T.h:
* connectors/dds4ccm/impl/ndds/QueryCondition_T.cpp:
* connectors/dds4ccm/impl/ndds/ReadCondition_T.h:
* connectors/dds4ccm/impl/ndds/ReadCondition_T.cpp:
* connectors/dds4ccm/impl/ndds/Subscriber_T.h:
* connectors/dds4ccm/impl/ndds/Subscriber_T.cpp:
* connectors/dds4ccm/impl/ndds/TopicDescription_T.h:
* connectors/dds4ccm/impl/ndds/TopicDescription_T.cpp:
* connectors/dds4ccm/impl/ndds/Topic_T.h:
* connectors/dds4ccm/impl/ndds/Topic_T.cpp:
Diffstat (limited to 'CIAO')
85 files changed, 3313 insertions, 3389 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index a38f5e8fa53..1c23ee3b108 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,114 @@ +Mon Nov 8 19:25:53 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + + Major refactoring of the dds4ccm library and the rti wrapping code + + * connectors/dds4ccm/idl/ccm_dds.idl: + + * connectors/dds4ccm/impl/CCM_DataReader.h: + * connectors/dds4ccm/impl/CCM_DataReader.cpp: + * connectors/dds4ccm/impl/CCM_DataWriter.h: + * connectors/dds4ccm/impl/CCM_DataWriter.cpp: + * connectors/dds4ccm/impl/ConditionManager_T.h: + * connectors/dds4ccm/impl/ConditionManager_T.cpp: + * connectors/dds4ccm/impl/ContentFilterSetting.h: + * connectors/dds4ccm/impl/ContentFilterSetting.cpp: + * connectors/dds4ccm/impl/DDS_Base_Connector_T.h: + * connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_Subscriber_Base_T.h: + * connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_Update_T.h: + * connectors/dds4ccm/impl/DDS_Update_T.cpp: + * connectors/dds4ccm/impl/DDS_Write_T.h: + * connectors/dds4ccm/impl/DDS_Write_T.cpp: + * connectors/dds4ccm/impl/DataReaderListener_T.h: + * connectors/dds4ccm/impl/DataReaderListener_T.cpp: + * connectors/dds4ccm/impl/DataReaderStateListener_T.h: + * connectors/dds4ccm/impl/DataReaderStateListener_T.cpp: + * connectors/dds4ccm/impl/Getter_T.h: + * connectors/dds4ccm/impl/Getter_T.cpp: + * connectors/dds4ccm/impl/InstanceHandleManager_T.h: + * connectors/dds4ccm/impl/InstanceHandleManager_T.cpp: + * connectors/dds4ccm/impl/Reader_T.h: + * connectors/dds4ccm/impl/Reader_T.cpp: + * connectors/dds4ccm/impl/TopicListener_T.cpp: + + * connectors/dds4ccm/impl/ndds/ContentFilteredTopic.h: + * connectors/dds4ccm/impl/ndds/ContentFilteredTopic.cpp: + * connectors/dds4ccm/impl/ndds/DataReader.h: + * connectors/dds4ccm/impl/ndds/DataReader.cpp: + * connectors/dds4ccm/impl/ndds/DataReaderListener.h: + * connectors/dds4ccm/impl/ndds/DataReaderListener.cpp: + * connectors/dds4ccm/impl/ndds/DataReader_T.h: + * connectors/dds4ccm/impl/ndds/DataReader_T.cpp: + * connectors/dds4ccm/impl/ndds/DataWriter.h: + * connectors/dds4ccm/impl/ndds/DataWriter.cpp: + * connectors/dds4ccm/impl/ndds/DataWriterListener.h: + * connectors/dds4ccm/impl/ndds/DataWriterListener.cpp: + * connectors/dds4ccm/impl/ndds/DataWriter_T.h: + * connectors/dds4ccm/impl/ndds/DataWriter_T.cpp: + * connectors/dds4ccm/impl/ndds/DomainParticipant.h: + * connectors/dds4ccm/impl/ndds/DomainParticipant.cpp: + * connectors/dds4ccm/impl/ndds/DomainParticipantFactory.h: + * connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp: + * connectors/dds4ccm/impl/ndds/DomainParticipantListener.h: + * connectors/dds4ccm/impl/ndds/DomainParticipantListener.cpp: + * connectors/dds4ccm/impl/ndds/DomainParticipantManager.h: + * connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp: + * connectors/dds4ccm/impl/ndds/Publisher.h: + * connectors/dds4ccm/impl/ndds/Publisher.cpp: + * connectors/dds4ccm/impl/ndds/PublisherListener.h: + * connectors/dds4ccm/impl/ndds/PublisherListener.cpp: + * connectors/dds4ccm/impl/ndds/QueryCondition.h: + * connectors/dds4ccm/impl/ndds/QueryCondition.cpp: + * connectors/dds4ccm/impl/ndds/ReadCondition.h: + * connectors/dds4ccm/impl/ndds/ReadCondition.cpp: + * connectors/dds4ccm/impl/ndds/StatusCondition.h: + * connectors/dds4ccm/impl/ndds/StatusCondition.cpp: + * connectors/dds4ccm/impl/ndds/Subscriber.h: + * connectors/dds4ccm/impl/ndds/Subscriber.cpp: + * connectors/dds4ccm/impl/ndds/SubscriberListener.h: + * connectors/dds4ccm/impl/ndds/SubscriberListener.cpp: + * connectors/dds4ccm/impl/ndds/Topic.h: + * connectors/dds4ccm/impl/ndds/Topic.cpp: + * connectors/dds4ccm/impl/ndds/TopicDescription.h: + * connectors/dds4ccm/impl/ndds/TopicDescription.cpp: + * connectors/dds4ccm/impl/ndds/TopicListener.h: + * connectors/dds4ccm/impl/ndds/TopicListener.cpp: + * connectors/dds4ccm/impl/ndds/ndds.mpc: + + * connectors/dds4ccm/impl/ndds/ContentFilteredTopic_T.h: + * connectors/dds4ccm/impl/ndds/ContentFilteredTopic_T.cpp: + * connectors/dds4ccm/impl/ndds/DDSDataReaderListener_T.h: + * connectors/dds4ccm/impl/ndds/DDSDataReaderListener_T.cpp: + * connectors/dds4ccm/impl/ndds/DDSDataWriterListener_T.h: + * connectors/dds4ccm/impl/ndds/DDSDataWriterListener_T.cpp: + * connectors/dds4ccm/impl/ndds/DDSDomainParticipantListener.h: + * connectors/dds4ccm/impl/ndds/DDSDomainParticipantListener.cpp: + * connectors/dds4ccm/impl/ndds/DDSPublisherListener_T.h: + * connectors/dds4ccm/impl/ndds/DDSPublisherListener_T.cpp: + * connectors/dds4ccm/impl/ndds/DDSSubscriberListener_T.h: + * connectors/dds4ccm/impl/ndds/DDSSubscriberListener_T.cpp: + * connectors/dds4ccm/impl/ndds/DDSTopicListener_T.h: + * connectors/dds4ccm/impl/ndds/DDSTopicListener_T.cpp: + * connectors/dds4ccm/impl/ndds/DomainParticipantFactory_T.h: + * connectors/dds4ccm/impl/ndds/DomainParticipantFactory_T.cpp: + * connectors/dds4ccm/impl/ndds/DomainParticipant_T.h: + * connectors/dds4ccm/impl/ndds/DomainParticipant_T.cpp: + * connectors/dds4ccm/impl/ndds/Publisher_T.h: + * connectors/dds4ccm/impl/ndds/Publisher_T.cpp: + * connectors/dds4ccm/impl/ndds/QueryCondition_T.h: + * connectors/dds4ccm/impl/ndds/QueryCondition_T.cpp: + * connectors/dds4ccm/impl/ndds/ReadCondition_T.h: + * connectors/dds4ccm/impl/ndds/ReadCondition_T.cpp: + * connectors/dds4ccm/impl/ndds/Subscriber_T.h: + * connectors/dds4ccm/impl/ndds/Subscriber_T.cpp: + * connectors/dds4ccm/impl/ndds/TopicDescription_T.h: + * connectors/dds4ccm/impl/ndds/TopicDescription_T.cpp: + * connectors/dds4ccm/impl/ndds/Topic_T.h: + * connectors/dds4ccm/impl/ndds/Topic_T.cpp: + Mon Nov 8 16:11:06 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl> * connectors/dds4ccm/tests/MultiTopic/Sender/MultiTopic_Sender_exec.cpp: diff --git a/CIAO/connectors/dds4ccm/examples/Hello/descriptors/USER_QOS_PROFILES.xml b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/USER_QOS_PROFILES.xml index 43d7538106a..4048473bf72 100644 --- a/CIAO/connectors/dds4ccm/examples/Hello/descriptors/USER_QOS_PROFILES.xml +++ b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/USER_QOS_PROFILES.xml @@ -26,6 +26,199 @@ RTI Data Distribution Service user manual. A QoS profile groups a set of related QoS. --> <qos_profile name="Hello_Profile" is_default_qos="true"> + <participant_qos> + <participant_name> + <name>RTI Hello World Example</name> + </participant_name> + + <!-- increase total property string max length --> + <resource_limits> + <participant_property_string_max_length> + 2048 + </participant_property_string_max_length> + </resource_limits> + + <property> + <value> + + <!-- ================= --> + <!-- enable monitoring --> + <!-- ================= --> + + <element> + <name>rti.monitor.library</name> + <!-- must match the library type for the DDS + application --> + <!-- + <value>rtimonitoring</value> + <value>rtimonitoringd</value> + --> + <value>rtimonitoring</value> + <propagate>false</propagate> + </element> + + <element> + <name>rti.monitor.create_function</name> + <value>RTIDefaultMonitor_create</value> + <propagate>false</propagate> + </element> + + <!-- ========================= --> + <!-- monitoring configurations --> + <!-- ========================= --> + + <!-- how often to sample and publish monitoirng + topics in seconds, default 5 --> + <!-- + <element> + <name>rti.monitor.config.publish_period</name> + <value>5</value> + <propagate>false</propagate> + </element> + --> + + <!-- monitoring topics that are sent out, + default * (no filter) --> + <!-- + <element> + <name>rti.monitor.config.topics</name> + <value>*</value> + <propagate>false</propagate> + </element> + --> + + <!-- user topic filter, default * (no filter) --> + <!-- + <element> + <name>rti.monitor.config.usertopics</name> + <value>*</value> + <propagate>false</propagate> + </element> + --> + + <!-- Uncomment this if you want statistics to be + published by a new separate particpant, + with the specified domain ID. Default: + not specified (use user participant for + publishing monitoring data) --> + <!-- + <element> + <name>rti.monitor.config.new_participant_domain_id</name> + <value>10</value> + <propagate>false</propagate> + </element> + --> + + <!-- Uncomment this if you want to use specific + QoS profile for entities created by + monitoring. Default: not specified + (use internal QoS values) --> + <!-- + <element> + <name>rti.monitor.config.qos_library</name> + <value>RTIMonitoringQosLibrary</value> + <propagate>false</propagate> + </element> + <element> + <name>rti.monitor.config.qos_profile</name> + <value>RTIMonitoringPublishingQosProfile</value> + <propagate>false</propagate> + </element> + --> + + <!-- Uncomment this if you want to control the + property of the thread that sample and publish + monitoring data --> + <!-- default -2 for windows, -999999 for linux --> + <!-- + <element> + <name>rti.monitor.config.publish_thread_priority</name> + <value>-2</value> + <propagate>false</propagate> + </element> + --> + <!-- default 0 for windows, -1 for linux --> + <!-- + <element> + <name>rti.monitor.config.publish_thread_stacksize</name> + <value>0</value> + <propagate>false</propagate> + </element> + --> + <!-- default FLOATING_POINT | STDIO --> + <!-- + <element> + <name>rti.monitor.config.publish_thread_options</name> + <value></value> + <propagate>false</propagate> + </element> + --> + + <!-- do we want to montior memory and CPU usage, + default true --> + <!-- + <element> + <name>rti.monitor.config.get_process_statistics</name> + <value>true</value> + <propagate>false</propagate> + </element> + --> + + <!-- Do we want to skip monitoring internal entitities + and not include them in entity counts, + default true --> + <!-- + <element> + <name>rti.monitor.config.skip_monitor_entities</name> + <value>true</value> + <propagate>false</propagate> + </element> + --> + + <!-- do you want monitoring library to reset + status change count after access, default false --> + <!-- + <element> + <name>rti.monitor.config.reset_status_change_counts</name> + <value>false</value> + <propagate>false</propagate> + </element> + --> + + <!-- monitoring library verbosity for internal + debugging purpose, default 1 --> + <!-- + <element> + <name>rti.monitor.config.verbosity</name> + <value>1</value> + <propagate>false</propagate> + </element> + --> + + <!-- maximum size of the preallocated buffer. + If sample serialized size is + larger than this value (unless the value is -1), + dynamic memory allocation will be used. + Default -1 (preallocated buffer is set + according to max size serialized of the data + type, no dynamic memory allocation) --> + <!-- + <element> + <name>rti.monitor.config.writer_pool_buffer_max_size</name> + <value>-1</value> + <propagate>false</propagate> + </element> + --> + + </value> + </property> + + <!-- monitoring types can have large data --> + <receiver_pool> + <buffer_size>65530</buffer_size> + </receiver_pool> + + </participant_qos> <!-- QoS used to configure the data writer created in the example code --> <datawriter_qos> <reliability> diff --git a/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test.pl index c72b3a0d9ab..2b5396ba915 100755 --- a/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test.pl +++ b/CIAO/connectors/dds4ccm/examples/Hello/descriptors/run_test.pl @@ -11,6 +11,7 @@ use PerlACE::TestTarget; $CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; $TAO_ROOT = "$ENV{'TAO_ROOT'}"; $DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; +$DDS4CCM_TRACE_ENABLE = "$ENV{'DDS4CCM_TRACE_ENABLE'}"; $daemons_running = 0; $em_running = 0; diff --git a/CIAO/connectors/dds4ccm/idl/ccm_dds.idl b/CIAO/connectors/dds4ccm/idl/ccm_dds.idl index 0c97fa9a6e8..3abe1937134 100644 --- a/CIAO/connectors/dds4ccm/idl/ccm_dds.idl +++ b/CIAO/connectors/dds4ccm/idl/ccm_dds.idl @@ -16,6 +16,9 @@ module CCM_DDS { module Typed <typename T, sequence<T> TSeq> { + + alias ::DDS::Typed<T, TSeq> DDS_Typed; + // Gathers all the constructs that are dependent on the data type (T), // either directly -- interfaces making use of T or TSeq, // or indirectly -- porttypes using or providing those intefaces. @@ -204,7 +207,7 @@ module CCM_DDS porttype DDS_Write { uses Writer data; - uses DDS::DataWriter dds_entity; + uses DDS::DataWriter dds_entity; }; porttype DDS_Update { diff --git a/CIAO/connectors/dds4ccm/impl/CCM_DataReader.cpp b/CIAO/connectors/dds4ccm/impl/CCM_DataReader.cpp index f21e1809820..cccea9daca9 100644 --- a/CIAO/connectors/dds4ccm/impl/CCM_DataReader.cpp +++ b/CIAO/connectors/dds4ccm/impl/CCM_DataReader.cpp @@ -216,6 +216,9 @@ CIAO::DDS4CCM::CCM_DataReader::impl (void) if (::CORBA::is_nil (this->impl_.in ())) { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "CIAO::DDS4CCM::CCM_DataReader::impl - " + "Throwing BAD_INV_ORDER.\n")); throw ::CORBA::BAD_INV_ORDER (); } else diff --git a/CIAO/connectors/dds4ccm/impl/CCM_DataReader.h b/CIAO/connectors/dds4ccm/impl/CCM_DataReader.h index 741c3f0c777..70348e39d0d 100644 --- a/CIAO/connectors/dds4ccm/impl/CCM_DataReader.h +++ b/CIAO/connectors/dds4ccm/impl/CCM_DataReader.h @@ -10,8 +10,7 @@ #define CCM_DATAREADER_T_H_ #include "dds4ccm/idl/dds_rtf2_dcpsEC.h" - -#include "dds4ccm/impl/ndds/ContentFilteredTopic_T.h" +#include "dds4ccm/impl/dds4ccm_dds_impl_export.h" namespace CIAO { diff --git a/CIAO/connectors/dds4ccm/impl/CCM_DataWriter.cpp b/CIAO/connectors/dds4ccm/impl/CCM_DataWriter.cpp index ecdcb0d6f99..d80efaf7e8a 100644 --- a/CIAO/connectors/dds4ccm/impl/CCM_DataWriter.cpp +++ b/CIAO/connectors/dds4ccm/impl/CCM_DataWriter.cpp @@ -147,6 +147,9 @@ CIAO::DDS4CCM::CCM_DataWriter::impl (void) if (::CORBA::is_nil (this->impl_.in ())) { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "CIAO::DDS4CCM::CCM_DataWriter::impl - " + "Throwing BAD_INV_ORDER.\n")); throw ::CORBA::BAD_INV_ORDER (); } else diff --git a/CIAO/connectors/dds4ccm/impl/CCM_DataWriter.h b/CIAO/connectors/dds4ccm/impl/CCM_DataWriter.h index e0f8e730505..30bdb4df7f9 100644 --- a/CIAO/connectors/dds4ccm/impl/CCM_DataWriter.h +++ b/CIAO/connectors/dds4ccm/impl/CCM_DataWriter.h @@ -10,8 +10,7 @@ #define CCM_DATAWRITER_T_H_ #include "dds4ccm/idl/dds_rtf2_dcpsEC.h" - -#include "dds4ccm/impl/ndds/ContentFilteredTopic_T.h" +#include "dds4ccm/impl/dds4ccm_dds_impl_export.h" namespace CIAO { diff --git a/CIAO/connectors/dds4ccm/impl/ConditionManager_T.cpp b/CIAO/connectors/dds4ccm/impl/ConditionManager_T.cpp index 1c1a91ac10f..2182e88c611 100644 --- a/CIAO/connectors/dds4ccm/impl/ConditionManager_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ConditionManager_T.cpp @@ -1,8 +1,8 @@ // $Id$ #include "dds4ccm/impl/ndds/DataReader_T.h" -#include "dds4ccm/impl/ndds/ReadCondition_T.h" -#include "dds4ccm/impl/ndds/QueryCondition_T.h" +#include "dds4ccm/impl/ndds/ReadCondition.h" +#include "dds4ccm/impl/ndds/QueryCondition.h" #include "ace/OS_NS_sys_time.h" @@ -24,14 +24,14 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::~ConditionManager_T () } template <typename DDS_TYPE> -typename CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::ReadCondition_type * +::CIAO::NDDS::DDS_ReadCondition_i * CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_readcondition (void) { DDS4CCM_TRACE ("CIAO::DDS4CCM::ConditionManager_T::get_readcondition"); if (! ::CORBA::is_nil (this->rd_condition_.in ())) { - ReadCondition_type * rc = dynamic_cast <ReadCondition_type *> + ::CIAO::NDDS::DDS_ReadCondition_i * rc = dynamic_cast < ::CIAO::NDDS::DDS_ReadCondition_i *> (this->rd_condition_.in ()); if (!rc) { @@ -47,13 +47,13 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_readcondition (void) } template <typename DDS_TYPE> -typename CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::QueryCondition_type * +::CIAO::NDDS::DDS_QueryCondition_i * CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_querycondition ( ::DDS::QueryCondition_ptr dds_qc) { DDS4CCM_TRACE ("CIAO::DDS4CCM::ConditionManager_T::get_querycondition"); - QueryCondition_type * qc = dynamic_cast <QueryCondition_type *> (dds_qc); + ::CIAO::NDDS::DDS_QueryCondition_i * qc = dynamic_cast < ::CIAO::NDDS::DDS_QueryCondition_i *> (dds_qc); if (!qc) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO @@ -67,7 +67,7 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_querycondition ( template <typename DDS_TYPE> -typename CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::QueryCondition_type * +::CIAO::NDDS::DDS_QueryCondition_i * CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_querycondition_getter (void) { DDS4CCM_TRACE ("CIAO::DDS4CCM::ConditionManager_T::get_querycondition_getter"); @@ -80,7 +80,7 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_querycondition_getter (void) } template <typename DDS_TYPE> -typename CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::QueryCondition_type * +::CIAO::NDDS::DDS_QueryCondition_i * CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_querycondition_listener (void) { DDS4CCM_TRACE ("CIAO::DDS4CCM::ConditionManager_T::get_querycondition_listener"); @@ -93,7 +93,7 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_querycondition_listener (void) } template <typename DDS_TYPE> -typename CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::QueryCondition_type * +::CIAO::NDDS::DDS_QueryCondition_i * CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_querycondition_reader (void) { DDS4CCM_TRACE ("CIAO::DDS4CCM::ConditionManager_T::get_querycondition_reader"); @@ -136,10 +136,10 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::init_readcondition (void) } ::DDS::ReturnCode_t retcode = ::DDS::RETCODE_ERROR; - ReadCondition_type * rc = this->get_readcondition (); + ::CIAO::NDDS::DDS_ReadCondition_i * rc = this->get_readcondition (); if (rc) { - retcode = this->ws_->attach_condition (rc->get_impl ()); + retcode = this->ws_->attach_condition (rc->get_rti_entity ()); } if (retcode != ::DDS::RETCODE_OK) @@ -294,11 +294,11 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::attach_querycondition (void) ::CORBA::NO_MEMORY ()); } - QueryCondition_type * qc = this->get_querycondition_getter (); + ::CIAO::NDDS::DDS_QueryCondition_i * qc = this->get_querycondition_getter (); ::DDS::ReturnCode_t retcode = ::DDS::RETCODE_ERROR; if (qc) { - retcode = this->ws_->attach_condition (qc->get_impl ()); + retcode = this->ws_->attach_condition (qc->get_rti_entity ()); } if (retcode != ::DDS::RETCODE_OK) { @@ -357,13 +357,13 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::remove_condition ( DDS4CCM_TRACE ("CIAO::DDS4CCM::ConditionManager_T::remove_condition"); if (! ::CORBA::is_nil (dds_qc)) { - QueryCondition_type * qc = dynamic_cast <QueryCondition_type *>(dds_qc); + ::CIAO::NDDS::DDS_QueryCondition_i * qc = dynamic_cast < ::CIAO::NDDS::DDS_QueryCondition_i *>(dds_qc); if (qc) { ::DDS::ReturnCode_t retcode = this->impl ()->delete_readcondition (qc); if (retcode == ::DDS::RETCODE_OK) { - qc->set_impl (0); + qc->set_rti_entity (0); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_SUCCESSFUL, (LM_DEBUG, DDS4CCM_INFO ACE_TEXT ("ConditionManager_T::remove_condition - ") ACE_TEXT ("Succesfully removed query condition for <%C>.\n"), @@ -404,9 +404,9 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::remove_conditions () { if (! ::CORBA::is_nil (this->qc_getter_.in ())) { - QueryCondition_type * q_condition = this->get_querycondition_getter (); + ::CIAO::NDDS::DDS_QueryCondition_i * q_condition = this->get_querycondition_getter (); if (q_condition && - this->ws_->detach_condition (q_condition->get_impl ()) == ::DDS::RETCODE_OK) + this->ws_->detach_condition (q_condition->get_rti_entity ()) == ::DDS::RETCODE_OK) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO ACE_TEXT ("ConditionManager_T::remove_conditions - ") @@ -423,14 +423,14 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::remove_conditions () } else { - QueryCondition_type * r_condition = this->get_querycondition_getter (); + ::CIAO::NDDS::DDS_QueryCondition_i * r_condition = this->get_querycondition_getter (); if (!r_condition) { retcode = ::DDS::RETCODE_ERROR; } else { - retcode = this->ws_->detach_condition (r_condition->get_impl ()); + retcode = this->ws_->detach_condition (r_condition->get_rti_entity ()); } if (retcode != ::DDS::RETCODE_OK) { @@ -465,11 +465,11 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::remove_conditions () ACE_TEXT ("ConditionManager_T::remove_conditions - ") ACE_TEXT ("Read condition successfully deleted from DDSDataReader.\n"))); } - ReadCondition_type * rc = - dynamic_cast <ReadCondition_type *>(this->rd_condition_.in ()); + ::CIAO::NDDS::DDS_ReadCondition_i * rc = + dynamic_cast < ::CIAO::NDDS::DDS_ReadCondition_i *>(this->rd_condition_.in ()); if (rc) { - rc->set_impl (0); + rc->set_rti_entity (0); } this->rd_condition_ = ::DDS::CCM_ReadCondition::_nil (); } @@ -495,14 +495,14 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::set_impl ( } template <typename DDS_TYPE> -CIAO::DDS4CCM::DataReader_T<DDS_TYPE> * +CIAO::NDDS::DataReader_T<DDS_TYPE> * CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::get_impl () { return this->impl_; } template <typename DDS_TYPE> -CIAO::DDS4CCM::DataReader_T<DDS_TYPE> * +CIAO::NDDS::DataReader_T<DDS_TYPE> * CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::impl (void) { if (this->impl_) @@ -511,6 +511,9 @@ CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE>::impl (void) } else { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "CIAO::NDDS::DataReader_T<DDS_TYPE>::impl - " + "Throwing BAD_INV_ORDER.\n")); throw ::CORBA::BAD_INV_ORDER (); } } diff --git a/CIAO/connectors/dds4ccm/impl/ConditionManager_T.h b/CIAO/connectors/dds4ccm/impl/ConditionManager_T.h index a7c88de8633..836aab6945a 100644 --- a/CIAO/connectors/dds4ccm/impl/ConditionManager_T.h +++ b/CIAO/connectors/dds4ccm/impl/ConditionManager_T.h @@ -1,39 +1,35 @@ // $Id$ + #ifndef CONDITIONMANAGER_T_H_ #define CONDITIONMANAGER_T_H_ namespace CIAO { - namespace DDS4CCM + namespace NDDS { template <typename DDS_TYPE> - class DDS_ReadCondition_T; - - template <typename DDS_TYPE> - class DDS_QueryCondition_T; - - template <typename DDS_TYPE> class DataReader_T; + } + namespace DDS4CCM + { //============================================================ // ConditionManager_T //============================================================ template <typename DDS_TYPE> class ConditionManager_T { - typedef DDS_ReadCondition_T<DDS_TYPE> ReadCondition_type; - typedef DDS_QueryCondition_T<DDS_TYPE> QueryCondition_type; - typedef DataReader_T<DDS_TYPE> DataReader_type; + typedef ::CIAO::NDDS::DataReader_T<DDS_TYPE> DataReader_type; public: ConditionManager_T (void); ~ConditionManager_T (void); - ReadCondition_type * get_readcondition (void); + ::CIAO::NDDS::DDS_ReadCondition_i * get_readcondition (void); - QueryCondition_type * get_querycondition_getter (void); - QueryCondition_type * get_querycondition_reader (void); - QueryCondition_type * get_querycondition_listener (void); + ::CIAO::NDDS::DDS_QueryCondition_i * get_querycondition_getter (void); + ::CIAO::NDDS::DDS_QueryCondition_i * get_querycondition_reader (void); + ::CIAO::NDDS::DDS_QueryCondition_i * get_querycondition_listener (void); void init_readcondition (void); @@ -65,7 +61,7 @@ namespace CIAO DataReader_type * impl (void); - QueryCondition_type * get_querycondition ( + ::CIAO::NDDS::DDS_QueryCondition_i * get_querycondition ( ::DDS::QueryCondition_ptr dds_qc); void remove_condition (::DDS::QueryCondition_ptr qc, diff --git a/CIAO/connectors/dds4ccm/impl/ContentFilterSetting.cpp b/CIAO/connectors/dds4ccm/impl/ContentFilterSetting.cpp index 5a90f9277eb..4ed58dc8a44 100644 --- a/CIAO/connectors/dds4ccm/impl/ContentFilterSetting.cpp +++ b/CIAO/connectors/dds4ccm/impl/ContentFilterSetting.cpp @@ -1,6 +1,6 @@ // $Id$ -#include "ContentFilterSetting.h" +#include "dds4ccm/impl/ContentFilterSetting.h" #include "dds4ccm/impl/logger/Log_Macros.h" #include "dds4ccm/impl/Utils.h" @@ -124,7 +124,7 @@ namespace CIAO } ::DDS::ReturnCode_t retcode = this->cft_->set_expression_parameters (parameters); - if (retcode == DDS_RETCODE_OK) + if (retcode == ::DDS::RETCODE_OK) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO "CCM_DDS_ContentFilterSetting_i::set_filter_parameters: " diff --git a/CIAO/connectors/dds4ccm/impl/ContentFilterSetting.h b/CIAO/connectors/dds4ccm/impl/ContentFilterSetting.h index 9d5a8350a7a..ffe7326b656 100644 --- a/CIAO/connectors/dds4ccm/impl/ContentFilterSetting.h +++ b/CIAO/connectors/dds4ccm/impl/ContentFilterSetting.h @@ -11,8 +11,7 @@ #include "dds4ccm/idl/dds4ccm_BaseC.h" #include "dds4ccm/idl/dds4ccm_BaseEC.h" -#include "dds4ccm/impl/ndds/ContentFilteredTopic_T.h" - +#include "dds4ccm/impl/dds4ccm_dds_impl_export.h" #include "tao/LocalObject.h" namespace CIAO diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp index 3b571032348..8f1e44f90de 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // $Id$ -#include "dds4ccm/impl/ndds/DomainParticipant_T.h" +#include "dds4ccm/impl/ndds/DomainParticipant.h" #include "ace/Tokenizer_T.h" #include "ace/Env_Value_T.h" diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.h b/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.h index 61c88434077..95f59a5674b 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.h @@ -9,7 +9,7 @@ #include "dds4ccm/idl/dds_rtf2_dcpsC.h" #include "ace/Copy_Disabled.h" #include "dds4ccm/impl/DomainParticipantListener_T.h" -#include "dds4ccm/impl/ndds/DomainParticipantFactory_T.h" +#include "dds4ccm/impl/ndds/DomainParticipantFactory.h" #include "dds4ccm/impl/logger/Logger_Service.h" template <typename DDS_TYPE, typename CCM_TYPE, DDS4CCM_Vendor VENDOR_TYPE> @@ -20,7 +20,7 @@ class DDS_Base_Connector_T { typedef ::CIAO::DDS4CCM::DomainParticipantListener_T<DDS_TYPE, VENDOR_TYPE> DomainParticipantListener; -typedef ::CIAO::DDS4CCM::DDS_DomainParticipantFactory_T<DDS_TYPE> +typedef ::CIAO::NDDS::DDS_DomainParticipantFactory_i DomainParticipantFactory; public: diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp index c2e88f9c18d..ba620324d46 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.cpp @@ -34,7 +34,7 @@ DDS_Subscriber_Base_T<DDS_TYPE, CCM_TYPE, FIXED, VENDOR_TYPE>::configuration_com this->configuration_complete_ = true; - if (!this->data_reader_->get_impl ()) + if (!this->data_reader_->get_rti_entity ()) { ::CCM_DDS::QueryFilter_var filter = this->cft_setting_->filter (); if (ACE_OS::strlen (filter->expression.in ()) > 0) @@ -60,7 +60,7 @@ DDS_Subscriber_Base_T<DDS_TYPE, CCM_TYPE, FIXED, VENDOR_TYPE>::configuration_com library_name, profile_name); } - if (!this->data_reader_->get_impl ()) + if (!this->data_reader_->get_rti_entity ()) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO "CCM_DDS_Subscriber_Base_T::create_datareader - " diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.h b/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.h index 2a2b7cd05c6..ef05eedffc2 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_Subscriber_Base_T.h @@ -14,7 +14,7 @@ #include "dds4ccm/impl/ndds/DataReader_T.h" #include "dds4ccm/impl/PortStatusListener_T.h" #include "dds4ccm/impl/ContentFilterSetting.h" -#include "dds4ccm/impl/ndds/ContentFilteredTopic_T.h" +#include "dds4ccm/impl/ndds/ContentFilteredTopic.h" #include "dds4ccm/impl/ConditionManager_T.h" #include "dds4ccm/impl/CCM_DataReader.h" @@ -65,7 +65,7 @@ protected: PortStatusListener_type; typedef ::CIAO::DDS4CCM::DDS_CCM::Reader_T<DDS_TYPE, CCM_TYPE, FIXED, VENDOR_TYPE> Reader_type; - typedef ::CIAO::DDS4CCM::DataReader_T<DDS_TYPE> + typedef ::CIAO::NDDS::DataReader_T<DDS_TYPE> DataReader_type; typedef ::CIAO::DDS4CCM::CCM_DDS_ContentFilterSetting_i ContentFilterSetting_type; diff --git a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp index 2baf026fbeb..7f0851a0b63 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp @@ -183,8 +183,8 @@ DDS_TopicBase_Connector_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::init_default_topic ( if (::CORBA::is_nil (this->topic_.in ())) { - ::CIAO::DDS4CCM::DDS_DomainParticipant_T<DDS_TYPE> *part = - dynamic_cast< CIAO::DDS4CCM::DDS_DomainParticipant_T<DDS_TYPE> * > ( + ::CIAO::NDDS::DDS_DomainParticipant_i *part = + dynamic_cast< CIAO::NDDS::DDS_DomainParticipant_i * > ( this->domain_participant_.in ()); if (!part) { @@ -201,7 +201,7 @@ DDS_TopicBase_Connector_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::init_default_topic ( DDS_TYPE::type_support::get_type_name (), factory); DDS_ReturnCode_t const retcode = DDS_TYPE::type_support::register_type( - part->get_impl (), DDS_TYPE::type_support::get_type_name ()); + part->get_rti_entity (), DDS_TYPE::type_support::get_type_name ()); if (retcode == DDS_RETCODE_OK) { diff --git a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h index 65f6645287f..4235a77cc4a 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h @@ -10,9 +10,8 @@ #include "ace/Copy_Disabled.h" -#include "dds4ccm/impl/ndds/DomainParticipant_T.h" -#include "dds4ccm/impl/ndds/DDSTopicListener_T.h" - +#include "dds4ccm/impl/ndds/DomainParticipant.h" +#include "dds4ccm/impl/TopicListener_T.h" #include "dds4ccm/impl/DDS_Base_Connector_T.h" #include "dds4ccm/impl/PublisherListener_T.h" #include "dds4ccm/impl/SubscriberListener_T.h" diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Update_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Update_T.cpp index 2172e5d978d..740c5e50e9a 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Update_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Update_T.cpp @@ -35,7 +35,7 @@ DDS_Update_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::configuration_complete ( const char* profile_name) { DDS4CCM_TRACE ("DDS_Update_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::configuration_complete"); - if (!this->ccm_dds_writer_->get_impl ()) + if (!this->ccm_dds_writer_->get_rti_entity ()) { ::DDS::DataWriter_var dwv_tmp; if (library_name && profile_name) @@ -74,7 +74,7 @@ DDS_Update_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::configuration_complete ( "internal represenation.\n")); throw ::CORBA::INTERNAL (); } - this->ccm_dds_writer_->set_impl (rw->get_impl ()); + this->ccm_dds_writer_->set_rti_entity (rw->get_rti_entity ()); this->dds_update_->set_impl (this->ccm_dds_writer_); this->ccm_data_writer_->set_impl (this->ccm_dds_writer_); } @@ -153,7 +153,7 @@ DDS_Update_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::remove ( ::CIAO::DDS4CCM::translate_retcode (retval))); throw ::CORBA::INTERNAL (); } - this->ccm_dds_writer_->set_impl (0); + this->ccm_dds_writer_->set_rti_entity (0); this->dds_update_->_set_component (CCM_TYPE::base_type::_nil ()); this->dds_update_->set_impl (0); } diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Update_T.h b/CIAO/connectors/dds4ccm/impl/DDS_Update_T.h index 4a3690d5a79..43e6183bcdd 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Update_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_Update_T.h @@ -40,7 +40,7 @@ public: private: typedef ::CIAO::DDS4CCM::DataWriterListener_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE> DataWriterListener_type; - typedef ::CIAO::DDS4CCM::DDS_DataWriter_T<DDS_TYPE> + typedef ::CIAO::NDDS::DataWriter_T<DDS_TYPE> DataWriter_type; typedef ::CIAO::DDS4CCM::Updater_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE> Updater_type; diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Write_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Write_T.cpp index 7ed579fdec2..37311295988 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Write_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Write_T.cpp @@ -35,7 +35,7 @@ DDS_Write_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::configuration_complete ( const char* profile_name) { DDS4CCM_TRACE ("DDS_Write_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::configuration_complete"); - if (!this->ccm_dds_writer_->get_impl ()) + if (!this->ccm_dds_writer_->get_rti_entity ()) { ::DDS::DataWriter_var dwv_tmp; if (library_name && profile_name) @@ -72,7 +72,7 @@ DDS_Write_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::configuration_complete ( "internal represenation.\n")); throw ::CORBA::INTERNAL (); } - this->ccm_dds_writer_->set_impl (rw->get_impl ()); + this->ccm_dds_writer_->set_rti_entity (rw->get_rti_entity ()); this->writer_t_->set_impl (this->ccm_dds_writer_); this->ccm_data_writer_->set_impl (this->ccm_dds_writer_); } @@ -145,7 +145,7 @@ DDS_Write_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::remove ( if (retcode == ::DDS::RETCODE_OK) { - this->ccm_dds_writer_->set_impl (0); + this->ccm_dds_writer_->set_rti_entity (0); this->writer_t_->_set_component (CCM_TYPE::base_type::_nil ()); this->writer_t_->set_impl (0); } diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Write_T.h b/CIAO/connectors/dds4ccm/impl/DDS_Write_T.h index f08c8c66fdb..5a630f40b6b 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Write_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_Write_T.h @@ -50,7 +50,7 @@ private: Writer_type; typedef ::CIAO::DDS4CCM::DataWriterListener_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE> DataWriterListener_type; - typedef ::CIAO::DDS4CCM::DDS_DataWriter_T<DDS_TYPE> + typedef ::CIAO::NDDS::DataWriter_T<DDS_TYPE> DataWriter_type; /** diff --git a/CIAO/connectors/dds4ccm/impl/DataReaderListener_T.cpp b/CIAO/connectors/dds4ccm/impl/DataReaderListener_T.cpp index e19198de836..127abf08a75 100644 --- a/CIAO/connectors/dds4ccm/impl/DataReaderListener_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DataReaderListener_T.cpp @@ -62,14 +62,21 @@ CIAO::DDS4CCM::DataReaderListener_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::on_data_av { DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReaderListener_T::on_data_available_i"); - if (::CORBA::is_nil (rdr) || - this->control_->mode () == ::CCM_DDS::NOT_ENABLED) + if (::CORBA::is_nil (rdr)) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + ACE_TEXT ("DataReaderListener_T::on_data_available_i - ") + ACE_TEXT ("No datareader received.\n"))); + return; + } + + if (this->control_->mode () == ::CCM_DDS::NOT_ENABLED) { return; } - ::CIAO::DDS4CCM::DataReader_T<DDS_TYPE> * reader = - dynamic_cast < ::CIAO::DDS4CCM::DataReader_T<DDS_TYPE> *> (rdr); + ::CIAO::NDDS::DataReader_T<DDS_TYPE> * reader = + dynamic_cast < ::CIAO::NDDS::DataReader_T<DDS_TYPE> *> (rdr); if (!reader) { @@ -97,7 +104,7 @@ CIAO::DDS4CCM::DataReaderListener_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::on_data_av reader->take (data, sample_info, DDS_LENGTH_UNLIMITED, - qc->get_impl ()); + qc->get_rti_entity ()); if (result == ::DDS::RETCODE_NO_DATA) { diff --git a/CIAO/connectors/dds4ccm/impl/DataReaderListener_T.h b/CIAO/connectors/dds4ccm/impl/DataReaderListener_T.h index 0b09cd44eac..9b45519b243 100644 --- a/CIAO/connectors/dds4ccm/impl/DataReaderListener_T.h +++ b/CIAO/connectors/dds4ccm/impl/DataReaderListener_T.h @@ -31,7 +31,7 @@ namespace CIAO PortStatusListener_type; typedef ::CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE> ConditionManager_type; - typedef ::CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE> + typedef ::CIAO::NDDS::DDS_QueryCondition_i QueryCondition_type; public: diff --git a/CIAO/connectors/dds4ccm/impl/DataReaderStateListener_T.cpp b/CIAO/connectors/dds4ccm/impl/DataReaderStateListener_T.cpp index 53cb239dfc2..41c49cc486d 100644 --- a/CIAO/connectors/dds4ccm/impl/DataReaderStateListener_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DataReaderStateListener_T.cpp @@ -70,8 +70,8 @@ CIAO::DDS4CCM::DataReaderStateListener_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::on_da return; } - ::CIAO::DDS4CCM::DataReader_T<DDS_TYPE> * reader = - dynamic_cast < ::CIAO::DDS4CCM::DataReader_T<DDS_TYPE> *> (rdr); + ::CIAO::NDDS::DataReader_T<DDS_TYPE> * reader = + dynamic_cast < ::CIAO::NDDS::DataReader_T<DDS_TYPE> *> (rdr); if (!reader) { @@ -108,7 +108,7 @@ CIAO::DDS4CCM::DataReaderStateListener_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::on_da data, sample_info, max_samples, - qc->get_impl ()); + qc->get_rti_entity ()); if (result == ::DDS::RETCODE_NO_DATA) { return; diff --git a/CIAO/connectors/dds4ccm/impl/DataReaderStateListener_T.h b/CIAO/connectors/dds4ccm/impl/DataReaderStateListener_T.h index bb50d509ad0..a6acf4e1857 100644 --- a/CIAO/connectors/dds4ccm/impl/DataReaderStateListener_T.h +++ b/CIAO/connectors/dds4ccm/impl/DataReaderStateListener_T.h @@ -21,11 +21,11 @@ namespace CIAO class DataReaderStateListener_T : public PortStatusListener_T <DDS_TYPE, VENDOR_TYPE> { - typedef CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE> + typedef ::CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE> ConditionManager_type; typedef ::CIAO::DDS4CCM::DataReaderStateHandler_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE> DataReaderStateHandler_type; - typedef CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE> + typedef ::CIAO::NDDS::DDS_QueryCondition_i QueryCondition_type; public: diff --git a/CIAO/connectors/dds4ccm/impl/Getter_T.cpp b/CIAO/connectors/dds4ccm/impl/Getter_T.cpp index fca6c0a151a..02cee67b956 100644 --- a/CIAO/connectors/dds4ccm/impl/Getter_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/Getter_T.cpp @@ -22,7 +22,7 @@ CIAO::DDS4CCM::DDS_CCM::Getter_Base_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::~Getter_ } template <typename DDS_TYPE, typename CCM_TYPE, DDS4CCM_Vendor VENDOR_TYPE> -CIAO::DDS4CCM::DataReader_T<DDS_TYPE> * +CIAO::NDDS::DataReader_T<DDS_TYPE> * CIAO::DDS4CCM::DDS_CCM::Getter_Base_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::impl (void) { if (this->reader_) @@ -31,6 +31,9 @@ CIAO::DDS4CCM::DDS_CCM::Getter_Base_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::impl (vo } else { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "CIAO::DDS4CCM::Getter_Base_T::impl - " + "Throwing BAD_INV_ORDER.\n")); throw ::CORBA::BAD_INV_ORDER (); } } @@ -50,7 +53,7 @@ CIAO::DDS4CCM::DDS_CCM::Getter_Base_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::get ( return this->impl ()->get (data, sample_info, max_samples, - rc->get_impl ()); + rc->get_rti_entity ()); } else { @@ -66,7 +69,7 @@ CIAO::DDS4CCM::DDS_CCM::Getter_Base_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::get ( return this->impl ()->get (data, sample_info, max_samples, - qc->get_impl ()); + qc->get_rti_entity ()); } } @@ -98,8 +101,8 @@ CIAO::DDS4CCM::DDS_CCM::Getter_Base_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::get_many this->condition_manager_->get_readcondition (); QueryCondition_type * qc = this->condition_manager_->get_querycondition_getter (); - if ((rc && active_conditions[i] == rc->get_impl ()) || - (qc && active_conditions[i] == rc->get_impl ()) ) + if ((rc && active_conditions[i] == rc->get_rti_entity ()) || + (qc && active_conditions[i] == rc->get_rti_entity ()) ) { // Check trigger active_conditions[i]->get_trigger_value (); @@ -336,8 +339,8 @@ CIAO::DDS4CCM::DDS_CCM::Getter_T<DDS_TYPE, CCM_TYPE, false, VENDOR_TYPE>::get_on this->condition_manager_->get_readcondition (); typename Getter_Base_T<DDS_TYPE, CCM_TYPE, VENDOR_TYPE>::QueryCondition_type * qc = this->condition_manager_->get_querycondition_getter (); - if ((rc && active_conditions[i] == rc->get_impl ()) || - (qc && active_conditions[i] == qc->get_impl ()) ) + if ((rc && active_conditions[i] == rc->get_rti_entity ()) || + (qc && active_conditions[i] == qc->get_rti_entity ()) ) { bool valid_data_read = false; diff --git a/CIAO/connectors/dds4ccm/impl/Getter_T.h b/CIAO/connectors/dds4ccm/impl/Getter_T.h index 729d15eb4bb..4f743500ada 100644 --- a/CIAO/connectors/dds4ccm/impl/Getter_T.h +++ b/CIAO/connectors/dds4ccm/impl/Getter_T.h @@ -41,10 +41,10 @@ namespace CIAO private virtual ACE_Copy_Disabled { protected: - typedef CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE> ReadCondition_type; - typedef CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE> QueryCondition_type; - typedef CIAO::DDS4CCM::DataReader_T<DDS_TYPE> DataReader_type; - typedef CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE> + typedef CIAO::NDDS::DDS_ReadCondition_i ReadCondition_type; + typedef CIAO::NDDS::DDS_QueryCondition_i QueryCondition_type; + typedef CIAO::NDDS::DataReader_T<DDS_TYPE> DataReader_type; + typedef CIAO::DDS4CCM::ConditionManager_T<DDS_TYPE> ConditionManager_type; public: diff --git a/CIAO/connectors/dds4ccm/impl/InstanceHandleManager_T.cpp b/CIAO/connectors/dds4ccm/impl/InstanceHandleManager_T.cpp index 926c77a3747..619e1b7eb0f 100644 --- a/CIAO/connectors/dds4ccm/impl/InstanceHandleManager_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/InstanceHandleManager_T.cpp @@ -17,7 +17,7 @@ CIAO::DDS4CCM::InstanceHandleManager_T<DDS_TYPE, CCM_TYPE, BASE_TYPE, VENDOR_TYP } template <typename DDS_TYPE, typename CCM_TYPE, typename BASE_TYPE, DDS4CCM_Vendor VENDOR_TYPE> -CIAO::DDS4CCM::DDS_DataWriter_T <DDS_TYPE> * +CIAO::NDDS::DataWriter_T <DDS_TYPE> * CIAO::DDS4CCM::InstanceHandleManager_T<DDS_TYPE, CCM_TYPE, BASE_TYPE, VENDOR_TYPE>::impl (void) { if (this->writer_) @@ -26,6 +26,9 @@ CIAO::DDS4CCM::InstanceHandleManager_T<DDS_TYPE, CCM_TYPE, BASE_TYPE, VENDOR_TYP } else { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "CIAO::NDDS::DataWriter_T <DDS_TYPE>::impl - " + "Throwing BAD_INV_ORDER.\n")); throw ::CORBA::BAD_INV_ORDER (); } } @@ -50,7 +53,7 @@ CIAO::DDS4CCM::InstanceHandleManager_T<DDS_TYPE, CCM_TYPE, BASE_TYPE, VENDOR_TYP template <typename DDS_TYPE, typename CCM_TYPE, typename BASE_TYPE, DDS4CCM_Vendor VENDOR_TYPE> void CIAO::DDS4CCM::InstanceHandleManager_T<DDS_TYPE, CCM_TYPE, BASE_TYPE, VENDOR_TYPE>::set_impl ( - DDS_DataWriter_T<DDS_TYPE> *writer) + ::CIAO::NDDS::DataWriter_T<DDS_TYPE> *writer) { DDS4CCM_TRACE ("CIAO::DDS4CCM::InstanceHandleManager_T::set_impl"); diff --git a/CIAO/connectors/dds4ccm/impl/InstanceHandleManager_T.h b/CIAO/connectors/dds4ccm/impl/InstanceHandleManager_T.h index 2b214799dc5..fc9bc8b20d5 100644 --- a/CIAO/connectors/dds4ccm/impl/InstanceHandleManager_T.h +++ b/CIAO/connectors/dds4ccm/impl/InstanceHandleManager_T.h @@ -37,13 +37,13 @@ namespace CIAO const typename DDS_TYPE::value_type & datum, const ::DDS::InstanceHandle_t & instance_handle); - void set_impl (DDS_DataWriter_T<DDS_TYPE> *writer); + void set_impl (::CIAO::NDDS::DataWriter_T<DDS_TYPE> *writer); protected: - DDS_DataWriter_T <DDS_TYPE> * impl (void); + ::CIAO::NDDS::DataWriter_T <DDS_TYPE> * impl (void); private: - DDS_DataWriter_T <DDS_TYPE> * writer_; + ::CIAO::NDDS::DataWriter_T <DDS_TYPE> * writer_; }; } } diff --git a/CIAO/connectors/dds4ccm/impl/Reader_T.cpp b/CIAO/connectors/dds4ccm/impl/Reader_T.cpp index 672abd9aa45..edb3e605add 100644 --- a/CIAO/connectors/dds4ccm/impl/Reader_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/Reader_T.cpp @@ -64,7 +64,7 @@ CIAO::DDS4CCM::DDS_CCM::Reader_T<DDS_TYPE, CCM_TYPE, FIXED, VENDOR_TYPE>::read_l { this->impl ()->read_wo_instance (data, sample_info, - qc->get_impl ()); + qc->get_rti_entity ()); } else { @@ -124,7 +124,7 @@ CIAO::DDS4CCM::DDS_CCM::Reader_T<DDS_TYPE, CCM_TYPE, FIXED, VENDOR_TYPE>::read_a { this->impl ()->read_wo_instance (data, sample_info, - qc->get_impl ()); + qc->get_rti_entity ()); } else { @@ -318,7 +318,7 @@ CIAO::DDS4CCM::DDS_CCM::Reader_T<DDS_TYPE, CCM_TYPE, FIXED, VENDOR_TYPE>::set_im } template <typename DDS_TYPE, typename CCM_TYPE, bool FIXED, DDS4CCM_Vendor VENDOR_TYPE> -CIAO::DDS4CCM::DataReader_T<DDS_TYPE> * +CIAO::NDDS::DataReader_T<DDS_TYPE> * CIAO::DDS4CCM::DDS_CCM::Reader_T<DDS_TYPE, CCM_TYPE, FIXED, VENDOR_TYPE>::impl (void) { if (this->reader_) @@ -327,6 +327,9 @@ CIAO::DDS4CCM::DDS_CCM::Reader_T<DDS_TYPE, CCM_TYPE, FIXED, VENDOR_TYPE>::impl ( } else { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "CIAO::NDDS::DataReader_T - " + "Throwing BAD_INV_ORDER.\n")); throw ::CORBA::BAD_INV_ORDER (); } } diff --git a/CIAO/connectors/dds4ccm/impl/Reader_T.h b/CIAO/connectors/dds4ccm/impl/Reader_T.h index bc7bf6cae32..9925321aa08 100644 --- a/CIAO/connectors/dds4ccm/impl/Reader_T.h +++ b/CIAO/connectors/dds4ccm/impl/Reader_T.h @@ -28,9 +28,9 @@ namespace CIAO public virtual LocalObject_T<CCM_TYPE>, private virtual ACE_Copy_Disabled { - typedef DataReader_T<DDS_TYPE> DataReader_type; + typedef ::CIAO::NDDS::DataReader_T<DDS_TYPE> DataReader_type; typedef ConditionManager_T<DDS_TYPE> ConditionManager_type; - typedef DDS_QueryCondition_T<DDS_TYPE> QueryCondition_type; + typedef ::CIAO::NDDS::DDS_QueryCondition_i QueryCondition_type; public: /// Constructor diff --git a/CIAO/connectors/dds4ccm/impl/TopicListener_T.cpp b/CIAO/connectors/dds4ccm/impl/TopicListener_T.cpp index 43457144c3d..0475cffab34 100644 --- a/CIAO/connectors/dds4ccm/impl/TopicListener_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/TopicListener_T.cpp @@ -1,7 +1,7 @@ // $Id$ #include "dds4ccm/impl/Utils.h" -#include "dds4ccm/impl/ndds/Topic_T.h" +#include "dds4ccm/impl/ndds/Topic.h" #include "dds4ccm/impl/DDSCallbackStatusHandler.h" #include "dds4ccm/impl/logger/Log_Macros.h" diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic.cpp b/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic.cpp new file mode 100644 index 00000000000..eccdf9bbfd7 --- /dev/null +++ b/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic.cpp @@ -0,0 +1,111 @@ +// $Id$ + +#include "ndds/ndds_cpp.h" +#include "dds4ccm/impl/ndds/ContentFilteredTopic.h" +#include "dds4ccm/impl/ndds/Topic.h" +#include "dds4ccm/impl/logger/Log_Macros.h" +#include "dds4ccm/impl/ndds/convertors/StringSeq.h" + +namespace CIAO +{ + namespace NDDS + { + DDS_ContentFilteredTopic_i::DDS_ContentFilteredTopic_i ( + ::DDSContentFilteredTopic * cft, + ::DDS::DomainParticipant_ptr dp) + : rti_entity_ (cft), + dp_ (::DDS::DomainParticipant::_duplicate (dp)) + { + } + + DDS_ContentFilteredTopic_i::~DDS_ContentFilteredTopic_i (void) + { + } + + char * + DDS_ContentFilteredTopic_i::get_filter_expression (void) + { + DDS4CCM_TRACE ("DDS_ContentFilteredTopic_i::get_filter_expression"); + return CORBA::string_dup (this->rti_entity ()->get_filter_expression ()); + } + + ::DDS::ReturnCode_t + DDS_ContentFilteredTopic_i::get_expression_parameters ( + ::DDS::StringSeq & expression_parameters) + { + DDS4CCM_TRACE ("DDS_ContentFilteredTopic_i::get_expression_parameters"); + DDS_StringSeq parameters; + ::DDS::ReturnCode_t retval = + this->rti_entity ()->get_expression_parameters (parameters); + expression_parameters <<= parameters; + return retval; + } + + ::DDS::ReturnCode_t + DDS_ContentFilteredTopic_i::set_expression_parameters ( + const ::DDS::StringSeq & expression_parameters) + { + DDS4CCM_TRACE ("DDS_ContentFilteredTopic_i::set_expression_parameters"); + + DDS_StringSeq parameters; + parameters <<= expression_parameters; + return this->rti_entity ()->set_expression_parameters (parameters); + } + + ::DDS::Topic_ptr + DDS_ContentFilteredTopic_i::get_related_topic (void) + { + DDS4CCM_TRACE ("DDS_ContentFilteredTopic_i::get_related_topic"); + + ::DDS::Topic_var retval; + DDSTopic *topic = this->rti_entity ()->get_related_topic (); + ACE_NEW_THROW_EX (retval, + DDS_Topic_i (topic, this->dp_.in ()), + ::CORBA::NO_MEMORY ()); + return retval._retn (); + } + + char * + DDS_ContentFilteredTopic_i::get_type_name (void) + { + return CORBA::string_dup (this->rti_entity ()->get_type_name ()); + } + + char * + DDS_ContentFilteredTopic_i::get_name (void) + { + return CORBA::string_dup (this->rti_entity ()->get_name ()); + } + + ::DDS::DomainParticipant_ptr + DDS_ContentFilteredTopic_i::get_participant (void) + { + return ::DDS::DomainParticipant::_duplicate (this->dp_.in ()); + } + + DDSContentFilteredTopic * + DDS_ContentFilteredTopic_i::get_rti_entity (void) + { + return this->rti_entity_; + } + + void + DDS_ContentFilteredTopic_i::set_rti_entity (DDSContentFilteredTopic * cft) + { + this->rti_entity_ = cft; + } + + DDSContentFilteredTopic * + DDS_ContentFilteredTopic_i::rti_entity (void) + { + if (!this->rti_entity_) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DDS_ContentFilteredTopic_i::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); + throw ::CORBA::BAD_INV_ORDER (); + } + return this->rti_entity_; + } + } +} diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic_T.h b/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic.h index f025759c2d4..b2406c2fb0b 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic.h @@ -9,31 +9,27 @@ #ifndef CONTENFILTEREDTOPIC_T_H_ #define CONTENFILTEREDTOPIC_T_H_ -#include "DomainParticipant_T.h" - -#include "ndds/ndds_cpp.h" - +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "dds4ccm/idl/dds_rtf2_dcpsC.h" -#include "ace/Copy_Disabled.h" +#include "tao/LocalObject.h" + +class DDSContentFilteredTopic; namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_ContentFilteredTopic_T : + class DDS4CCM_NDDS_Export DDS_ContentFilteredTopic_i : public virtual ::DDS::ContentFilteredTopic, - public virtual ::CORBA::LocalObject, - private ACE_Copy_Disabled + public virtual ::CORBA::LocalObject { - typedef DDS_Topic_T<DDS_TYPE> Topic_type; - typedef DDS_DomainParticipant_T<DDS_TYPE> DomainParticipant_type; public: /// Constructor - explicit DDS_ContentFilteredTopic_T (DDSContentFilteredTopic * dw = 0); + explicit DDS_ContentFilteredTopic_i (::DDSContentFilteredTopic * cft, + ::DDS::DomainParticipant_ptr dp); /// Destructor - virtual ~DDS_ContentFilteredTopic_T (void); + virtual ~DDS_ContentFilteredTopic_i (void); virtual char * get_filter_expression (void); @@ -51,18 +47,17 @@ namespace CIAO virtual ::DDS::DomainParticipant_ptr get_participant (void); - DDSContentFilteredTopic * get_impl (void); + ::DDSContentFilteredTopic * get_rti_entity (void); - void set_impl (DDSContentFilteredTopic * dw); + void set_rti_entity (::DDSContentFilteredTopic * cft); private: - DDSContentFilteredTopic * impl_; + ::DDSContentFilteredTopic * rti_entity_; + ::DDS::DomainParticipant_var dp_; - DDSContentFilteredTopic * impl (void); + DDSContentFilteredTopic * rti_entity (void); }; } } -#include "dds4ccm/impl/ndds/ContentFilteredTopic_T.cpp" - #endif /* CONTENFILTEREDTOPIC_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic_T.cpp deleted file mode 100644 index 581b4cdb998..00000000000 --- a/CIAO/connectors/dds4ccm/impl/ndds/ContentFilteredTopic_T.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// $Id$ - -#include "ContentFilteredTopic_T.h" -#include "Topic_T.h" - -#include "convertors/StringSeq.h" - -#include "dds4ccm/impl/logger/Log_Macros.h" -#include "dds4ccm/impl/dds4ccm_conf.h" - -namespace CIAO -{ - namespace DDS4CCM - { - template <typename DDS_TYPE> - DDS_ContentFilteredTopic_T<DDS_TYPE>::DDS_ContentFilteredTopic_T ( - DDSContentFilteredTopic * dw) - : impl_ (dw) - { - } - - template <typename DDS_TYPE> - DDS_ContentFilteredTopic_T<DDS_TYPE>::~DDS_ContentFilteredTopic_T (void) - { - } - - template <typename DDS_TYPE> - char * - DDS_ContentFilteredTopic_T<DDS_TYPE>::get_filter_expression (void) - { - DDS4CCM_TRACE ("DDS_ContentFilteredTopic_T<DDS_TYPE>::get_filter_expression"); - return CORBA::string_dup (this->impl ()->get_filter_expression ()); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_ContentFilteredTopic_T<DDS_TYPE>::get_expression_parameters ( - ::DDS::StringSeq & expression_parameters) - { - DDS4CCM_TRACE ("DDS_ContentFilteredTopic_T<DDS_TYPE>::get_expression_parameters"); - DDS_StringSeq parameters; - ::DDS::ReturnCode_t retval = - this->impl ()->get_expression_parameters (parameters); - expression_parameters <<= parameters; - return retval; - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_ContentFilteredTopic_T<DDS_TYPE>::set_expression_parameters ( - const ::DDS::StringSeq & expression_parameters) - { - DDS4CCM_TRACE ("DDS_ContentFilteredTopic_T<DDS_TYPE>::set_expression_parameters"); - - DDS_StringSeq parameters; - parameters <<= expression_parameters; - return this->impl ()->set_expression_parameters (parameters); - } - - template <typename DDS_TYPE> - ::DDS::Topic_ptr - DDS_ContentFilteredTopic_T<DDS_TYPE>::get_related_topic (void) - { - DDS4CCM_TRACE ("DDS_ContentFilteredTopic_T<DDS_TYPE>::get_related_topic"); - - ::DDS::Topic_var retval; - DDSTopic *topic = this->impl ()->get_related_topic (); - ACE_NEW_THROW_EX (retval, - Topic_type (topic), - ::CORBA::NO_MEMORY ()); - return retval._retn (); - } - - template <typename DDS_TYPE> - char * - DDS_ContentFilteredTopic_T<DDS_TYPE>::get_type_name (void) - { - return CORBA::string_dup (this->impl ()->get_type_name ()); - } - - template <typename DDS_TYPE> - char * - DDS_ContentFilteredTopic_T<DDS_TYPE>::get_name (void) - { - return CORBA::string_dup (this->impl ()->get_name ()); - } - - template <typename DDS_TYPE> - ::DDS::DomainParticipant_ptr - DDS_ContentFilteredTopic_T<DDS_TYPE>::get_participant (void) - { - ::DDS::DomainParticipant_var retval; - DDSDomainParticipant * p = this->impl ()->get_participant (); - ACE_NEW_THROW_EX (retval, - DomainParticipant_type (p), - ::CORBA::NO_MEMORY ()); - return retval._retn (); - } - - template <typename DDS_TYPE> - DDSContentFilteredTopic * - DDS_ContentFilteredTopic_T<DDS_TYPE>::get_impl (void) - { - return this->impl_; - } - - template <typename DDS_TYPE> - void - DDS_ContentFilteredTopic_T<DDS_TYPE>::set_impl (DDSContentFilteredTopic * dw) - { - this->impl_ = dw; - } - - template <typename DDS_TYPE> - DDSContentFilteredTopic * - DDS_ContentFilteredTopic_T<DDS_TYPE>::impl (void) - { - if (!this->impl_) - { - throw ::CORBA::BAD_INV_ORDER (); - } - return this->impl_; - } - } -} diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSDataReaderListener_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DDSDataReaderListener_T.cpp deleted file mode 100644 index 00087213d73..00000000000 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSDataReaderListener_T.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// $Id$ - -#include "DDSDataReaderListener_T.h" -#include "dds4ccm/impl/ndds/DataReader_T.h" - -#include "dds4ccm/impl/ndds/convertors/SampleLostStatus.h" -#include "dds4ccm/impl/ndds/convertors/SubscriptionMatchedStatus.h" -#include "dds4ccm/impl/ndds/convertors/RequestedDeadlineMissedStatus.h" -#include "dds4ccm/impl/ndds/convertors/SampleRejectedStatus.h" -#include "dds4ccm/impl/ndds/convertors/LivelinessChangedStatus.h" -#include "dds4ccm/impl/ndds/convertors/RequestedIncompatibleQosStatus.h" - -#include "dds4ccm/idl/dds4ccm_BaseC.h" - -#include "dds4ccm/impl/logger/Log_Macros.h" - -namespace CIAO -{ - namespace DDS4CCM - { - template <typename DDS_TYPE> - DDS_DataReaderListener_T<DDS_TYPE>::DDS_DataReaderListener_T ( - ::DDS::DataReaderListener_ptr p, - DataReader_type *typed_dr) - : impl_ (::DDS::DataReaderListener::_duplicate (p)), - typed_dr_ (typed_dr) - { - } - - template <typename DDS_TYPE> - DDS_DataReaderListener_T<DDS_TYPE>::~DDS_DataReaderListener_T (void) - { - } - - template <typename DDS_TYPE> - void - DDS_DataReaderListener_T<DDS_TYPE>::on_requested_deadline_missed ( - ::DDSDataReader* , - const ::DDS_RequestedDeadlineMissedStatus & status) - { - DDS4CCM_TRACE ("DDS_DataReaderListener_T<DDS_TYPE>::on_requested_deadline_missed"); - ::DDS::RequestedDeadlineMissedStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_requested_deadline_missed ( - this->typed_dr_, - ddsstatus); - } - - template <typename DDS_TYPE> - void - DDS_DataReaderListener_T<DDS_TYPE>::on_requested_incompatible_qos ( - ::DDSDataReader* , - const ::DDS_RequestedIncompatibleQosStatus & status) - { - DDS4CCM_TRACE ("DDS_DataReaderListener_T<DDS_TYPE>::on_requested_incompatible_qos"); - ::DDS::RequestedIncompatibleQosStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_requested_incompatible_qos ( - this->typed_dr_, - ddsstatus); - } - - template <typename DDS_TYPE> - void - DDS_DataReaderListener_T<DDS_TYPE>::on_sample_rejected ( - ::DDSDataReader* , - const ::DDS_SampleRejectedStatus & status) - { - DDS4CCM_TRACE ("DDS_DataReaderListener_T<DDS_TYPE>::on_sample_rejected"); - ::DDS::SampleRejectedStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_sample_rejected ( - this->typed_dr_, - ddsstatus); - } - - template <typename DDS_TYPE> - void - DDS_DataReaderListener_T<DDS_TYPE>::on_liveliness_changed ( - ::DDSDataReader* , - const ::DDS_LivelinessChangedStatus & status) - { - DDS4CCM_TRACE ("DDS_DataReaderListener_T<DDS_TYPE>::on_liveliness_changed"); - ::DDS::LivelinessChangedStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_liveliness_changed ( - this->typed_dr_, - ddsstatus); - } - - template <typename DDS_TYPE> - void - DDS_DataReaderListener_T<DDS_TYPE>::on_data_available(::DDSDataReader *) - { - DDS4CCM_TRACE ("DDS_DataReaderListener_T<DDS_TYPE>::on_data_available"); - this->impl_->on_data_available ( - this->typed_dr_); - } - - template <typename DDS_TYPE> - void - DDS_DataReaderListener_T<DDS_TYPE>::on_subscription_matched ( - ::DDSDataReader* , - const ::DDS_SubscriptionMatchedStatus & status) - { - DDS4CCM_TRACE ("DDS_DataReaderListener_T<DDS_TYPE>::on_subscription_matched"); - ::DDS::SubscriptionMatchedStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_subscription_matched ( - this->typed_dr_, - ddsstatus); - } - - template <typename DDS_TYPE> - void - DDS_DataReaderListener_T<DDS_TYPE>::on_sample_lost ( - ::DDSDataReader* , - const ::DDS_SampleLostStatus & status) - { - DDS4CCM_TRACE ("DDS_DataReaderListener_T<DDS_TYPE>::on_sample_lost"); - ::DDS::SampleLostStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_sample_lost ( - this->typed_dr_, - ddsstatus); - } - - template <typename DDS_TYPE> - ::DDS::DataReaderListener_ptr - DDS_DataReaderListener_T<DDS_TYPE>::get_datareaderlistener (void) - { - return ::DDS::DataReaderListener::_duplicate (this->impl_.in ()); - } - } -} - diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSDataWriterListener_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DDSDataWriterListener_T.cpp deleted file mode 100644 index 7662954f447..00000000000 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSDataWriterListener_T.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// $Id$ - -#include "dds4ccm/impl/DataWriterListener_T.h" -#include "dds4ccm/impl/ndds/DataWriter_T.h" -#include "dds4ccm/impl/ndds/convertors/PublicationMatchedStatus.h" -#include "dds4ccm/impl/ndds/convertors/LivelinessLostStatus.h" -#include "dds4ccm/impl/ndds/convertors/OfferedIncompatibleQosStatus.h" -#include "dds4ccm/impl/ndds/convertors/OfferedDeadlineMissedStatus.h" - -#include "dds4ccm/impl/dds4ccm_conf.h" -#include "dds4ccm/impl/logger/Log_Macros.h" - -namespace CIAO -{ - namespace DDS4CCM - { - template <typename DDS_TYPE> - DDS_DataWriterListener_T<DDS_TYPE>::DDS_DataWriterListener_T ( - ::DDS::DataWriterListener_ptr s, - DataWriter_type * typed_dw) - : impl_ (::DDS::DataWriterListener::_duplicate (s)), - typed_dw_ (typed_dw) - { - } - - template <typename DDS_TYPE> - DDS_DataWriterListener_T<DDS_TYPE>::~DDS_DataWriterListener_T (void) - { - } - - template <typename DDS_TYPE> - void - DDS_DataWriterListener_T<DDS_TYPE>::on_offered_deadline_missed ( - ::DDSDataWriter *, - const ::DDS_OfferedDeadlineMissedStatus & status) - { - DDS4CCM_TRACE ("DDS_DataWriterListener_T<DDS_TYPE>::on_offered_deadline_missed"); - ::DDS::OfferedDeadlineMissedStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_offered_deadline_missed ( - this->typed_dw_, - ddsstatus); - } - - template <typename DDS_TYPE> - void - DDS_DataWriterListener_T<DDS_TYPE>::on_offered_incompatible_qos ( - ::DDSDataWriter *, - const ::DDS_OfferedIncompatibleQosStatus & status) - { - DDS4CCM_TRACE ("DDS_DataWriterListener_T<DDS_TYPE>::on_offered_incompatible_qos"); - ::DDS::OfferedIncompatibleQosStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_offered_incompatible_qos ( - this->typed_dw_, - ddsstatus); - } - - template <typename DDS_TYPE> - void - DDS_DataWriterListener_T<DDS_TYPE>::on_liveliness_lost ( - ::DDSDataWriter *, - const ::DDS_LivelinessLostStatus & status) - { - DDS4CCM_TRACE ("DDS_DataWriterListener_T<DDS_TYPE>::on_liveliness_lost"); - ::DDS::LivelinessLostStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_liveliness_lost ( - this->typed_dw_, - ddsstatus); - } - - template <typename DDS_TYPE> - void - DDS_DataWriterListener_T<DDS_TYPE>::on_publication_matched ( - ::DDSDataWriter *, - const ::DDS_PublicationMatchedStatus & status) - { - DDS4CCM_TRACE ("DDS_DataWriterListener_T<DDS_TYPE>::on_publication_matched"); - ::DDS::PublicationMatchedStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_publication_matched (this->typed_dw_, ddsstatus); - } - - template <typename DDS_TYPE> - ::DDS::DataWriterListener_ptr - DDS_DataWriterListener_T<DDS_TYPE>::get_datawriterlistener (void) - { - return ::DDS::DataWriterListener::_duplicate (this->impl_.in ()); - } - } -} - diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSTopicListener_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DDSTopicListener_T.cpp deleted file mode 100644 index e6eddab4e30..00000000000 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSTopicListener_T.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// $Id$ - -#include "dds4ccm/impl/ndds/DDSTopicListener_T.h" -#include "dds4ccm/impl/ndds/Topic_T.h" - -#include "dds4ccm/impl/ndds/convertors/InconsistentTopicStatus.h" - -#include "dds4ccm/idl/dds4ccm_BaseC.h" - -#include "dds4ccm/impl/logger/Log_Macros.h" - -namespace CIAO -{ - namespace DDS4CCM - { - template <typename DDS_TYPE> - DDS_TopicListener_T<DDS_TYPE>::DDS_TopicListener_T ( - ::DDS::TopicListener_ptr p) - : impl_ (::DDS::TopicListener::_duplicate (p)) - { - } - - template <typename DDS_TYPE> - DDS_TopicListener_T<DDS_TYPE>::~DDS_TopicListener_T (void) - { - } - - template <typename DDS_TYPE> - void - DDS_TopicListener_T<DDS_TYPE>::on_inconsistent_topic ( - ::DDSTopic* the_topic, - const ::DDS_InconsistentTopicStatus & status) - { - DDS4CCM_TRACE ("DDS_TopicListener_T<DDS_TYPE>::on_inconsistent_topic"); - - ::DDS::Topic_var dds_topic; - ACE_NEW (dds_topic, - Topic_type (the_topic)); - ::DDS::InconsistentTopicStatus ddsstatus; - ddsstatus <<= status; - this->impl_->on_inconsistent_topic (dds_topic.in (), ddsstatus); - } - - template <typename DDS_TYPE> - ::DDS::TopicListener_ptr - DDS_TopicListener_T<DDS_TYPE>::get_topiclistener (void) - { - return ::DDS::TopicListener::_duplicate (this->impl_.in ()); - } - } -} - diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataReader.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DataReader.cpp index 71359078b83..ae4a7916669 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataReader.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataReader.cpp @@ -4,7 +4,7 @@ namespace CIAO { - namespace DDS4CCM + namespace NDDS { DDS_DataReader_Base::~DDS_DataReader_Base (void) { diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataReader.h b/CIAO/connectors/dds4ccm/impl/ndds/DataReader.h index 6e97ef462fa..80ab05eadec 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataReader.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataReader.h @@ -10,16 +10,14 @@ #define DATAREADER_H #include "dds4ccm/idl/dds_rtf2_dcpsC.h" - #include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" - #include "tao/LocalObject.h" -#include "ndds/ndds_cpp.h" +class DDSDataReader; namespace CIAO { - namespace DDS4CCM + namespace NDDS { class DDS4CCM_NDDS_Export DDS_DataReader_Base : public virtual ::DDS::DataReader, @@ -28,7 +26,7 @@ namespace CIAO public: virtual ~DDS_DataReader_Base (void); - virtual DDSDataReader * get_impl (void) = 0; + virtual ::DDSDataReader * get_rti_entity (void) = 0; }; } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataReaderListener.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DataReaderListener.cpp new file mode 100644 index 00000000000..5b52d5e2b55 --- /dev/null +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataReaderListener.cpp @@ -0,0 +1,114 @@ +// $Id$ + +#include "dds4ccm/impl/ndds/DataReaderListener.h" +#include "dds4ccm/impl/ndds/convertors/SampleLostStatus.h" +#include "dds4ccm/impl/ndds/convertors/SubscriptionMatchedStatus.h" +#include "dds4ccm/impl/ndds/convertors/RequestedDeadlineMissedStatus.h" +#include "dds4ccm/impl/ndds/convertors/SampleRejectedStatus.h" +#include "dds4ccm/impl/ndds/convertors/LivelinessChangedStatus.h" +#include "dds4ccm/impl/ndds/convertors/RequestedIncompatibleQosStatus.h" +#include "dds4ccm/impl/logger/Log_Macros.h" + +namespace CIAO +{ + namespace NDDS + { + DDS_DataReaderListener_i::DDS_DataReaderListener_i ( + ::DDS::DataReaderListener_ptr p, + ::DDS::DataReader_ptr dr) + : impl_ (::DDS::DataReaderListener::_duplicate (p)), + dr_ (::DDS::DataReader::_duplicate (dr)) + { + } + + DDS_DataReaderListener_i::~DDS_DataReaderListener_i (void) + { + } + + void + DDS_DataReaderListener_i::on_requested_deadline_missed ( + ::DDSDataReader* , + const ::DDS_RequestedDeadlineMissedStatus & status) + { + DDS4CCM_TRACE ("DDS_DataReaderListener_i::on_requested_deadline_missed"); + ::DDS::RequestedDeadlineMissedStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_requested_deadline_missed (this->dr_, ddsstatus); + } + + void + DDS_DataReaderListener_i::on_requested_incompatible_qos ( + ::DDSDataReader* , + const ::DDS_RequestedIncompatibleQosStatus & status) + { + DDS4CCM_TRACE ("DDS_DataReaderListener_i::on_requested_incompatible_qos"); + ::DDS::RequestedIncompatibleQosStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_requested_incompatible_qos (this->dr_, ddsstatus); + } + + void + DDS_DataReaderListener_i::on_sample_rejected ( + ::DDSDataReader* , + const ::DDS_SampleRejectedStatus & status) + { + DDS4CCM_TRACE ("DDS_DataReaderListener_i::on_sample_rejected"); + ::DDS::SampleRejectedStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_sample_rejected (this->dr_, ddsstatus); + } + + void + DDS_DataReaderListener_i::on_liveliness_changed ( + ::DDSDataReader* , + const ::DDS_LivelinessChangedStatus & status) + { + DDS4CCM_TRACE ("DDS_DataReaderListener_i::on_liveliness_changed"); + ::DDS::LivelinessChangedStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_liveliness_changed (this->dr_, ddsstatus); + } + + void + DDS_DataReaderListener_i::on_data_available(::DDSDataReader *) + { + DDS4CCM_TRACE ("DDS_DataReaderListener_i::on_data_available"); + this->impl_->on_data_available (this->dr_); + } + + void + DDS_DataReaderListener_i::on_subscription_matched ( + ::DDSDataReader* , + const ::DDS_SubscriptionMatchedStatus & status) + { + DDS4CCM_TRACE ("DDS_DataReaderListener_i::on_subscription_matched"); + ::DDS::SubscriptionMatchedStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_subscription_matched (this->dr_, ddsstatus); + } + + void + DDS_DataReaderListener_i::on_sample_lost ( + ::DDSDataReader* , + const ::DDS_SampleLostStatus & status) + { + DDS4CCM_TRACE ("DDS_DataReaderListener_i::on_sample_lost"); + ::DDS::SampleLostStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_sample_lost (this->dr_, ddsstatus); + } + + ::DDS::DataReaderListener_ptr + DDS_DataReaderListener_i::get_datareaderlistener (void) + { + return ::DDS::DataReaderListener::_duplicate (this->impl_.in ()); + } + + void + DDS_DataReaderListener_i::set_dds_entity (::DDS::DataReader_ptr dr) + { + this->dr_ = ::DDS::DataReader::_duplicate (dr); + } + } +} + diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSDataReaderListener_T.h b/CIAO/connectors/dds4ccm/impl/ndds/DataReaderListener.h index 5269adccb2f..ca2d6bed622 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSDataReaderListener_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataReaderListener.h @@ -9,26 +9,24 @@ #ifndef DDSDATAREADERLISTENER_T_H_ #define DDSDATAREADERLISTENER_T_H_ +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "dds4ccm/idl/dds_rtf2_dcpsC.h" - -# include "ndds/ndds_cpp.h" +#include "ndds/ndds_cpp.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_DataReaderListener_T : - public virtual ::DDSDataReaderListener + class DDS4CCM_NDDS_Export DDS_DataReaderListener_i : + public ::DDSDataReaderListener { - typedef DataReader_T<DDS_TYPE> DataReader_type; public: /// Constructor - DDS_DataReaderListener_T (::DDS::DataReaderListener_ptr p, - DataReader_type *typed_dr); + DDS_DataReaderListener_i (::DDS::DataReaderListener_ptr p, + ::DDS::DataReader_ptr typed_dr); /// Destructor - virtual ~DDS_DataReaderListener_T (void); + virtual ~DDS_DataReaderListener_i (void); virtual void on_requested_deadline_missed(::DDSDataReader* reader, const ::DDS_RequestedDeadlineMissedStatus& status); @@ -51,13 +49,13 @@ namespace CIAO const ::DDS_SubscriptionMatchedStatus& status); ::DDS::DataReaderListener_ptr get_datareaderlistener (void); + + void set_dds_entity (::DDS::DataReader_ptr typed_dr); private: ::DDS::DataReaderListener_var impl_; - DataReader_type *typed_dr_; + ::DDS::DataReader_var dr_; }; } } -#include "dds4ccm/impl/ndds/DDSDataReaderListener_T.cpp" - #endif /* DDSDATAREADERLISTENER_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataReader_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DataReader_T.cpp index 459aabcf631..e56d4429547 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataReader_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataReader_T.cpp @@ -1,13 +1,13 @@ // $Id$ -#include "dds4ccm/impl/ndds/DDSDataReaderListener_T.h" +#include "dds4ccm/impl/ndds/DataReaderListener.h" #include "dds4ccm/impl/ndds/StatusCondition.h" -#include "dds4ccm/impl/ndds/ReadCondition_T.h" -#include "dds4ccm/impl/ndds/QueryCondition_T.h" -#include "dds4ccm/impl/ndds/Subscriber_T.h" -#include "dds4ccm/impl/ndds/TopicDescription_T.h" -#include "dds4ccm/impl/ndds/Topic_T.h" -#include "dds4ccm/impl/ndds/ContentFilteredTopic_T.h" +#include "dds4ccm/impl/ndds/ReadCondition.h" +#include "dds4ccm/impl/ndds/QueryCondition.h" +#include "dds4ccm/impl/ndds/Subscriber.h" +#include "dds4ccm/impl/ndds/TopicDescription.h" +#include "dds4ccm/impl/ndds/Topic.h" +#include "dds4ccm/impl/ndds/ContentFilteredTopic.h" #include "dds4ccm/impl/ndds/convertors/SampleLostStatus.h" #include "dds4ccm/impl/ndds/convertors/SubscriptionMatchedStatus.h" @@ -23,791 +23,795 @@ #include "dds4ccm/impl/ndds/convertors/StringSeq.h" #include "dds4ccm/impl/logger/Log_Macros.h" -#include "dds4ccm/impl/dds4ccm_conf.h" -template <typename DDS_TYPE> -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::DataReader_T (DDSDataReader * dr) - : impl_ (0), - lst_mask_ (0) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::DataReader_T"); - if (dr) +namespace CIAO +{ + namespace NDDS + { + template <typename DDS_TYPE> + DataReader_T<DDS_TYPE>::DataReader_T ( + DDSDataReader * dr, + ::DDS::DomainParticipant_ptr dp) + : rti_entity_ (0), + dp_ (::DDS::DomainParticipant::_duplicate (dp)), + lst_mask_ (0) { - this->impl_ = DDS_TYPE::datareader_type::narrow (dr); + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::DataReader_T"); + if (dr) + { + this->rti_entity_ = DDS_TYPE::datareader_type::narrow (dr); + } } -} -template <typename DDS_TYPE> -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::~DataReader_T (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::~DataReader_T"); -} + template <typename DDS_TYPE> + DataReader_T<DDS_TYPE>::~DataReader_T (void) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::~DataReader_T"); + } -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::log_query_condition ( - DDSQueryCondition * qc) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::log_query_condition"); - - if (DDS4CCM_debug_level >= DDS4CCM_LOG_LEVEL_DDS_STATUS) - { - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO - ACE_TEXT ("DataReader_T::") - ACE_TEXT ("read_wo_instance - read_w_condition:\n"))); - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO - ACE_TEXT ("\t\texpression <%C>\n"), - qc->get_query_expression ())); - ::DDS_StringSeq dds_qp; - qc->get_query_parameters (dds_qp); - for (DDS_Long i = 0; i < dds_qp.length (); ++i) + template <typename DDS_TYPE> + void + DataReader_T<DDS_TYPE>::log_query_condition ( + DDSQueryCondition * qc) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::log_query_condition"); + + if (DDS4CCM_debug_level >= DDS4CCM_LOG_LEVEL_DDS_STATUS) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO - ACE_TEXT ("\t\tparameter %d <%C>\n"), - i + 1, - dds_qp[i])); + ACE_TEXT ("DataReader_T::") + ACE_TEXT ("read_wo_instance - read_w_condition:\n"))); + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO + ACE_TEXT ("\t\texpression <%C>\n"), + qc->get_query_expression ())); + ::DDS_StringSeq dds_qp; + qc->get_query_parameters (dds_qp); + for (DDS_Long i = 0; i < dds_qp.length (); ++i) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO + ACE_TEXT ("\t\tparameter %d <%C>\n"), + i + 1, + dds_qp[i])); + } + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO + "\t\tinstance state mask <%d>\n", + qc->get_instance_state_mask ())); + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO + "\t\tsample state mask <%d>\n", + qc->get_sample_state_mask ())); + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO + "\t\tview state mask <%d>\n", + qc->get_view_state_mask ())); } - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO - "\t\tinstance state mask <%d>\n", - qc->get_instance_state_mask ())); - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO - "\t\tsample state mask <%d>\n", - qc->get_sample_state_mask ())); - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_DEBUG, DDS4CCM_INFO - "\t\tview state mask <%d>\n", - qc->get_view_state_mask ())); - } -} - -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::read_wo_instance ( - typename DDS_TYPE::dds_seq_type & data, - typename DDS_TYPE::sampleinfo_seq_type & sample_info, - DDSQueryCondition * qc) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::read_wo_instance"); - DDS_ReturnCode_t retval = DDS_RETCODE_ERROR; - if (qc) - { - this->log_query_condition (qc); - retval = this->impl ()->read_w_condition (data, - sample_info, - DDS_LENGTH_UNLIMITED, - qc); - } - else - { - retval = this->impl ()->read (data, - sample_info, - DDS_LENGTH_UNLIMITED, - DDS_READ_SAMPLE_STATE | DDS_NOT_READ_SAMPLE_STATE, - DDS_NEW_VIEW_STATE | DDS_NOT_NEW_VIEW_STATE, - DDS_ALIVE_INSTANCE_STATE); } - if (retval != DDS_RETCODE_OK && retval != DDS_RETCODE_NO_DATA) + + template <typename DDS_TYPE> + void + DataReader_T<DDS_TYPE>::read_wo_instance ( + typename DDS_TYPE::dds_seq_type & data, + typename DDS_TYPE::sampleinfo_seq_type & sample_info, + DDSQueryCondition * qc) { - DDS_ReturnCode_t const retval = this->return_loan (data, sample_info); - if (retval != DDS_RETCODE_OK) + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::read_wo_instance"); + DDS_ReturnCode_t retval = DDS_RETCODE_ERROR; + if (qc) { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - ACE_TEXT ("DataReader_T::read_wo_instance - ") - ACE_TEXT ("Error returning loan to DDS - <%C>\n"), - translate_retcode (retval))); + this->log_query_condition (qc); + retval = this->rti_entity ()->read_w_condition (data, + sample_info, + DDS_LENGTH_UNLIMITED, + qc); } - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - ACE_TEXT ("DataReader_T::read_wo_instance - ") - ACE_TEXT ("retval is %C\n"), - translate_retcode(retval))); - throw ::CCM_DDS::InternalError (retval, 0); - } -} - -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::read_w_instance ( - typename DDS_TYPE::dds_seq_type & data, - const ::DDS_InstanceHandle_t & lookup_hnd, - typename DDS_TYPE::sampleinfo_seq_type & sample_info) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::read_w_instance"); - - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_INFO, DDS4CCM_INFO - ACE_TEXT ("DataReader_T::read_w_instance - ") - ACE_TEXT ("Start reading with instance.\n"))); - DDS_ReturnCode_t const retval = this->impl ()->read_instance ( - data, + else + { + retval = this->rti_entity ()->read (data, sample_info, DDS_LENGTH_UNLIMITED, - lookup_hnd, - DDS_READ_SAMPLE_STATE | DDS_NOT_READ_SAMPLE_STATE , + DDS_READ_SAMPLE_STATE | DDS_NOT_READ_SAMPLE_STATE, DDS_NEW_VIEW_STATE | DDS_NOT_NEW_VIEW_STATE, DDS_ALIVE_INSTANCE_STATE); - if (retval != DDS_RETCODE_OK && retval != DDS_RETCODE_NO_DATA) + } + if (retval != DDS_RETCODE_OK && retval != DDS_RETCODE_NO_DATA) + { + DDS_ReturnCode_t const retval = this->return_loan (data, sample_info); + if (retval != DDS_RETCODE_OK) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + ACE_TEXT ("DataReader_T::read_wo_instance - ") + ACE_TEXT ("Error returning loan to DDS - <%C>\n"), + ::CIAO::DDS4CCM::translate_retcode (retval))); + } + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + ACE_TEXT ("DataReader_T::read_wo_instance - ") + ACE_TEXT ("retval is %C\n"), + ::CIAO::DDS4CCM::translate_retcode(retval))); + throw ::CCM_DDS::InternalError (retval, 0); + } + } + + template <typename DDS_TYPE> + void + DataReader_T<DDS_TYPE>::read_w_instance ( + typename DDS_TYPE::dds_seq_type & data, + const ::DDS_InstanceHandle_t & lookup_hnd, + typename DDS_TYPE::sampleinfo_seq_type & sample_info) { - DDS_ReturnCode_t const retval = this->return_loan (data, sample_info); - if (retval != DDS_RETCODE_OK) + DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::read_w_instance"); + + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_INFO, DDS4CCM_INFO + ACE_TEXT ("DataReader_T::read_w_instance - ") + ACE_TEXT ("Start reading with instance.\n"))); + DDS_ReturnCode_t const retval = this->rti_entity ()->read_instance ( + data, + sample_info, + DDS_LENGTH_UNLIMITED, + lookup_hnd, + DDS_READ_SAMPLE_STATE | DDS_NOT_READ_SAMPLE_STATE , + DDS_NEW_VIEW_STATE | DDS_NOT_NEW_VIEW_STATE, + DDS_ALIVE_INSTANCE_STATE); + if (retval != DDS_RETCODE_OK && retval != DDS_RETCODE_NO_DATA) { + DDS_ReturnCode_t const retval = this->return_loan (data, sample_info); + if (retval != DDS_RETCODE_OK) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + ACE_TEXT ("DataReader_T::read_w_instance - ") + ACE_TEXT ("Error returning loan to DDS - <%C>\n"), + ::CIAO::DDS4CCM::translate_retcode (retval))); + } DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO ACE_TEXT ("DataReader_T::read_w_instance - ") - ACE_TEXT ("Error returning loan to DDS - <%C>\n"), - translate_retcode (retval))); + ACE_TEXT ("retval is %C\n"), + ::CIAO::DDS4CCM::translate_retcode(retval))); + throw ::CCM_DDS::InternalError (retval, 0); } - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - ACE_TEXT ("DataReader_T::read_w_instance - ") - ACE_TEXT ("retval is %C\n"), - translate_retcode(retval))); - throw ::CCM_DDS::InternalError (retval, 0); - } -} - -template <typename DDS_TYPE> -DDS_ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get ( - typename DDS_TYPE::dds_seq_type & data, - typename DDS_TYPE::sampleinfo_seq_type & sample_info, - const DDS_Long & max_samples, - DDSQueryCondition * qc) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get"); - - if (qc) - { - this->log_query_condition (qc); - return this->impl ()->read_w_condition (data, - sample_info, - max_samples, - qc); - } - return DDS_RETCODE_ERROR; -} - -template <typename DDS_TYPE> -DDS_ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get ( - typename DDS_TYPE::dds_seq_type & data, - typename DDS_TYPE::sampleinfo_seq_type & sample_info, - const DDS_Long & max_samples, - DDSReadCondition * rd) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get"); + } - if (rd) + template <typename DDS_TYPE> + DDS_ReturnCode_t + DataReader_T<DDS_TYPE>::get ( + typename DDS_TYPE::dds_seq_type & data, + typename DDS_TYPE::sampleinfo_seq_type & sample_info, + const DDS_Long & max_samples, + DDSQueryCondition * qc) { - return this->impl ()->read_w_condition (data, - sample_info, - max_samples, - rd); + DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get"); + + if (qc) + { + this->log_query_condition (qc); + return this->rti_entity ()->read_w_condition (data, + sample_info, + max_samples, + qc); + } + return DDS_RETCODE_ERROR; } - return DDS_RETCODE_ERROR; -} -template <typename DDS_TYPE> -DDS_ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::take ( - typename DDS_TYPE::dds_seq_type & data, - typename DDS_TYPE::sampleinfo_seq_type & sample_info, - const DDS_Long & max_samples, - DDSQueryCondition * qc) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::take"); + template <typename DDS_TYPE> + DDS_ReturnCode_t + DataReader_T<DDS_TYPE>::get ( + typename DDS_TYPE::dds_seq_type & data, + typename DDS_TYPE::sampleinfo_seq_type & sample_info, + const DDS_Long & max_samples, + DDSReadCondition * rd) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get"); + + if (rd) + { + return this->rti_entity ()->read_w_condition (data, + sample_info, + max_samples, + rd); + } + return DDS_RETCODE_ERROR; + } - if (qc) + template <typename DDS_TYPE> + DDS_ReturnCode_t + DataReader_T<DDS_TYPE>::take ( + typename DDS_TYPE::dds_seq_type & data, + typename DDS_TYPE::sampleinfo_seq_type & sample_info, + const DDS_Long & max_samples, + DDSQueryCondition * qc) { - this->log_query_condition (qc); - return this->impl ()->take_w_condition (data, - sample_info, - max_samples, - qc); + DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::take"); + + if (qc) + { + this->log_query_condition (qc); + return this->rti_entity ()->take_w_condition (data, + sample_info, + max_samples, + qc); + } + else + { + return this->rti_entity ()->take (data, + sample_info, + max_samples, + DDS_NOT_READ_SAMPLE_STATE, + DDS_NEW_VIEW_STATE | DDS_NOT_NEW_VIEW_STATE, + DDS_ANY_INSTANCE_STATE); + } } - else + + template <typename DDS_TYPE> + ::DDS_InstanceHandle_t + DataReader_T<DDS_TYPE>::lookup_instance ( + const typename DDS_TYPE::value_type& an_instance) { - return this->impl ()->take (data, - sample_info, - max_samples, - DDS_NOT_READ_SAMPLE_STATE, - DDS_NEW_VIEW_STATE | DDS_NOT_NEW_VIEW_STATE, - DDS_ANY_INSTANCE_STATE); + return this->rti_entity ()->lookup_instance (an_instance); } -} -template <typename DDS_TYPE> -::DDS_InstanceHandle_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::lookup_instance ( - const typename DDS_TYPE::value_type& an_instance) -{ - return this->impl ()->lookup_instance (an_instance); -} - -template <typename DDS_TYPE> -::DDS_ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::return_loan ( - typename DDS_TYPE::dds_seq_type & data, - typename DDS_TYPE::sampleinfo_seq_type & sample_info) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::return_loan"); + template <typename DDS_TYPE> + ::DDS_ReturnCode_t + DataReader_T<DDS_TYPE>::return_loan ( + typename DDS_TYPE::dds_seq_type & data, + typename DDS_TYPE::sampleinfo_seq_type & sample_info) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::return_loan"); - return this->impl ()->return_loan (data, sample_info); -} + return this->rti_entity ()->return_loan (data, sample_info); + } -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::passivate () -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::passivate"); - - ::DDS::ReturnCode_t const retcode = this->set_listener ( - ::DDS::DataReaderListener::_nil (), - 0); - if (retcode != ::DDS::RETCODE_OK) - { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DataReader_T::passivate - " - "Error while setting the listener on the data reader - <%C>\n", - ::CIAO::DDS4CCM::translate_retcode (retcode))); - throw ::CORBA::INTERNAL (); - } -} - -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::create_datareader ( - ::DDS::ContentFilteredTopic_ptr topic, - ::DDS::Subscriber_ptr subscriber, - const char * library_name, - const char * profile_name) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::create_datareader"); - - ::DDS::DataReader_var reader; - if (library_name && profile_name) - { - reader = subscriber->create_datareader_with_profile ( - topic, - library_name, - profile_name, - ::DDS::DataReaderListener::_nil (), - 0); - } - else - { - ::DDS::DataReaderQos drqos; - reader = subscriber->create_datareader ( - topic, - drqos, - ::DDS::DataReaderListener::_nil (), - 0); - } - - this->set_impl(reader.in ()); -} - -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::create_datareader ( - ::DDS::Topic_ptr topic, - ::DDS::Subscriber_ptr subscriber, - const char * library_name, - const char * profile_name) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::create_datareader"); + template <typename DDS_TYPE> + void + DataReader_T<DDS_TYPE>::passivate () + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::passivate"); - ::DDS::DataReader_var reader; + ::DDS::ReturnCode_t const retcode = this->set_listener ( + ::DDS::DataReaderListener::_nil (), + 0); + if (retcode != ::DDS::RETCODE_OK) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DataReader_T::passivate - " + "Error while setting the listener on the data reader - <%C>\n", + ::CIAO::DDS4CCM::translate_retcode (retcode))); + throw ::CORBA::INTERNAL (); + } + } - if (library_name && profile_name) + template <typename DDS_TYPE> + void + DataReader_T<DDS_TYPE>::create_datareader ( + ::DDS::ContentFilteredTopic_ptr topic, + ::DDS::Subscriber_ptr subscriber, + const char * library_name, + const char * profile_name) { - reader = subscriber->create_datareader_with_profile ( - topic, - library_name, - profile_name, - ::DDS::DataReaderListener::_nil (), - 0); + DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::create_datareader"); + + ::DDS::DataReader_var reader; + if (library_name && profile_name) + { + reader = subscriber->create_datareader_with_profile ( + topic, + library_name, + profile_name, + ::DDS::DataReaderListener::_nil (), + 0); + } + else + { + ::DDS::DataReaderQos drqos; + reader = subscriber->create_datareader ( + topic, + drqos, + ::DDS::DataReaderListener::_nil (), + 0); + } + typedef DataReader_T<DDS_TYPE> DataReader_type; + DataReader_type * dds_dr = dynamic_cast < DataReader_type * > (reader.in ()); + if (dds_dr) + { + this->set_rti_entity (dds_dr->get_rti_entity (), this->dp_.in ()); + } } - else + + template <typename DDS_TYPE> + void + DataReader_T<DDS_TYPE>::create_datareader ( + ::DDS::Topic_ptr topic, + ::DDS::Subscriber_ptr subscriber, + const char * library_name, + const char * profile_name) { - ::DDS::DataReaderQos drqos; - reader = subscriber->create_datareader ( - topic, - drqos, - ::DDS::DataReaderListener::_nil (), - 0); - } + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::create_datareader"); - this->set_impl (reader.in ()); -} + ::DDS::DataReader_var reader; -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::delete_datareader ( - ::DDS::Subscriber_ptr subscriber) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::delete_datareader"); + if (library_name && profile_name) + { + reader = subscriber->create_datareader_with_profile ( + topic, + library_name, + profile_name, + ::DDS::DataReaderListener::_nil (), + 0); + } + else + { + ::DDS::DataReaderQos drqos; + reader = subscriber->create_datareader ( + topic, + drqos, + ::DDS::DataReaderListener::_nil (), + 0); + } - ::DDS::ReturnCode_t const retval = subscriber->delete_datareader (this); - if (retval != ::DDS::RETCODE_OK) - { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - ACE_TEXT ("DataReader_T::delete_datareader - ") - ACE_TEXT ("Unable to delete DataReader: <%C>\n"), - translate_retcode (retval))); - throw ::CORBA::INTERNAL (); + typedef DataReader_T<DDS_TYPE> DataReader_type; + DataReader_type * dds_dr = dynamic_cast < DataReader_type * > (reader.in ()); + if (dds_dr) + { + this->set_rti_entity (dds_dr->get_rti_entity (), this->dp_.in ()); + } } - this->impl_ = 0; -} -template <typename DDS_TYPE> -typename DDS_TYPE::datareader_type * -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::impl (void) -{ - if (this->impl_) + template <typename DDS_TYPE> + void + DataReader_T<DDS_TYPE>::delete_datareader ( + ::DDS::Subscriber_ptr subscriber) { - return this->impl_; + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::delete_datareader"); + + ::DDS::ReturnCode_t const retval = subscriber->delete_datareader (this); + if (retval != ::DDS::RETCODE_OK) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + ACE_TEXT ("DataReader_T::delete_datareader - ") + ACE_TEXT ("Unable to delete DataReader: <%C>\n"), + ::CIAO::DDS4CCM::translate_retcode (retval))); + throw ::CORBA::INTERNAL (); + } + this->rti_entity_ = 0; } - else + + template <typename DDS_TYPE> + typename DDS_TYPE::datareader_type * + DataReader_T<DDS_TYPE>::rti_entity (void) { - throw ::CORBA::BAD_INV_ORDER (); + if (this->rti_entity_) + { + return this->rti_entity_; + } + else + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DataReader_T<DDS_TYPE>::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); + throw ::CORBA::BAD_INV_ORDER (); + } } -} -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::enable (void) -{ - return this->impl ()->enable (); -} - -template <typename DDS_TYPE> -::DDS::StatusCondition_ptr -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_statuscondition (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_statuscondition"); - - ::DDS::StatusCondition_var retval; - DDSStatusCondition* sc = this->impl ()->get_statuscondition (); - if (sc) + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::enable (void) { - ACE_NEW_THROW_EX (retval, - DDS_StatusCondition_i (sc), - ::CORBA::NO_MEMORY ()); + return this->rti_entity ()->enable (); } - return retval._retn (); -} -template <typename DDS_TYPE> -::DDS::StatusMask -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_status_changes (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_status_changes"); - - return this->impl ()->get_status_changes (); -} + template <typename DDS_TYPE> + ::DDS::StatusCondition_ptr + DataReader_T<DDS_TYPE>::get_statuscondition (void) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_statuscondition"); -template <typename DDS_TYPE> -DDS_INSTANCE_HANDLE_T_RETN -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_instance_handle (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_instance_handle"); - - ::DDS_InstanceHandle_t const rtihandle = - this->impl ()->get_instance_handle (); - ::DDS::InstanceHandle_t handle; - handle <<= rtihandle; - return handle; -} - -template <typename DDS_TYPE> -::DDS::ReadCondition_ptr -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::create_readcondition ( - ::DDS::SampleStateMask sample_states, - ::DDS::ViewStateMask view_states, - ::DDS::InstanceStateMask instance_states) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::create_readcondition"); + ::DDS::StatusCondition_var retval; + DDSStatusCondition* sc = this->rti_entity ()->get_statuscondition (); + if (sc) + { + ACE_NEW_THROW_EX (retval, + DDS_StatusCondition_i (sc, this->dp_.in ()), + ::CORBA::NO_MEMORY ()); + } + return retval._retn (); + } - ::DDS::ReadCondition_var retval; - DDSReadCondition* rc = - this->impl ()->create_readcondition (sample_states, - view_states, - instance_states); - if (rc) + template <typename DDS_TYPE> + ::DDS::StatusMask + DataReader_T<DDS_TYPE>::get_status_changes (void) { - ACE_NEW_THROW_EX (retval, - ReadCondition_type (rc), - ::CORBA::NO_MEMORY ()); - } - return retval._retn (); -} - -template <typename DDS_TYPE> -::DDS::QueryCondition_ptr -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::create_querycondition ( - ::DDS::SampleStateMask sample_states, - ::DDS::ViewStateMask view_states, - ::DDS::InstanceStateMask instance_states, - const char * query_expression, - const ::DDS::StringSeq & query_parameters) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::create_querycondition"); - - ::DDS::QueryCondition_var retval; - DDS_StringSeq parameters; - parameters <<= query_parameters; - DDSQueryCondition* qc = this->impl ()->create_querycondition ( - sample_states, - view_states, - instance_states, - query_expression, - parameters); - - if (qc) - { - ACE_NEW_THROW_EX (retval, - QueryCondition_type (qc), - ::CORBA::NO_MEMORY ()); + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_status_changes"); + + return this->rti_entity ()->get_status_changes (); } - return retval._retn (); -} -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::delete_readcondition ( - ::DDS::ReadCondition_ptr a_condition) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::delete_readcondition"); + template <typename DDS_TYPE> + DDS_INSTANCE_HANDLE_T_RETN + DataReader_T<DDS_TYPE>::get_instance_handle (void) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_instance_handle"); - DDSReadCondition * dds_rc = 0; - ReadCondition_type * rc = dynamic_cast< ReadCondition_type *> (a_condition); - QueryCondition_type * qc = dynamic_cast< QueryCondition_type *> (a_condition); + ::DDS_InstanceHandle_t const rtihandle = + this->rti_entity ()->get_instance_handle (); + ::DDS::InstanceHandle_t handle; + handle <<= rtihandle; + return handle; + } - if (!rc) + template <typename DDS_TYPE> + ::DDS::ReadCondition_ptr + DataReader_T<DDS_TYPE>::create_readcondition ( + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) { - if (!qc) - { - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_DEBUG, DDS4CCM_INFO - ACE_TEXT ("DataReader_T::delete_readcondition - ") - ACE_TEXT ("Unable to cast provided condition to a typed ") - ACE_TEXT ("read condition nor a typed query condition\n"))); - return ::DDS::RETCODE_BAD_PARAMETER; - } - dds_rc = dynamic_cast < DDSQueryCondition *> (qc->get_impl ()); - if (!dds_rc) + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::create_readcondition"); + + ::DDS::ReadCondition_var retval; + DDSReadCondition* rc = + this->rti_entity ()->create_readcondition (sample_states, + view_states, + instance_states); + if (rc) { - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_DEBUG, DDS4CCM_INFO - ACE_TEXT ("DataReader_T::delete_readcondition - ") - ACE_TEXT ("Unable to cast DDSQueryCondition to a ") - ACE_TEXT ("DDSReadCondition\n"))); - return ::DDS::RETCODE_BAD_PARAMETER; + ACE_NEW_THROW_EX (retval, + DDS_ReadCondition_i (rc, this), + ::CORBA::NO_MEMORY ()); } + return retval._retn (); } - else + + template <typename DDS_TYPE> + ::DDS::QueryCondition_ptr + DataReader_T<DDS_TYPE>::create_querycondition ( + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states, + const char * query_expression, + const ::DDS::StringSeq & query_parameters) { - dds_rc = rc->get_impl (); + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::create_querycondition"); + + ::DDS::QueryCondition_var retval; + DDS_StringSeq parameters; + parameters <<= query_parameters; + DDSQueryCondition* qc = this->rti_entity ()->create_querycondition ( + sample_states, + view_states, + instance_states, + query_expression, + parameters); + + if (qc) + { + ACE_NEW_THROW_EX (retval, + DDS_QueryCondition_i (qc, this), + ::CORBA::NO_MEMORY ()); + } + return retval._retn (); } - ::DDS::ReturnCode_t retcode = this->impl ()->delete_readcondition (dds_rc); - if (retcode == ::DDS::RETCODE_OK) + + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::delete_readcondition ( + ::DDS::ReadCondition_ptr a_condition) { - if (rc) + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::delete_readcondition"); + + ::DDSReadCondition * dds_rc = 0; + DDS_ReadCondition_i * rc = dynamic_cast< DDS_ReadCondition_i *> (a_condition); + DDS_QueryCondition_i * qc = dynamic_cast< DDS_QueryCondition_i *> (a_condition); + + if (!rc) { - rc->set_impl (0); + if (!qc) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_DEBUG, DDS4CCM_INFO + ACE_TEXT ("DataReader_T::delete_readcondition - ") + ACE_TEXT ("Unable to cast provided condition to a typed ") + ACE_TEXT ("read condition nor a typed query condition\n"))); + return ::DDS::RETCODE_BAD_PARAMETER; + } + dds_rc = dynamic_cast < ::DDSReadCondition *> (qc->get_rti_entity ()); + if (!dds_rc) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_DEBUG, DDS4CCM_INFO + ACE_TEXT ("DataReader_T::delete_readcondition - ") + ACE_TEXT ("Unable to cast DDSQueryCondition to a ") + ACE_TEXT ("DDSReadCondition\n"))); + return ::DDS::RETCODE_BAD_PARAMETER; + } } - if (qc) + else { - qc->set_impl (0); + dds_rc = rc->get_rti_entity (); } + ::DDS::ReturnCode_t retcode = this->rti_entity ()->delete_readcondition (dds_rc); + if (retcode == ::DDS::RETCODE_OK) + { + if (rc) + { + rc->set_rti_entity (0); + } + if (qc) + { + qc->set_rti_entity (0); + } + } + return retcode; } - return retcode; -} -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::delete_contained_entities (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::delete_contained_entities"); + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::delete_contained_entities (void) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::delete_contained_entities"); - return this->impl ()->delete_contained_entities (); -} + return this->rti_entity ()->delete_contained_entities (); + } -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::set_qos ( - const ::DDS::DataReaderQos &qos) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::set_qos"); + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::set_qos ( + const ::DDS::DataReaderQos &qos) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::set_qos"); - ::DDS_DataReaderQos ddsqos; - ddsqos <<= qos; - return this->impl ()->set_qos (ddsqos); -} + ::DDS_DataReaderQos ddsqos; + ddsqos <<= qos; + return this->rti_entity ()->set_qos (ddsqos); + } -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_qos ( - ::DDS::DataReaderQos &qos) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_qos"); - - ::DDS_DataReaderQos ddsqos; - ::DDS_ReturnCode_t const retval = this->impl ()->get_qos (ddsqos); - qos <<= ddsqos; - return retval; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::set_listener ( - ::DDS::DataReaderListener_ptr a_listener, - ::DDS::StatusMask mask) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::set_listener"); + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::get_qos ( + ::DDS::DataReaderQos &qos) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_qos"); - // Delete the previously set listener - DDSDataReaderListener *listener = this->impl ()->get_listener (); - delete listener; + ::DDS_DataReaderQos ddsqos; + ::DDS_ReturnCode_t const retval = this->rti_entity ()->get_qos (ddsqos); + qos <<= ddsqos; + return retval; + } - DataReaderListener_type * ccm_dds_drl = 0; - if (! ::CORBA::is_nil (a_listener)) + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::set_listener ( + ::DDS::DataReaderListener_ptr a_listener, + ::DDS::StatusMask mask) { - ACE_NEW_THROW_EX (ccm_dds_drl, - DataReaderListener_type ( - a_listener, - this), - ::CORBA::NO_MEMORY ()); - } - this->lst_mask_ = mask; - return this->impl ()->set_listener (ccm_dds_drl, mask); -} + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T<DDS_TYPE>::set_listener"); -template <typename DDS_TYPE> -::DDS::DataReaderListener_ptr -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_listener (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_listener"); + // Delete the previously set listener + DDSDataReaderListener *listener = this->rti_entity ()->get_listener (); + delete listener; + listener = 0; - DDSDataReaderListener *drl = this->impl ()->get_listener (); - DDS_DataReaderListener_T<DDS_TYPE> *ccm_dds_drl = - dynamic_cast <DDS_DataReaderListener_T<DDS_TYPE> *> (drl); - if (!ccm_dds_drl) - { - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, "DataReader_T" - "::get_listener - " - "DDS returned a NIL listener.\n")); - return ::DDS::DataReaderListener::_nil (); + if (! ::CORBA::is_nil (listener)) + { + ACE_NEW_THROW_EX (listener, + DDS_DataReaderListener_i ( + a_listener, + this), + ::CORBA::NO_MEMORY ()); + } + this->lst_mask_ = mask; + return this->rti_entity ()->set_listener (listener, mask); } - return ccm_dds_drl->get_datareaderlistener (); -} - -template <typename DDS_TYPE> -::DDS::TopicDescription_ptr -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_topicdescription (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_topicdescription"); - ::DDS::TopicDescription_var dds_td; - DDSTopicDescription* td = this->impl ()->get_topicdescription (); - DDSTopic * tp = 0; - if (td) + template <typename DDS_TYPE> + ::DDS::DataReaderListener_ptr + DataReader_T<DDS_TYPE>::get_listener (void) { - tp = DDSTopic::narrow (td); + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T<DDS_TYPE>::get_listener"); - if (tp) + DDSDataReaderListener *drl = this->rti_entity ()->get_listener (); + DDS_DataReaderListener_i *ccm_dds_drl = + dynamic_cast <DDS_DataReaderListener_i *> (drl); + if (!ccm_dds_drl) { - ACE_NEW_THROW_EX (dds_td, - Topic_type (tp), - ::CORBA::NO_MEMORY ()); + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, "DataReader_T" + "::get_listener - " + "DDS returned a NIL listener.\n")); + return ::DDS::DataReaderListener::_nil (); } - else + return ccm_dds_drl->get_datareaderlistener (); + } + + template <typename DDS_TYPE> + ::DDS::TopicDescription_ptr + DataReader_T<DDS_TYPE>::get_topicdescription (void) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_topicdescription"); + + ::DDS::TopicDescription_var dds_td; + DDSTopicDescription* td = this->rti_entity ()->get_topicdescription (); + DDSTopic * tp = 0; + if (td) { - ::DDSContentFilteredTopic * cft = - DDSContentFilteredTopic::narrow (td); - if (cft) + tp = DDSTopic::narrow (td); + + if (tp) { ACE_NEW_THROW_EX (dds_td, - ContentFilteredTopic_type (cft), + DDS_Topic_i (tp, this->dp_.in ()), ::CORBA::NO_MEMORY ()); } + else + { + ::DDSContentFilteredTopic * cft = + DDSContentFilteredTopic::narrow (td); + if (cft) + { + ACE_NEW_THROW_EX (dds_td, + DDS_ContentFilteredTopic_i (cft, this->dp_.in ()), + ::CORBA::NO_MEMORY ()); + } + } } + return dds_td._retn (); } - return dds_td._retn (); -} -template <typename DDS_TYPE> -::DDS::Subscriber_ptr -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_subscriber (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_subscriber"); - -/* ::DDS::Subscriber_var dds_td; - ::DDSSubscriber* subscriber = this->impl ()->get_subscriber (); - ACE_NEW_THROW_EX (dds_td, - Subscriber_type (subscriber), - ::CORBA::NO_MEMORY ()); - return dds_td._retn ();*/ - return 0; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_sample_rejected_status ( - ::DDS::SampleRejectedStatus & status) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_sample_rejected_status"); - - DDS_SampleRejectedStatus ddsstatus; - ::DDS::ReturnCode_t const retval = this->impl ()->get_sample_rejected_status (ddsstatus); - status <<= ddsstatus; - return retval; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_liveliness_changed_status ( - ::DDS::LivelinessChangedStatus & status) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_liveliness_changed_status"); - - DDS_LivelinessChangedStatus ddsstatus; - ::DDS::ReturnCode_t const retval = this->impl ()->get_liveliness_changed_status (ddsstatus); - status <<= ddsstatus; - return retval; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_requested_deadline_missed_status ( - ::DDS::RequestedDeadlineMissedStatus & status) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_requested_deadline_missed_status"); - - DDS_RequestedDeadlineMissedStatus ddsstatus; - ::DDS::ReturnCode_t const retval = this->impl ()->get_requested_deadline_missed_status (ddsstatus); - status <<= ddsstatus; - return retval; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_requested_incompatible_qos_status ( - ::DDS::RequestedIncompatibleQosStatus & status) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_requested_incompatible_qos_status"); - - DDS_RequestedIncompatibleQosStatus ddsstatus; - ::DDS::ReturnCode_t const retval = - this->impl ()->get_requested_incompatible_qos_status (ddsstatus); - status <<= ddsstatus; - return retval; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_subscription_matched_status ( - ::DDS::SubscriptionMatchedStatus & status) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_subscription_matched_status"); - - ::DDS_SubscriptionMatchedStatus ddsstatus; - ::DDS::ReturnCode_t const retval = this->impl ()->get_subscription_matched_status (ddsstatus); - status <<= ddsstatus; - return retval; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_sample_lost_status ( - ::DDS::SampleLostStatus & status) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_sample_lost_status"); - - DDS_SampleLostStatus ddsstatus; - ::DDS::ReturnCode_t const retval = this->impl ()->get_sample_lost_status (ddsstatus); - status <<= ddsstatus; - return retval; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::wait_for_historical_data ( - const ::DDS::Duration_t & max_wait) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::wait_for_historical_data"); + template <typename DDS_TYPE> + ::DDS::Subscriber_ptr + DataReader_T<DDS_TYPE>::get_subscriber (void) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_subscriber"); - ::DDS_Duration_t rtiduration; - rtiduration <<= max_wait; - return this->impl ()->wait_for_historical_data (rtiduration); -} + /* ::DDS::Subscriber_var dds_td; + ::DDSSubscriber* subscriber = this->rti_entity ()->get_subscriber (); + ACE_NEW_THROW_EX (dds_td, + Subscriber_type (subscriber), + ::CORBA::NO_MEMORY ()); + return dds_td._retn ();*/ + return 0; + } -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_matched_publications ( - ::DDS::InstanceHandleSeq & publication_handles) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_matched_publications"); - - ::DDS_InstanceHandleSeq rtiseq; - ::DDS::ReturnCode_t const retval = this->impl ()->get_matched_publications (rtiseq); - publication_handles <<= rtiseq; - return retval; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_matched_publication_data ( - ::DDS::PublicationBuiltinTopicData & publication_data, - DDS_INSTANCE_HANDLE_T_IN publication_handle) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_matched_publication_data"); - - ::DDS_PublicationBuiltinTopicData ccm_dds_pub_data; - ::DDS_InstanceHandle_t ccm_dds_pub_handle; - - ccm_dds_pub_data <<= publication_data; - ccm_dds_pub_handle <<= publication_handle; - ::DDS::ReturnCode_t const retcode = this->impl()-> - get_matched_publication_data (ccm_dds_pub_data, - ccm_dds_pub_handle); - publication_data <<= ccm_dds_pub_data; - return retcode; -} - -template <typename DDS_TYPE> -::DDS::StatusMask -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_mask (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::get_mask"); + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::get_sample_rejected_status ( + ::DDS::SampleRejectedStatus & status) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_sample_rejected_status"); + + DDS_SampleRejectedStatus ddsstatus; + ::DDS::ReturnCode_t const retval = this->rti_entity ()->get_sample_rejected_status (ddsstatus); + status <<= ddsstatus; + return retval; + } - return this->lst_mask_; -} + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::get_liveliness_changed_status ( + ::DDS::LivelinessChangedStatus & status) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_liveliness_changed_status"); -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::set_impl ( - ::DDS::DataReader_ptr dr) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DataReader_T::set_impl"); + DDS_LivelinessChangedStatus ddsstatus; + ::DDS::ReturnCode_t const retval = this->rti_entity ()->get_liveliness_changed_status (ddsstatus); + status <<= ddsstatus; + return retval; + } - DataReader_type * dds_dr = dynamic_cast < DataReader_type * > (dr); - if (dds_dr) + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::get_requested_deadline_missed_status ( + ::DDS::RequestedDeadlineMissedStatus & status) { - this->impl_ = DDS_TYPE::datareader_type::narrow (dds_dr->get_impl ()); - if (!this->impl_) - { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DataReader_T::set_impl - " - "Failed to cast DDS::DataReader to DataReader_T\n")); - } + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_requested_deadline_missed_status"); + + DDS_RequestedDeadlineMissedStatus ddsstatus; + ::DDS::ReturnCode_t const retval = this->rti_entity ()->get_requested_deadline_missed_status (ddsstatus); + status <<= ddsstatus; + return retval; } - else + + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::get_requested_incompatible_qos_status ( + ::DDS::RequestedIncompatibleQosStatus & status) { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DataReader_T::set_impl - " - "Failed to cast DDS::DataReader to DataReader_T\n")); - throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0); + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_requested_incompatible_qos_status"); + + DDS_RequestedIncompatibleQosStatus ddsstatus; + ::DDS::ReturnCode_t const retval = + this->rti_entity ()->get_requested_incompatible_qos_status (ddsstatus); + status <<= ddsstatus; + return retval; } -} -template <typename DDS_TYPE> -DDSDataReader * -CIAO::DDS4CCM::DataReader_T<DDS_TYPE>::get_impl (void) -{ - return this->impl_; -} + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::get_subscription_matched_status ( + ::DDS::SubscriptionMatchedStatus & status) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_subscription_matched_status"); + + ::DDS_SubscriptionMatchedStatus ddsstatus; + ::DDS::ReturnCode_t const retval = this->rti_entity ()->get_subscription_matched_status (ddsstatus); + status <<= ddsstatus; + return retval; + } + + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::get_sample_lost_status ( + ::DDS::SampleLostStatus & status) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_sample_lost_status"); + + DDS_SampleLostStatus ddsstatus; + ::DDS::ReturnCode_t const retval = this->rti_entity ()->get_sample_lost_status (ddsstatus); + status <<= ddsstatus; + return retval; + } + + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::wait_for_historical_data ( + const ::DDS::Duration_t & max_wait) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::wait_for_historical_data"); + + ::DDS_Duration_t rtiduration; + rtiduration <<= max_wait; + return this->rti_entity ()->wait_for_historical_data (rtiduration); + } + + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::get_matched_publications ( + ::DDS::InstanceHandleSeq & publication_handles) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T<DDS_TYPE>::get_matched_publications"); + + ::DDS_InstanceHandleSeq rtiseq; + ::DDS::ReturnCode_t const retval = this->rti_entity ()->get_matched_publications (rtiseq); + publication_handles <<= rtiseq; + return retval; + } + + template <typename DDS_TYPE> + ::DDS::ReturnCode_t + DataReader_T<DDS_TYPE>::get_matched_publication_data ( + ::DDS::PublicationBuiltinTopicData & publication_data, + DDS_INSTANCE_HANDLE_T_IN publication_handle) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_matched_publication_data"); + + ::DDS_PublicationBuiltinTopicData ccm_dds_pub_data; + ::DDS_InstanceHandle_t ccm_dds_pub_handle; + + ccm_dds_pub_data <<= publication_data; + ccm_dds_pub_handle <<= publication_handle; + ::DDS::ReturnCode_t const retcode = this->rti_entity ()-> + get_matched_publication_data (ccm_dds_pub_data, + ccm_dds_pub_handle); + publication_data <<= ccm_dds_pub_data; + return retcode; + } + + template <typename DDS_TYPE> + ::DDS::StatusMask + DataReader_T<DDS_TYPE>::get_mask (void) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::get_mask"); + + return this->lst_mask_; + } + + template <typename DDS_TYPE> + void + DataReader_T<DDS_TYPE>::set_rti_entity ( + ::DDSDataReader* dr, ::DDS::DomainParticipant_ptr dp) + { + DDS4CCM_TRACE ("CIAO::NDDS::DataReader_T::set_impl"); + + this->rti_entity_ = DDS_TYPE::datareader_type::narrow (dr); + this->dp_ = ::DDS::DomainParticipant::_duplicate (dp); + } + + template <typename DDS_TYPE> + ::DDSDataReader* + DataReader_T<DDS_TYPE>::get_rti_entity (void) + { + return this->rti_entity_; + } + } +}
\ No newline at end of file diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataReader_T.h b/CIAO/connectors/dds4ccm/impl/ndds/DataReader_T.h index 9fcbd0fcbd0..6d538fe35fa 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataReader_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataReader_T.h @@ -17,40 +17,16 @@ namespace CIAO { - namespace DDS4CCM + namespace NDDS { template <typename DDS_TYPE> - class DDS_Topic_T; - - template <typename DDS_TYPE> - class DDS_Subscriber_T; - - template <typename DDS_TYPE> - class DDS_ReadCondition_T; - - template <typename DDS_TYPE> - class DDS_QueryCondition_T; - - template <typename DDS_TYPE> - class DDS_ContentFilteredTopic_T; - - template <typename DDS_TYPE> - class DDS_DataReaderListener_T; - - template <typename DDS_TYPE> class DataReader_T : public virtual DDS_DataReader_Base { - typedef DDS_DataReaderListener_T<DDS_TYPE> DataReaderListener_type; - typedef DDS_Topic_T<DDS_TYPE> Topic_type; - typedef DDS_ReadCondition_T<DDS_TYPE> ReadCondition_type; - typedef DDS_QueryCondition_T<DDS_TYPE> QueryCondition_type; - typedef DDS_ContentFilteredTopic_T<DDS_TYPE> ContentFilteredTopic_type; - typedef DDS_Subscriber_T<DDS_TYPE> Subscriber_type; - typedef DataReader_T<DDS_TYPE> DataReader_type; public: /// Constructor - explicit DataReader_T (DDSDataReader * dr = 0); + explicit DataReader_T (::DDSDataReader * dr = 0, + ::DDS::DomainParticipant_ptr dp = ::DDS::DomainParticipant::_nil ()); // @todo /// Destructor virtual ~DataReader_T (void); @@ -184,18 +160,18 @@ namespace CIAO ::DDS::PublicationBuiltinTopicData & publication_data, DDS_INSTANCE_HANDLE_T_IN publication_handle); - void set_impl (::DDS::DataReader_ptr dr); + void set_rti_entity (::DDSDataReader* dr, ::DDS::DomainParticipant_ptr dp); ::DDS::StatusMask get_mask (void); - virtual DDSDataReader * get_impl (void); + ::DDSDataReader * get_rti_entity (void); private: - typename DDS_TYPE::datareader_type * impl_; - + typename DDS_TYPE::datareader_type * rti_entity_; + ::DDS::DomainParticipant_var dp_; ::DDS::StatusMask lst_mask_; - typename DDS_TYPE::datareader_type * impl (void); + typename DDS_TYPE::datareader_type * rti_entity (void); void log_query_condition (DDSQueryCondition * qc); }; diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataWriter.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DataWriter.cpp index f6cc7b0918a..288fa1b44d4 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataWriter.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataWriter.cpp @@ -1,39 +1,15 @@ // $Id$ +#include "ndds/ndds_cpp.h" #include "DataWriter.h" - #include "dds4ccm/impl/logger/Log_Macros.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { - DDS_DataWriter_Base::DDS_DataWriter_Base (DDSDataWriter * dw) - : impl_ (dw) - { - } - - DDSDataWriter * - DDS_DataWriter_Base::get_impl (void) - { - return this->impl_; - } - - void - DDS_DataWriter_Base::set_impl (DDSDataWriter * dw) - { - // Set a pointer to this class for the listener to use. - this->impl_ = dw; - } - - DDSDataWriter * - DDS_DataWriter_Base::impl (void) + DDS_DataWriter_Base::DDS_DataWriter_Base (void) { - if (!this->impl_) - { - throw ::CORBA::BAD_INV_ORDER (); - } - return this->impl_; } } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataWriter.h b/CIAO/connectors/dds4ccm/impl/ndds/DataWriter.h index 0fd06bf3ece..2439eb3dec8 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataWriter.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataWriter.h @@ -15,11 +15,11 @@ #include "tao/LocalObject.h" -#include "ndds/ndds_cpp.h" +class DDSDataWriter; namespace CIAO { - namespace DDS4CCM + namespace NDDS { class DDS4CCM_NDDS_Export DDS_DataWriter_Base : public virtual ::DDS::DataWriter, @@ -27,18 +27,12 @@ namespace CIAO { public: /// Constructor - explicit DDS_DataWriter_Base (DDSDataWriter * dw); + explicit DDS_DataWriter_Base (void); - DDSDataWriter * get_impl (void); + virtual ::DDSDataWriter * get_rti_entity (void) = 0; // @todo, this should be private to my idea - virtual void set_impl (DDSDataWriter * dw); - - protected: - DDSDataWriter * impl (void); - - private: - DDSDataWriter * impl_; + virtual void set_rti_entity (::DDSDataWriter * dw) = 0; }; } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataWriterListener.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DataWriterListener.cpp new file mode 100644 index 00000000000..ed3962b16d2 --- /dev/null +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataWriterListener.cpp @@ -0,0 +1,85 @@ +// $Id$ + +#include "dds4ccm/impl/ndds/DataWriterListener.h" +#include "dds4ccm/impl/ndds/convertors/PublicationMatchedStatus.h" +#include "dds4ccm/impl/ndds/convertors/LivelinessLostStatus.h" +#include "dds4ccm/impl/ndds/convertors/OfferedIncompatibleQosStatus.h" +#include "dds4ccm/impl/ndds/convertors/OfferedDeadlineMissedStatus.h" +#include "dds4ccm/impl/logger/Log_Macros.h" + +namespace CIAO +{ + namespace NDDS + { + + DDS_DataWriterListener_i::DDS_DataWriterListener_i ( + ::DDS::DataWriterListener_ptr s, + ::DDS::DataWriter_ptr dw) + : impl_ (::DDS::DataWriterListener::_duplicate (s)), + dw_ (::DDS::DataWriter::_duplicate (dw)) + { + } + + DDS_DataWriterListener_i::~DDS_DataWriterListener_i (void) + { + } + + void + DDS_DataWriterListener_i::on_offered_deadline_missed ( + ::DDSDataWriter *, + const ::DDS_OfferedDeadlineMissedStatus & status) + { + DDS4CCM_TRACE ("DDS_DataWriterListener_i::on_offered_deadline_missed"); + ::DDS::OfferedDeadlineMissedStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_offered_deadline_missed (this->dw_, ddsstatus); + } + + + void + DDS_DataWriterListener_i::on_offered_incompatible_qos ( + ::DDSDataWriter *, + const ::DDS_OfferedIncompatibleQosStatus & status) + { + DDS4CCM_TRACE ("DDS_DataWriterListener_i::on_offered_incompatible_qos"); + ::DDS::OfferedIncompatibleQosStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_offered_incompatible_qos (this->dw_, ddsstatus); + } + + void + DDS_DataWriterListener_i::on_liveliness_lost ( + ::DDSDataWriter *, + const ::DDS_LivelinessLostStatus & status) + { + DDS4CCM_TRACE ("DDS_DataWriterListener_i::on_liveliness_lost"); + ::DDS::LivelinessLostStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_liveliness_lost (this->dw_, ddsstatus); + } + + void + DDS_DataWriterListener_i::on_publication_matched ( + ::DDSDataWriter *, + const ::DDS_PublicationMatchedStatus & status) + { + DDS4CCM_TRACE ("DDS_DataWriterListener_i::on_publication_matched"); + ::DDS::PublicationMatchedStatus ddsstatus; + ddsstatus <<= status; + this->impl_->on_publication_matched (this->dw_, ddsstatus); + } + + ::DDS::DataWriterListener_ptr + DDS_DataWriterListener_i::get_datawriterlistener (void) + { + return ::DDS::DataWriterListener::_duplicate (this->impl_.in ()); + } + + void + DDS_DataWriterListener_i::set_dds_entity (::DDS::DataWriter_ptr dw) + { + this->dw_ = ::DDS::DataWriter::_duplicate (dw); + } + } +} + diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSDataWriterListener_T.h b/CIAO/connectors/dds4ccm/impl/ndds/DataWriterListener.h index 42fc57d630b..021fb75bbc7 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSDataWriterListener_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataWriterListener.h @@ -10,27 +10,24 @@ #ifndef DDSDATAWRITERLISTENER_T_H_ #define DDSDATAWRITERLISTENER_T_H_ +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "dds4ccm/idl/dds_rtf2_dcpsC.h" +#include "ndds/ndds_cpp.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_DataWriter_T; - - template <typename DDS_TYPE> - class DDS_DataWriterListener_T : - public virtual ::DDSDataWriterListener + class DDS4CCM_NDDS_Export DDS_DataWriterListener_i : + public ::DDSDataWriterListener { - typedef DDS_DataWriter_T<DDS_TYPE> DataWriter_type; public: /// Constructor - DDS_DataWriterListener_T (::DDS::DataWriterListener_ptr p, - DataWriter_type * typed_dw); + DDS_DataWriterListener_i (::DDS::DataWriterListener_ptr p, + ::DDS::DataWriter_ptr dw); /// Destructor - virtual ~DDS_DataWriterListener_T (void); + virtual ~DDS_DataWriterListener_i (void); virtual void on_offered_deadline_missed ( ::DDSDataWriter *the_writer, @@ -49,13 +46,14 @@ namespace CIAO const ::DDS_PublicationMatchedStatus & status); ::DDS::DataWriterListener_ptr get_datawriterlistener (void); + + void set_dds_entity (::DDS::DataWriter_ptr dw); + private: ::DDS::DataWriterListener_var impl_; - DataWriter_type * typed_dw_; + ::DDS::DataWriter_var dw_; }; } } -#include "dds4ccm/impl/ndds/DDSDataWriterListener_T.cpp" - #endif /* DDSDATAWRITERLISTENER_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataWriter_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DataWriter_T.cpp index 23860b8981d..bc228b73df5 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataWriter_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataWriter_T.cpp @@ -1,11 +1,10 @@ // $Id$ -#include "dds4ccm/impl/ndds/DataWriter_T.h" #include "dds4ccm/impl/ndds/DataWriter.h" #include "dds4ccm/impl/ndds/StatusCondition.h" -#include "dds4ccm/impl/ndds/Publisher_T.h" -#include "dds4ccm/impl/ndds/DDSDataWriterListener_T.h" -#include "dds4ccm/impl/ndds/Topic_T.h" +#include "dds4ccm/impl/ndds/Publisher.h" +#include "dds4ccm/impl/ndds/DataWriterListener.h" +#include "dds4ccm/impl/ndds/Topic.h" #include "dds4ccm/impl/ndds/convertors/Duration_t.h" #include "dds4ccm/impl/ndds/convertors/InstanceHandle_t.h" @@ -21,94 +20,74 @@ namespace CIAO { - namespace DDS4CCM + namespace NDDS { template <typename DDS_TYPE> - DDS_DataWriter_T<DDS_TYPE>::DDS_DataWriter_T (DDSDataWriter * dw) - : DDS_DataWriter_Base (dw), - writer_ (0) + DataWriter_T<DDS_TYPE>::DataWriter_T ( + ::DDSDataWriter * dw, + ::DDS::DomainParticipant_ptr dp) + : rti_entity_ (0), + dp_ (::DDS::DomainParticipant::_duplicate (dp)) { if (dw) { - this->writer_ = DDS_TYPE::datawriter_type::narrow (dw); + this->rti_entity_ = DDS_TYPE::datawriter_type::narrow (dw); } } template <typename DDS_TYPE> - void - DDS_DataWriter_T<DDS_TYPE>::set_impl (DDSDataWriter * dw) - { - if (dw) - { - this->writer_ = DDS_TYPE::datawriter_type::narrow (dw); - } - DDS_DataWriter_Base::set_impl (dw); - } - - template <typename DDS_TYPE> - typename DDS_TYPE::datawriter_type* - DDS_DataWriter_T<DDS_TYPE>::typed_impl (void) - { - if (!this->writer_) - { - throw ::CORBA::BAD_INV_ORDER (); - } - return this->writer_; - } - - template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::set_qos (const ::DDS::DataWriterQos & qos) + DataWriter_T<DDS_TYPE>::set_qos (const ::DDS::DataWriterQos & qos) { - DDS4CCM_TRACE ("DDS_DataWriter_T<DDS_TYPE>::set_qos"); + DDS4CCM_TRACE ("DataWriter_T<DDS_TYPE>::set_qos"); ::DDS_DataWriterQos ccm_dds_qos; ccm_dds_qos <<= qos; - return this->typed_impl()->set_qos (ccm_dds_qos); + return this->rti_entity ()->set_qos (ccm_dds_qos); } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::get_qos (::DDS::DataWriterQos & qos) + DataWriter_T<DDS_TYPE>::get_qos (::DDS::DataWriterQos & qos) { - DDS4CCM_TRACE ("DDS_DataWriter_T<DDS_TYPE>::get_qos"); + DDS4CCM_TRACE ("DataWriter_T<DDS_TYPE>::get_qos"); ::DDS_DataWriterQos ccm_dds_qos; ccm_dds_qos <<= qos; - ::DDS::ReturnCode_t retcode = this->typed_impl ()->get_qos (ccm_dds_qos); + ::DDS::ReturnCode_t retcode = this->rti_entity ()->get_qos (ccm_dds_qos); qos <<= ccm_dds_qos; return retcode; } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::set_listener ( + DataWriter_T<DDS_TYPE>::set_listener ( ::DDS::DataWriterListener_ptr a_listener, ::DDS::StatusMask mask) { // Delete the previously set listener - DDSDataWriterListener *listener = this->typed_impl ()->get_listener (); + DDSDataWriterListener *listener = this->rti_entity ()->get_listener (); delete listener; - DataWriterListener_type * ccm_dds_impl_list = 0; + DDS_DataWriterListener_i * ccm_dds_impl_list = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_impl_list, - DataWriterListener_type (a_listener, this), + DDS_DataWriterListener_i (a_listener, this), ::CORBA::NO_MEMORY ()); } - return this->typed_impl ()->set_listener (ccm_dds_impl_list, mask); + return this->rti_entity ()->set_listener (ccm_dds_impl_list, mask); } template <typename DDS_TYPE> ::DDS::DataWriterListener_ptr - DDS_DataWriter_T<DDS_TYPE>::get_listener (void) + DataWriter_T<DDS_TYPE>::get_listener (void) { - DDSDataWriterListener *wr = this->typed_impl ()->get_listener (); - DataWriterListener_type * list_proxy = - dynamic_cast <DataWriterListener_type *> (wr); + DDSDataWriterListener *wr = this->rti_entity ()->get_listener (); + DDS_DataWriterListener_i * list_proxy = + dynamic_cast <DDS_DataWriterListener_i *> (wr); if (!list_proxy) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, - "DDS_DataWriter_T<DDS_TYPE>::get_listener - " + "DataWriter_T<DDS_TYPE>::get_listener - " "DDS returned a NIL listener.\n")); return ::DDS::DataWriterListener::_nil (); } @@ -117,22 +96,22 @@ namespace CIAO template <typename DDS_TYPE> ::DDS::Topic_ptr - DDS_DataWriter_T<DDS_TYPE>::get_topic (void) + DataWriter_T<DDS_TYPE>::get_topic (void) { ::DDS::Topic_var retval; - DDSTopic* t = this->typed_impl ()->get_topic (); + DDSTopic* t = this->rti_entity ()->get_topic (); ACE_NEW_THROW_EX (retval, - Topic_type (t), + DDS_Topic_i (t, this->dp_.in ()), ::CORBA::NO_MEMORY ()); return retval._retn (); } template <typename DDS_TYPE> ::DDS::Publisher_ptr - DDS_DataWriter_T<DDS_TYPE>::get_publisher (void) + DataWriter_T<DDS_TYPE>::get_publisher (void) { /* ::DDS::Publisher_var retval; - DDSPublisher* p = this->typed_impl ()->get_publisher (); + DDSPublisher* p = this->rti_entity ()->get_publisher (); ACE_NEW_THROW_EX (retval, Publisher_type (p), ::CORBA::NO_MEMORY ());*/ @@ -142,132 +121,132 @@ return 0; template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::wait_for_acknowledgments (const ::DDS::Duration_t & max_wait) + DataWriter_T<DDS_TYPE>::wait_for_acknowledgments (const ::DDS::Duration_t & max_wait) { ::DDS_Duration_t rtiduration; rtiduration <<= max_wait; - return this->typed_impl ()->wait_for_acknowledgments (rtiduration); + return this->rti_entity ()->wait_for_acknowledgments (rtiduration); } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::get_liveliness_lost_status (::DDS::LivelinessLostStatus & status) + DataWriter_T<DDS_TYPE>::get_liveliness_lost_status (::DDS::LivelinessLostStatus & status) { ::DDS_LivelinessLostStatus ddsstatus; ddsstatus <<= status; ::DDS::ReturnCode_t const retval = - this->typed_impl ()->get_liveliness_lost_status (ddsstatus); + this->rti_entity ()->get_liveliness_lost_status (ddsstatus); status <<= ddsstatus; return retval; } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::get_offered_deadline_missed_status ( + DataWriter_T<DDS_TYPE>::get_offered_deadline_missed_status ( ::DDS::OfferedDeadlineMissedStatus & status) { ::DDS_OfferedDeadlineMissedStatus ddsstatus; ddsstatus <<= status; ::DDS::ReturnCode_t const retval = - this->typed_impl ()->get_offered_deadline_missed_status (ddsstatus); + this->rti_entity ()->get_offered_deadline_missed_status (ddsstatus); status <<= ddsstatus; return retval; } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::get_offered_incompatible_qos_status ( + DataWriter_T<DDS_TYPE>::get_offered_incompatible_qos_status ( ::DDS::OfferedIncompatibleQosStatus & status) { ::DDS_OfferedIncompatibleQosStatus ddsstatus; ddsstatus <<= status; ::DDS::ReturnCode_t const retval = - this->typed_impl ()->get_offered_incompatible_qos_status (ddsstatus); + this->rti_entity ()->get_offered_incompatible_qos_status (ddsstatus); status <<= ddsstatus; return retval; } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::get_publication_matched_status ( + DataWriter_T<DDS_TYPE>::get_publication_matched_status ( ::DDS::PublicationMatchedStatus & status) { ::DDS_PublicationMatchedStatus ddsstatus; ddsstatus <<= status; ::DDS::ReturnCode_t const retval = - this->typed_impl ()->get_publication_matched_status (ddsstatus); + this->rti_entity ()->get_publication_matched_status (ddsstatus); status <<= ddsstatus; return retval; } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::assert_liveliness (void) + DataWriter_T<DDS_TYPE>::assert_liveliness (void) { - return this->typed_impl ()->assert_liveliness (); + return this->rti_entity ()->assert_liveliness (); } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::get_matched_subscriptions ( + DataWriter_T<DDS_TYPE>::get_matched_subscriptions ( ::DDS::InstanceHandleSeq & subscription_handles) { ::DDS_InstanceHandleSeq rtiseq; rtiseq <<= subscription_handles; ::DDS::ReturnCode_t const retval = - this->typed_impl ()->get_matched_subscriptions (rtiseq); + this->rti_entity ()->get_matched_subscriptions (rtiseq); subscription_handles <<= rtiseq; return retval; } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::get_matched_subscription_data ( + DataWriter_T<DDS_TYPE>::get_matched_subscription_data ( ::DDS::SubscriptionBuiltinTopicData & subscription_data, DDS_INSTANCE_HANDLE_T_IN subscription_handle) { - DDS4CCM_TRACE ("DDS_DataWriter_T<DDS_TYPE>::get_matched_subscription_data"); + DDS4CCM_TRACE ("DataWriter_T<DDS_TYPE>::get_matched_subscription_data"); ::DDS_SubscriptionBuiltinTopicData ccm_dds_sub_data; ::DDS_InstanceHandle_t ccm_dds_sub_handle; ccm_dds_sub_handle <<= subscription_handle; ::DDS::ReturnCode_t const retval = - this->typed_impl ()->get_matched_subscription_data (ccm_dds_sub_data, ccm_dds_sub_handle); + this->rti_entity ()->get_matched_subscription_data (ccm_dds_sub_data, ccm_dds_sub_handle); subscription_data <<= ccm_dds_sub_data; return retval; } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::enable (void) + DataWriter_T<DDS_TYPE>::enable (void) { - return this->typed_impl ()->enable (); + return this->rti_entity ()->enable (); } template <typename DDS_TYPE> ::DDS::StatusCondition_ptr - DDS_DataWriter_T<DDS_TYPE>::get_statuscondition (void) + DataWriter_T<DDS_TYPE>::get_statuscondition (void) { ::DDS::StatusCondition_var retval; - DDSStatusCondition* sc = this->typed_impl ()->get_statuscondition (); + DDSStatusCondition* sc = this->rti_entity ()->get_statuscondition (); ACE_NEW_THROW_EX (retval, - DDS_StatusCondition_i (sc), + DDS_StatusCondition_i (sc, this->dp_.in ()), ::CORBA::NO_MEMORY ()); return retval._retn (); } template <typename DDS_TYPE> ::DDS::StatusMask - DDS_DataWriter_T<DDS_TYPE>::get_status_changes (void) + DataWriter_T<DDS_TYPE>::get_status_changes (void) { - return this->typed_impl ()->get_status_changes (); + return this->rti_entity ()->get_status_changes (); } template <typename DDS_TYPE> DDS_INSTANCE_HANDLE_T_RETN - DDS_DataWriter_T<DDS_TYPE>::get_instance_handle (void) + DataWriter_T<DDS_TYPE>::get_instance_handle (void) { ::DDS_InstanceHandle_t const rtihandle = - this->typed_impl ()->get_instance_handle (); + this->rti_entity ()->get_instance_handle (); ::DDS::InstanceHandle_t handle; handle <<= rtihandle; return handle; @@ -275,25 +254,25 @@ return 0; template <typename DDS_TYPE> ::DDS::InstanceHandle_t - DDS_DataWriter_T<DDS_TYPE>::register_instance ( + DataWriter_T<DDS_TYPE>::register_instance ( const typename DDS_TYPE::value_type& instance_data) { ::DDS::InstanceHandle_t dds_handle; - ::DDS_InstanceHandle_t const handle = this->typed_impl ()->register_instance (instance_data); + ::DDS_InstanceHandle_t const handle = this->rti_entity ()->register_instance (instance_data); dds_handle <<= handle; return dds_handle; } template <typename DDS_TYPE> ::DDS::InstanceHandle_t - DDS_DataWriter_T<DDS_TYPE>::register_instance_w_timestamp ( + DataWriter_T<DDS_TYPE>::register_instance_w_timestamp ( const typename DDS_TYPE::value_type & instance_data, const ::DDS::Time_t & source_timestamp) { ::DDS_Time_t time; time <<= source_timestamp; ::DDS_InstanceHandle_t const rtihandle = - this->typed_impl ()->register_instance_w_timestamp (instance_data, time); + this->rti_entity ()->register_instance_w_timestamp (instance_data, time); ::DDS::InstanceHandle_t handle; handle <<= rtihandle; return handle; @@ -301,18 +280,18 @@ return 0; template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::unregister_instance ( + DataWriter_T<DDS_TYPE>::unregister_instance ( const typename DDS_TYPE::value_type & instance_data, const ::DDS::InstanceHandle_t & handle) { ::DDS_InstanceHandle_t instance_handle = ::DDS_HANDLE_NIL; instance_handle <<= handle; - return this->typed_impl ()->unregister_instance (instance_data, instance_handle); + return this->rti_entity ()->unregister_instance (instance_data, instance_handle); } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::unregister_instance_w_timestamp ( + DataWriter_T<DDS_TYPE>::unregister_instance_w_timestamp ( const typename DDS_TYPE::value_type & instance_data, const ::DDS::InstanceHandle_t & handle, const ::DDS::Time_t & source_timestamp) @@ -321,23 +300,23 @@ return 0; instance_handle <<= handle; ::DDS_Time_t time; time <<= source_timestamp; - return this->typed_impl ()->unregister_instance_w_timestamp (instance_data, instance_handle, time); + return this->rti_entity ()->unregister_instance_w_timestamp (instance_data, instance_handle, time); } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::write ( + DataWriter_T<DDS_TYPE>::write ( const typename DDS_TYPE::value_type & instance_data, const ::DDS::InstanceHandle_t & handle) { ::DDS_InstanceHandle_t instance_handle = ::DDS_HANDLE_NIL; instance_handle <<= handle; - return this->typed_impl ()->write (instance_data, instance_handle); + return this->rti_entity ()->write (instance_data, instance_handle); } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::write_w_timestamp ( + DataWriter_T<DDS_TYPE>::write_w_timestamp ( const typename DDS_TYPE::value_type & instance_data, const ::DDS::InstanceHandle_t & handle, const ::DDS::Time_t & source_timestamp) @@ -346,23 +325,23 @@ return 0; instance_handle <<= handle; ::DDS_Time_t time; time <<= source_timestamp; - return this->typed_impl ()->write_w_timestamp (instance_data, instance_handle, time); + return this->rti_entity ()->write_w_timestamp (instance_data, instance_handle, time); } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::dispose ( + DataWriter_T<DDS_TYPE>::dispose ( const typename DDS_TYPE::value_type& instance_data, const ::DDS::InstanceHandle_t & handle) { ::DDS_InstanceHandle_t instance_handle = ::DDS_HANDLE_NIL; instance_handle <<= handle; - return this->typed_impl ()->dispose (instance_data, instance_handle); + return this->rti_entity ()->dispose (instance_data, instance_handle); } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::dispose_w_timestamp ( + DataWriter_T<DDS_TYPE>::dispose_w_timestamp ( const typename DDS_TYPE::value_type& instance_data, const ::DDS::InstanceHandle_t & handle, const ::DDS::Time_t & source_timestamp) @@ -371,30 +350,66 @@ return 0; instance_handle <<= handle; ::DDS_Time_t time; time <<= source_timestamp; - return this->typed_impl ()->dispose_w_timestamp (instance_data, instance_handle, time); + return this->rti_entity ()->dispose_w_timestamp (instance_data, instance_handle, time); } template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DataWriter_T<DDS_TYPE>::get_key_value ( + DataWriter_T<DDS_TYPE>::get_key_value ( typename DDS_TYPE::value_type & key_holder, const ::DDS::InstanceHandle_t & handle) { ::DDS_InstanceHandle_t instance_handle = ::DDS_HANDLE_NIL; instance_handle <<= handle; - return this->typed_impl ()->get_key_value (key_holder, instance_handle); + return this->rti_entity ()->get_key_value (key_holder, instance_handle); } template <typename DDS_TYPE> ::DDS::InstanceHandle_t - DDS_DataWriter_T<DDS_TYPE>::lookup_instance ( + DataWriter_T<DDS_TYPE>::lookup_instance ( const typename DDS_TYPE::value_type& instance_data) { ::DDS_InstanceHandle_t const rtihandle = - this->typed_impl ()->lookup_instance (instance_data); + this->rti_entity ()->lookup_instance (instance_data); ::DDS::InstanceHandle_t handle; handle <<= rtihandle; return handle; } + + template <typename DDS_TYPE> + void + DataWriter_T<DDS_TYPE>::set_rti_entity (DDSDataWriter * dw) + { + if (dw) + { + this->rti_entity_ = DDS_TYPE::datawriter_type::narrow (dw); + } + else + { + this->rti_entity_ = 0; + } + } + + template <typename DDS_TYPE> + DDSDataWriter * + DataWriter_T<DDS_TYPE>::get_rti_entity (void) + { + return this->rti_entity_; + } + + template <typename DDS_TYPE> + typename DDS_TYPE::datawriter_type* + DataWriter_T<DDS_TYPE>::rti_entity (void) + { + if (!this->rti_entity_) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DataWriter_T<DDS_TYPE>::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); + throw ::CORBA::BAD_INV_ORDER (); + } + return this->rti_entity_; + } + } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataWriter_T.h b/CIAO/connectors/dds4ccm/impl/ndds/DataWriter_T.h index 26ccf9cab7b..320d557cbd5 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataWriter_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataWriter_T.h @@ -18,29 +18,19 @@ namespace CIAO { - namespace DDS4CCM + namespace NDDS { template <typename DDS_TYPE> class DDS_DataWriterListener_T; template <typename DDS_TYPE> - class DDS_Publisher_T; - - template <typename DDS_TYPE> - class DDS_Topic_T; - - template <typename DDS_TYPE> - class DDS_DataWriter_T + class DataWriter_T : public virtual DDS_DataWriter_Base { typedef DDS_DataWriterListener_T<DDS_TYPE> DataWriterListener_type; - typedef DDS_Publisher_T<DDS_TYPE> Publisher_type; - typedef DDS_Topic_T<DDS_TYPE> Topic_type; - public: - explicit DDS_DataWriter_T (DDSDataWriter * dw = 0); - - virtual void set_impl (DDSDataWriter * dw); + explicit DataWriter_T (::DDSDataWriter * dw = 0, + ::DDS::DomainParticipant_ptr dp = ::DDS::DomainParticipant::_nil ()); // @todo); virtual ::DDS::ReturnCode_t set_qos (const ::DDS::DataWriterQos & qos); @@ -128,10 +118,17 @@ namespace CIAO virtual ::DDS::InstanceHandle_t lookup_instance ( const typename DDS_TYPE::value_type& instance_data); + + virtual ::DDSDataWriter * get_rti_entity (void); + + // @todo, this should be private to my idea + virtual void set_rti_entity (::DDSDataWriter * dw); + private: - typename DDS_TYPE::datawriter_type * typed_impl (void); + typename DDS_TYPE::datawriter_type * rti_entity_; + ::DDS::DomainParticipant_var dp_; - typename DDS_TYPE::datawriter_type * writer_; + typename DDS_TYPE::datawriter_type * rti_entity (void); }; } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp index e7d23666c7f..71f43267a52 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp @@ -1,17 +1,18 @@ // $Id$ -#include "dds4ccm/impl/ndds/Subscriber_T.h" -#include "dds4ccm/impl/ndds/Publisher_T.h" -#include "dds4ccm/impl/ndds/ContentFilteredTopic_T.h" -#include "dds4ccm/impl/ndds/TopicDescription_T.h" -#include "dds4ccm/impl/ndds/Topic_T.h" -#include "dds4ccm/impl/ndds/DDSDomainParticipantListener.h" -#include "dds4ccm/impl/ndds/DDSPublisherListener_T.h" -#include "dds4ccm/impl/ndds/DDSSubscriberListener_T.h" +#include "dds4ccm/impl/ndds/DomainParticipant.h" +#include "dds4ccm/impl/ndds/Subscriber.h" +#include "dds4ccm/impl/ndds/Publisher.h" +#include "dds4ccm/impl/ndds/ContentFilteredTopic.h" +#include "dds4ccm/impl/ndds/TopicDescription.h" +#include "dds4ccm/impl/ndds/Topic.h" +#include "dds4ccm/impl/ndds/DomainParticipantListener.h" +#include "dds4ccm/impl/ndds/PublisherListener.h" +#include "dds4ccm/impl/ndds/SubscriberListener.h" #include "dds4ccm/impl/ndds/StatusCondition.h" #include "dds4ccm/impl/Utils.h" -#include "dds4ccm/impl/TopicListener_T.h" +#include "dds4ccm/impl/ndds/TopicListener.h" #include "dds4ccm/impl/ndds/DomainParticipantManager.h" #include "dds4ccm/impl/ndds/convertors/PublisherQos.h" @@ -25,73 +26,67 @@ #include "dds4ccm/impl/ndds/convertors/TopicBuiltinTopicData.h" #include "dds4ccm/impl/ndds/convertors/ParticipantBuiltinTopicData.h" -#include "dds4ccm/idl/dds4ccm_BaseC.h" - #include "dds4ccm/impl/logger/Log_Macros.h" #include "ace/CORBA_macros.h" +#include "ndds/ndds_cpp.h" + namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - DDS_DomainParticipant_T<DDS_TYPE>::DDS_DomainParticipant_T ( - DDSDomainParticipant * dp) : impl_ (dp) + DDS_DomainParticipant_i::DDS_DomainParticipant_i ( + ::DDSDomainParticipant * dp) : rti_entity_ (dp) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T<DDS_TYPE>::DDS_DomainParticipant_T"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::DDS_DomainParticipant_i"); } - template <typename DDS_TYPE> - DDS_DomainParticipant_T<DDS_TYPE>::~DDS_DomainParticipant_T (void) + DDS_DomainParticipant_i::~DDS_DomainParticipant_i (void) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T<DDS_TYPE>::~DDS_DomainParticipant_T"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::~DDS_DomainParticipant_i"); } - template <typename DDS_TYPE> void - DDS_DomainParticipant_T<DDS_TYPE>::register_type (const char* type, TypeFactory*f) + DDS_DomainParticipant_i::register_type (const char* type, TypeFactory*f) { this->type_factories [type] = f; this->factory_ = f; } - template <typename DDS_TYPE> ::DDS::DataWriter_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_datawriter (DDSDataWriter* dw) + DDS_DomainParticipant_i::create_datawriter (DDSDataWriter* dw) { - return this->factory_->create_datawriter (dw); + return this->factory_->create_datawriter (dw, this); } - template <typename DDS_TYPE> + ::DDS::DataReader_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_datareader (DDSDataReader* dr) + DDS_DomainParticipant_i::create_datareader (DDSDataReader* dr) { - return this->factory_->create_datareader (dr); + return this->factory_->create_datareader (dr, this); } - template <typename DDS_TYPE> ::DDS::Publisher_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_publisher_with_profile ( + DDS_DomainParticipant_i::create_publisher_with_profile ( const char* library_name, const char *profile_name, ::DDS::PublisherListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::create_publisher_with_profile"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::create_publisher_with_profile"); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_publisher_with_profile - " + "DDS_DomainParticipant_i::create_publisher_with_profile - " "Start creating Publisher\n")); - DDS_PublisherListener_T<DDS_TYPE> *ccm_dds_pl = 0; + DDS_PublisherListener_i *ccm_dds_pl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_pl, - PublisherListener_type (a_listener), + DDS_PublisherListener_i (a_listener, this), ::CORBA::NO_MEMORY ()); } DDSPublisher * ccm_dds_pub = - this->impl ()->create_publisher_with_profile (library_name, + this->rti_entity ()->create_publisher_with_profile (library_name, profile_name, ccm_dds_pl, mask); @@ -99,8 +94,7 @@ namespace CIAO if (!ccm_dds_pub) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_publisher_with_profile - " + "DDS_DomainParticipant_i::create_publisher_with_profile - " "Error: Unable to create Publisher\n")); delete ccm_dds_pl; return ::DDS::Publisher::_nil (); @@ -108,53 +102,51 @@ namespace CIAO ::DDS::Publisher_var retval; ACE_NEW_THROW_EX (retval, - Publisher_type (ccm_dds_pub, this), + DDS_Publisher_i (ccm_dds_pub, this), ::CORBA::NO_MEMORY ()); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_publisher_with_profile - " + "DDS_DomainParticipant_i::create_publisher_with_profile - " "Successfully created a DDSPublisher\n")); ccm_dds_pub->enable (); return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::Publisher_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_publisher ( + DDS_DomainParticipant_i::create_publisher ( const ::DDS::PublisherQos & qos, ::DDS::PublisherListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::create_publisher"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::create_publisher"); ACE_UNUSED_ARG (qos); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_publisher - " + "DDS_DomainParticipant_i::create_publisher - " "Start creating Publisher\n")); DDS_PublisherQos ccm_dds_qos = DDS_PUBLISHER_QOS_DEFAULT; - DDS_PublisherListener_T<DDS_TYPE> *ccm_dds_pl = 0; + DDS_PublisherListener_i *ccm_dds_pl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_pl, - PublisherListener_type (a_listener), + DDS_PublisherListener_i (a_listener, this), ::CORBA::NO_MEMORY ()); } DDSPublisher * ccm_dds_pub = - this->impl ()->create_publisher (ccm_dds_qos, + this->rti_entity ()->create_publisher (ccm_dds_qos, ccm_dds_pl, mask); if (!ccm_dds_pub) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T" - "<DDS_TYPE>::create_publisher - " + "DDS_DomainParticipant_i" + "::create_publisher - " "Error: Unable to create Publisher\n")); delete ccm_dds_pl; return ::DDS::Publisher::_nil (); @@ -162,86 +154,84 @@ namespace CIAO ::DDS::Publisher_var retval; ACE_NEW_THROW_EX (retval, - Publisher_type (ccm_dds_pub, this), + DDS_Publisher_i (ccm_dds_pub, this), ::CORBA::NO_MEMORY ()); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_publisher - " + "DDS_DomainParticipant_i::create_publisher - " "Successfully created a DDSPublisher\n")); ccm_dds_pub->enable (); return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::delete_publisher ( + DDS_DomainParticipant_i::delete_publisher ( ::DDS::Publisher_ptr p) { - Publisher_type *ccm_dds_pub = - dynamic_cast < Publisher_type * > (p); + DDS_Publisher_i *ccm_dds_pub = + dynamic_cast < DDS_Publisher_i * > (p); if (!ccm_dds_pub) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T" - "<DDS_TYPE>::delete_publisher - " + "DDS_DomainParticipant_i" + "::delete_publisher - " "Unable to cast provided object reference to servant pointer.\n")); return ::DDS::RETCODE_ERROR; } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_SUCCESSFUL, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipant_T" - "<DDS_TYPE>::delete_publisher - " + "DDS_DomainParticipant_i" + "::delete_publisher - " "Successfully casted provided object reference to " - "DDS_Publisher_T\n")); + "DDS_Publisher_i\n")); - DDS_ReturnCode_t const retval = this->impl ()->delete_publisher (ccm_dds_pub->get_impl ()); + DDS_ReturnCode_t const retval = this->rti_entity ()->delete_publisher (ccm_dds_pub->get_rti_entity ()); if (retval != DDS_RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T" - "<DDS_TYPE>::delete_publisher - " + "DDS_DomainParticipant_i" + "::delete_publisher - " "Error: RTI delete_publisher returned non-ok error code %C\n", - translate_retcode (retval))); + ::CIAO::DDS4CCM::translate_retcode (retval))); } else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_publisher - " + "DDS_DomainParticipant_i::delete_publisher - " "Provided publisher successfully deleted\n")); } return retval; } - template <typename DDS_TYPE> + ::DDS::Subscriber_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_subscriber_with_profile ( + DDS_DomainParticipant_i::create_subscriber_with_profile ( const char* library_name, const char *profile_name, ::DDS::SubscriberListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::create_subscriber_with_profile"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::create_subscriber_with_profile"); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipant_T" - "<DDS_TYPE>::create_subscriber_with_profile - " + "DDS_DomainParticipant_i" + "::create_subscriber_with_profile - " "Creating Subscriber\n")); - SubscriberListener_type *ccm_dds_sl = 0; + DDS_SubscriberListener_i *ccm_dds_sl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_sl, - SubscriberListener_type (a_listener), + DDS_SubscriberListener_i (a_listener, this), ::CORBA::NO_MEMORY ()); } DDSSubscriber * ccm_dds_sub = - this->impl ()->create_subscriber_with_profile ( + this->rti_entity ()->create_subscriber_with_profile ( library_name, profile_name, ccm_dds_sl, @@ -250,7 +240,7 @@ namespace CIAO if (!ccm_dds_sub) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T::" + "DDS_DomainParticipant_i::" "create_subscriber_with_profile - " "Error: RTI DDS returned a nil subscriber.\n")); delete ccm_dds_sl; @@ -259,52 +249,50 @@ namespace CIAO ::DDS::Subscriber_var retval; ACE_NEW_THROW_EX (retval, - Subscriber_type (ccm_dds_sub, this), + DDS_Subscriber_i (ccm_dds_sub, this), ::CORBA::NO_MEMORY ()); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_subscriber_with_profile - " + "DDS_DomainParticipant_i::create_subscriber_with_profile - " "Successfully created a DDSSubscriber\n")); ccm_dds_sub->enable (); return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::Subscriber_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_subscriber ( + DDS_DomainParticipant_i::create_subscriber ( const ::DDS::SubscriberQos & qos, ::DDS::SubscriberListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::create_subscriber"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::create_subscriber"); ACE_UNUSED_ARG (qos); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_subscriber - " + "DDS_DomainParticipant_i::create_subscriber - " "Creating Subscriber\n")); - SubscriberListener_type *ccm_dds_sl = 0; + DDS_SubscriberListener_i *ccm_dds_sl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_sl, - SubscriberListener_type (a_listener), + DDS_SubscriberListener_i (a_listener, this), ::CORBA::NO_MEMORY ()); } DDS_SubscriberQos ccm_dds_qos = DDS_SUBSCRIBER_QOS_DEFAULT; DDSSubscriber * ccm_dds_sub = - this->impl ()->create_subscriber (ccm_dds_qos, + this->rti_entity ()->create_subscriber (ccm_dds_qos, ccm_dds_sl, mask); if (!ccm_dds_sub) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T::" + "DDS_DomainParticipant_i::" "create_subscriber_with_profile - " "Error: RTI DDS returned a nil subscriber.\n")); delete ccm_dds_sl; @@ -313,105 +301,100 @@ namespace CIAO ::DDS::Subscriber_var retval; ACE_NEW_THROW_EX (retval, - Subscriber_type (ccm_dds_sub, this), + DDS_Subscriber_i (ccm_dds_sub, this), ::CORBA::NO_MEMORY ()); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_subscriber - " + "DDS_DomainParticipant_i::create_subscriber - " "Successfully created a DDSSubscriber\n")); ccm_dds_sub->enable (); return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::delete_subscriber ( + DDS_DomainParticipant_i::delete_subscriber ( ::DDS::Subscriber_ptr s) { - Subscriber_type *ccm_dds_sub = dynamic_cast < Subscriber_type * > (s); + DDS_Subscriber_i *ccm_dds_sub = dynamic_cast < DDS_Subscriber_i * > (s); if (!ccm_dds_sub) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_subscriber - Unable to cast " + "DDS_DomainParticipant_i::delete_subscriber - Unable to cast " "provided object reference to servant pointer.\n")); return ::DDS::RETCODE_ERROR; } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_SUCCESSFUL, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_subscriber - Successfully casted " + "DDS_DomainParticipant_i::delete_subscriber - Successfully casted " "provided object reference to Subscriber_type\n")); - DDS_ReturnCode_t const retval = this->impl ()->delete_subscriber (ccm_dds_sub->get_impl ()); + DDS_ReturnCode_t const retval = this->rti_entity ()->delete_subscriber (ccm_dds_sub->get_rti_entity ()); if (retval != DDS_RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_subscriber - Error: RTI " + "DDS_DomainParticipant_i::delete_subscriber - Error: RTI " "delete_subscriber returned non-ok error code %C\n", - translate_retcode (retval))); + ::CIAO::DDS4CCM::translate_retcode (retval))); } else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_subscriber - " + "DDS_DomainParticipant_i::delete_subscriber - " "Provided subscriber successfully deleted\n")); } return retval; } - template <typename DDS_TYPE> + ::DDS::Subscriber_ptr - DDS_DomainParticipant_T<DDS_TYPE>::get_builtin_subscriber (void) + DDS_DomainParticipant_i::get_builtin_subscriber (void) { ::DDS::Subscriber_var retval; - DDSSubscriber* sub = this->impl ()->get_builtin_subscriber (); + DDSSubscriber* sub = this->rti_entity ()->get_builtin_subscriber (); if (sub) { ACE_NEW_THROW_EX (retval, - Subscriber_type (sub, this), + DDS_Subscriber_i (sub, this), ::CORBA::NO_MEMORY ()); } return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::Topic_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_topic ( + DDS_DomainParticipant_i::create_topic ( const char * impl_name, const char * type_name, const ::DDS::TopicQos & qos, ::DDS::TopicListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::create_topic"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::create_topic"); ACE_UNUSED_ARG (qos); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_DEBUG, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic - " + "DDS_DomainParticipant_i::create_topic - " "Attempting to create topic with name %C and type %C\n", impl_name, type_name)); - TopicListener_type *ccm_dds_tl = 0; + DDS_TopicListener_i *ccm_dds_tl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_tl, - TopicListener_type (a_listener), + DDS_TopicListener_i (::DDS::Topic::_nil (), a_listener), // @todo, no nill ::CORBA::NO_MEMORY ()); } DDS_TopicQos ccm_dds_qos = DDS_TOPIC_QOS_DEFAULT; DDSTopicDescription * dds_td = - this->impl ()->lookup_topicdescription (impl_name); + this->rti_entity ()->lookup_topicdescription (impl_name); DDSTopic * dds_tp = 0; if (dds_td) { @@ -420,7 +403,7 @@ namespace CIAO if (!dds_tp) { - dds_tp = this->impl ()->create_topic (impl_name, + dds_tp = this->rti_entity ()->create_topic (impl_name, type_name, ccm_dds_qos, ccm_dds_tl, @@ -429,7 +412,7 @@ namespace CIAO if (!dds_tp) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic - " + "DDS_DomainParticipant_i::create_topic - " "Error: RTI DDS returned a nil topic\n")); delete ccm_dds_tl; return ::DDS::Topic::_nil (); @@ -437,43 +420,39 @@ namespace CIAO ::DDS::Topic_var retval; ACE_NEW_THROW_EX (retval, - Topic_type (dds_tp), + DDS_Topic_i (dds_tp, this), ::CORBA::NO_MEMORY ()); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic - " + "DDS_DomainParticipant_i::create_topic - " "Successfully created topic with name %C and type %C\n", impl_name, type_name)); - Topic_type * ccm_dds_tp = - dynamic_cast < Topic_type *> (retval.in ()); - ccm_dds_tp->set_impl (dds_tp); - - DPMANAGER->add_topic (this->impl (), dds_tp); + DPMANAGER->add_topic (this->rti_entity (), dds_tp); return retval._retn (); } else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic - " + "DDS_DomainParticipant_i::create_topic - " "Re-using topic with name %C and type %C.\n", impl_name, type_name)); - DPMANAGER->_inc_ref (this->impl (), dds_tp); + DPMANAGER->_inc_ref (this->rti_entity (), dds_tp); ::DDS::Topic_var retval; ACE_NEW_THROW_EX (retval, - Topic_type (dds_tp), + DDS_Topic_i (dds_tp, this), ::CORBA::NO_MEMORY ()); return retval._retn (); } } - template <typename DDS_TYPE> + ::DDS::Topic_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_topic_with_profile ( + DDS_DomainParticipant_i::create_topic_with_profile ( const char *impl_name, const char *type_name, const char *library_name, @@ -481,12 +460,12 @@ namespace CIAO ::DDS::TopicListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::create_topic_with_profile"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::create_topic_with_profile"); if (impl_name == 0) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic_with_profile - " + "DDS_DomainParticipant_i::create_topic_with_profile - " "Error: provided nil topic name\n")); throw ::CCM_DDS::InternalError (::DDS::RETCODE_BAD_PARAMETER, 0); } @@ -494,26 +473,26 @@ namespace CIAO if (type_name == 0) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic_with_profile - " + "DDS_DomainParticipant_i::create_topic_with_profile - " "Error: provided nil type name\n")); throw ::CCM_DDS::InternalError (::DDS::RETCODE_BAD_PARAMETER, 0); } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_DEBUG, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic_with_profile - " + "DDS_DomainParticipant_i::create_topic_with_profile - " "Attempting to create topic with name %C and type %C\n", impl_name, type_name)); - TopicListener_type *ccm_dds_tl = 0; + DDS_TopicListener_i *ccm_dds_tl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_tl, - TopicListener_type (a_listener), + DDS_TopicListener_i (::DDS::Topic::_nil (), a_listener), // @todo, no nill ::CORBA::NO_MEMORY ()); } DDSTopicDescription * dds_td = - this->impl ()->lookup_topicdescription (impl_name); + this->rti_entity ()->lookup_topicdescription (impl_name); DDSTopic * dds_tp = 0; if (dds_td) { @@ -522,7 +501,7 @@ namespace CIAO if (!dds_tp) { - dds_tp = this->impl ()->create_topic_with_profile ( + dds_tp = this->rti_entity ()->create_topic_with_profile ( impl_name, type_name, library_name, @@ -533,7 +512,7 @@ namespace CIAO if (!dds_tp) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic_with_profile - " + "DDS_DomainParticipant_i::create_topic_with_profile - " "Error: RTI DDS returned a nil topic\n")); delete ccm_dds_tl; return ::DDS::Topic::_nil (); @@ -541,46 +520,50 @@ namespace CIAO ::DDS::Topic_var retval; ACE_NEW_THROW_EX (retval, - Topic_type (dds_tp), + DDS_Topic_i (dds_tp, this), ::CORBA::NO_MEMORY ()); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic_with_profile - " + "DDS_DomainParticipant_i::create_topic_with_profile - " "Successfully created topic with name %C and type %C\n", impl_name, type_name)); - Topic_type * ccm_dds_tp = - dynamic_cast < Topic_type *> (retval.in ()); - ccm_dds_tp->set_impl (dds_tp); - - DPMANAGER->add_topic (this->impl (), dds_tp); + if (ccm_dds_tl) + { + ccm_dds_tl->set_dds_topic (retval.in ()); + } + DPMANAGER->add_topic (this->rti_entity (), dds_tp); return retval._retn (); } else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_topic_with_profile - " + "DDS_DomainParticipant_i::create_topic_with_profile - " "Re-using topic with name %C and type %C.\n", impl_name, type_name)); - DPMANAGER->_inc_ref (this->impl (), dds_tp); + DPMANAGER->_inc_ref (this->rti_entity (), dds_tp); ::DDS::Topic_var retval; ACE_NEW_THROW_EX (retval, - Topic_type (dds_tp), + DDS_Topic_i (dds_tp, this), ::CORBA::NO_MEMORY ()); + if (ccm_dds_tl) + { + ccm_dds_tl->set_dds_topic (retval.in ()); + } return retval._retn (); } } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::delete_topic (::DDS::Topic_ptr a_topic) + DDS_DomainParticipant_i::delete_topic (::DDS::Topic_ptr a_topic) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::delete_topic"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::delete_topic"); CORBA::String_var topic_name = a_topic->get_name (); DDSTopicDescription * dds_td = - this->impl ()->lookup_topicdescription (topic_name.in ()); + this->rti_entity ()->lookup_topicdescription (topic_name.in ()); DDSTopic * tp = 0; if (dds_td) { @@ -590,38 +573,34 @@ namespace CIAO if (!tp) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_topic <%C> - Unable to cast " + "DDS_DomainParticipant_i::delete_topic <%C> - Unable to cast " "provided object reference to servant.\n", topic_name.in ())); return ::DDS::RETCODE_BAD_PARAMETER; } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_SUCCESSFUL, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_topic <%C> - " + "DDS_DomainParticipant_i::delete_topic <%C> - " "Successfully casted provided object reference to servant.\n", topic_name.in ())); ::DDS::ReturnCode_t retval = DDS::RETCODE_OK; - if (DPMANAGER->remove_topic (this->impl (), tp)) + if (DPMANAGER->remove_topic (this->rti_entity (), tp)) { - retval = this->impl ()->delete_topic (tp); + retval = this->rti_entity ()->delete_topic (tp); if (retval != DDS_RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_topic <%C> - " + "DDS_DomainParticipant_i::delete_topic <%C> - " "Error: RTI delete_topic returned non-ok error code %C\n", topic_name.in (), - translate_retcode (retval))); + ::CIAO::DDS4CCM::translate_retcode (retval))); } else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_topic <%C> - " + "DDS_DomainParticipant_i::delete_topic <%C> - " "Provided topic successfully deleted\n", topic_name.in ())); } @@ -629,38 +608,37 @@ namespace CIAO return retval; } - template <typename DDS_TYPE> + ::DDS::Topic_ptr - DDS_DomainParticipant_T<DDS_TYPE>::find_topic (const char * impl_name, + DDS_DomainParticipant_i::find_topic (const char * impl_name, const ::DDS::Duration_t & timeout) { ::DDS::Topic_var retval; ::DDS_Duration_t ddstimeout; ddstimeout <<= timeout; - ::DDSTopic* topic = this->impl ()->find_topic (impl_name, ddstimeout); + ::DDSTopic* topic = this->rti_entity ()->find_topic (impl_name, ddstimeout); if (topic) { ACE_NEW_RETURN (retval, - Topic_type (topic), + DDS_Topic_i (topic, this), ::DDS::Topic::_nil ()); } return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::TopicDescription_ptr - DDS_DomainParticipant_T<DDS_TYPE>::lookup_topicdescription (const char * name) + DDS_DomainParticipant_i::lookup_topicdescription (const char * name) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T<DDS_TYPE>::lookup_topicdescription"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::lookup_topicdescription"); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_UNIMP_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::lookup_topicdescription - " + "DDS_DomainParticipant_i::lookup_topicdescription - " "Looking up topic: name <%C>\n", name)); ::DDS::TopicDescription_var retval; - ::DDSTopicDescription* topic = this->impl ()->lookup_topicdescription (name); + ::DDSTopicDescription* topic = this->rti_entity ()->lookup_topicdescription (name); if (topic) { // Check the entity: is it a Topic or a ContentFilteredTopic @@ -668,7 +646,7 @@ namespace CIAO if (tp) { ACE_NEW_THROW_EX (retval, - Topic_type (tp), + DDS_Topic_i (tp, this), ::CORBA::NO_MEMORY ()); } else @@ -678,7 +656,7 @@ namespace CIAO if (cftp) { ACE_NEW_THROW_EX (retval, - ContentFilteredTopic_type (cftp), + DDS_ContentFilteredTopic_i (cftp, this), ::CORBA::NO_MEMORY ()); } } @@ -686,21 +664,20 @@ namespace CIAO return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::ContentFilteredTopic_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_contentfilteredtopic (const char * name, + DDS_DomainParticipant_i::create_contentfilteredtopic (const char * name, ::DDS::Topic_ptr related_topic, const char * filter_expression, const ::DDS::StringSeq & expression_parameters) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::create_contentfilteredtopic"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::create_contentfilteredtopic"); - Topic_type *top = dynamic_cast< Topic_type *> (related_topic); + DDS_Topic_i *top = dynamic_cast< DDS_Topic_i *> (related_topic); if (!top) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_contentfilteredtopic - " + "DDS_DomainParticipant_i::create_contentfilteredtopic - " "Unable to cast provided topic.\n")); throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0); } @@ -717,17 +694,16 @@ namespace CIAO DDS_StringSeq parameters (expression_parameters.length ()); parameters.from_array (parameterlist, expression_parameters.length ()); - DDSContentFilteredTopic * ccm_dds_cft = this->impl ()->create_contentfilteredtopic ( + DDSContentFilteredTopic * ccm_dds_cft = this->rti_entity ()->create_contentfilteredtopic ( name, - top->get_impl (), + top->get_rti_entity (), filter_expression, parameters); delete [] parameterlist; if (!ccm_dds_cft) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::create_contentfilteredtopic - " + "DDS_DomainParticipant_i::create_contentfilteredtopic - " "RTI DDS returned a nil ContentFilteredTopic for " "name <%C> and filter expression <%C>.\n", name, filter_expression)); @@ -736,11 +712,11 @@ namespace CIAO ::DDS::ContentFilteredTopic_var retval; ACE_NEW_THROW_EX (retval, - ContentFilteredTopic_type (ccm_dds_cft), + DDS_ContentFilteredTopic_i (ccm_dds_cft, this), ::CORBA::NO_MEMORY ()); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipant_T::create_contentfilteredtopic - " + "DDS_DomainParticipant_i::create_contentfilteredtopic - " "Successfully created contentfilteredtopic with name <%C> and " "filter expression <%C>\n", name, filter_expression)); @@ -748,34 +724,33 @@ namespace CIAO return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::delete_contentfilteredtopic ( + DDS_DomainParticipant_i::delete_contentfilteredtopic ( ::DDS::ContentFilteredTopic_ptr a_contentfilteredtopic) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::delete_contentfilteredtopic"); - ContentFilteredTopic_type *ccm_dds_cft = - dynamic_cast < ContentFilteredTopic_type *> (a_contentfilteredtopic); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::delete_contentfilteredtopic"); + DDS_ContentFilteredTopic_i *ccm_dds_cft = + dynamic_cast < DDS_ContentFilteredTopic_i *> (a_contentfilteredtopic); if (!ccm_dds_cft) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_contentfilteredtopic - " + "DDS_DomainParticipant_i::delete_contentfilteredtopic - " "Unable to cast provided ContentFilteredTopic.\n")); return ::DDS::RETCODE_BAD_PARAMETER; } - return this->impl ()->delete_contentfilteredtopic (ccm_dds_cft->get_impl ()); + return this->rti_entity ()->delete_contentfilteredtopic (ccm_dds_cft->get_rti_entity ()); } - template <typename DDS_TYPE> + ::DDS::MultiTopic_ptr - DDS_DomainParticipant_T<DDS_TYPE>::create_multitopic ( + DDS_DomainParticipant_i::create_multitopic ( const char * name, const char * type_name, const char * subscription_expression, const ::DDS::StringSeq & expression_parameters) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::create_multitopic"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::create_multitopic"); ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (type_name); ACE_UNUSED_ARG (subscription_expression); @@ -784,355 +759,356 @@ namespace CIAO throw ::CORBA::NO_IMPLEMENT (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::delete_multitopic ( + DDS_DomainParticipant_i::delete_multitopic ( ::DDS::MultiTopic_ptr a_multitopic) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::delete_multitopic"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::delete_multitopic"); ACE_UNUSED_ARG (a_multitopic); //Not implemented in version ndds.4.5b.rev01 of RTI DDS. throw ::CORBA::NO_IMPLEMENT (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::delete_contained_entities (void) + DDS_DomainParticipant_i::delete_contained_entities (void) { - return this->impl ()->delete_contained_entities (); + return this->rti_entity ()->delete_contained_entities (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::set_qos ( + DDS_DomainParticipant_i::set_qos ( const ::DDS::DomainParticipantQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::set_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::set_qos"); ::DDS_DomainParticipantQos ccm_dds_qos; ccm_dds_qos <<= qos; - return this->impl()->set_qos (ccm_dds_qos); + return this->rti_entity ()->set_qos (ccm_dds_qos); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::get_qos ( + DDS_DomainParticipant_i::get_qos ( ::DDS::DomainParticipantQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::get_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_qos"); ::DDS_DomainParticipantQos ccm_dds_qos; - ::DDS::ReturnCode_t retcode = this->impl()-> get_qos (ccm_dds_qos); + ::DDS::ReturnCode_t retcode = this->rti_entity ()-> get_qos (ccm_dds_qos); qos <<= ccm_dds_qos; return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::set_listener ( + DDS_DomainParticipant_i::set_listener ( ::DDS::DomainParticipantListener_ptr a_listener, ::DDS::StatusMask mask) { // Delete the previously set listener - DDSDomainParticipantListener *listener = this->impl ()->get_listener (); + DDSDomainParticipantListener *listener = this->rti_entity ()->get_listener (); delete listener; - DDS_DomainParticipantListener_i * ccm_dds_impl_list = 0; + ::DDSDomainParticipantListener * ccm_dds_impl_list = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_impl_list, DDS_DomainParticipantListener_i (a_listener), ::CORBA::NO_MEMORY ()); } - return this->impl_->set_listener (ccm_dds_impl_list, mask); + return this->rti_entity ()->set_listener (ccm_dds_impl_list, mask); } - template <typename DDS_TYPE> + ::DDS::DomainParticipantListener_ptr - DDS_DomainParticipant_T<DDS_TYPE>::get_listener (void) + DDS_DomainParticipant_i::get_listener (void) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::get_listener"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_listener"); - DDSDomainParticipantListener *ccm_dds_dp_list = this->impl ()->get_listener (); + DDSDomainParticipantListener *ccm_dds_dp_list = this->rti_entity ()->get_listener (); DDS_DomainParticipantListener_i * list_proxy = dynamic_cast <DDS_DomainParticipantListener_i *> (ccm_dds_dp_list); if (!list_proxy) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_DomainParticipant_T<DDS_TYPE, " - "VENDOR_TYPE>::get_listener - " + "DDS_DomainParticipant_i::get_listener - " "DDS returned a NIL listener.\n")); return ::DDS::DomainParticipantListener::_nil (); } return list_proxy->get_domainparticipantlistener (); } - template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::ignore_participant ( + DDS_DomainParticipant_i::ignore_participant ( DDS_INSTANCE_HANDLE_T_IN handle) { ::DDS_InstanceHandle_t ccm_dds_handle; ccm_dds_handle <<= handle; - return this->impl ()->ignore_participant (ccm_dds_handle); + return this->rti_entity ()->ignore_participant (ccm_dds_handle); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::ignore_topic ( + DDS_DomainParticipant_i::ignore_topic ( DDS_INSTANCE_HANDLE_T_IN handle) { ::DDS_InstanceHandle_t ccm_dds_handle; ccm_dds_handle <<= handle; - return this->impl ()->ignore_topic (ccm_dds_handle); + return this->rti_entity ()->ignore_topic (ccm_dds_handle); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::ignore_publication ( + DDS_DomainParticipant_i::ignore_publication ( DDS_INSTANCE_HANDLE_T_IN handle) { ::DDS_InstanceHandle_t ccm_dds_handle; ccm_dds_handle <<= handle; - return this->impl ()->ignore_publication (ccm_dds_handle); + return this->rti_entity ()->ignore_publication (ccm_dds_handle); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::ignore_subscription ( + DDS_DomainParticipant_i::ignore_subscription ( DDS_INSTANCE_HANDLE_T_IN handle) { ::DDS_InstanceHandle_t ccm_dds_handle; ccm_dds_handle <<= handle; - return this->impl ()->ignore_subscription (ccm_dds_handle); + return this->rti_entity ()->ignore_subscription (ccm_dds_handle); } - template <typename DDS_TYPE> + ::DDS::DomainId_t - DDS_DomainParticipant_T<DDS_TYPE>::get_domain_id (void) + DDS_DomainParticipant_i::get_domain_id (void) { - return this->impl ()->get_domain_id (); + return this->rti_entity ()->get_domain_id (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::assert_liveliness (void) + DDS_DomainParticipant_i::assert_liveliness (void) { - return this->impl ()->assert_liveliness (); + return this->rti_entity ()->assert_liveliness (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::set_default_publisher_qos ( + DDS_DomainParticipant_i::set_default_publisher_qos ( const ::DDS::PublisherQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::set_default_publisher_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::set_default_publisher_qos"); ::DDS_PublisherQos ccm_dds_qos; ccm_dds_qos <<= qos; - return this->impl()->set_default_publisher_qos (ccm_dds_qos); + return this->rti_entity ()->set_default_publisher_qos (ccm_dds_qos); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::get_default_publisher_qos ( + DDS_DomainParticipant_i::get_default_publisher_qos ( ::DDS::PublisherQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::get_default_publisher_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_default_publisher_qos"); ::DDS_PublisherQos ccm_dds_qos; - ::DDS::ReturnCode_t retcode = this->impl()-> get_default_publisher_qos (ccm_dds_qos); + ::DDS::ReturnCode_t retcode = this->rti_entity ()-> get_default_publisher_qos (ccm_dds_qos); qos <<= ccm_dds_qos; return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::set_default_subscriber_qos ( + DDS_DomainParticipant_i::set_default_subscriber_qos ( const ::DDS::SubscriberQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::set_default_subscriber_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::set_default_subscriber_qos"); ::DDS_SubscriberQos ccm_dds_qos; ccm_dds_qos <<= qos; - return this->impl()->set_default_subscriber_qos (ccm_dds_qos); + return this->rti_entity ()->set_default_subscriber_qos (ccm_dds_qos); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::get_default_subscriber_qos ( + DDS_DomainParticipant_i::get_default_subscriber_qos ( ::DDS::SubscriberQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::get_default_subscriber_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_default_subscriber_qos"); ::DDS_SubscriberQos ccm_dds_qos; ::DDS::ReturnCode_t retcode = - this->impl()-> get_default_subscriber_qos (ccm_dds_qos); + this->rti_entity ()-> get_default_subscriber_qos (ccm_dds_qos); qos <<= ccm_dds_qos; return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::set_default_topic_qos ( + DDS_DomainParticipant_i::set_default_topic_qos ( const ::DDS::TopicQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::set_default_topic_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::set_default_topic_qos"); ::DDS_TopicQos ccm_dds_qos; ccm_dds_qos <<= qos; - return this->impl()->set_default_topic_qos (ccm_dds_qos); + return this->rti_entity ()->set_default_topic_qos (ccm_dds_qos); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::get_default_topic_qos ( + DDS_DomainParticipant_i::get_default_topic_qos ( ::DDS::TopicQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::get_default_topic_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_default_topic_qos"); ::DDS_TopicQos ccm_dds_qos; ::DDS::ReturnCode_t retcode = - this->impl()-> get_default_topic_qos (ccm_dds_qos); + this->rti_entity ()-> get_default_topic_qos (ccm_dds_qos); qos <<= ccm_dds_qos; return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::get_discovered_participants ( + DDS_DomainParticipant_i::get_discovered_participants ( ::DDS::InstanceHandleSeq & impl_handles) { ::DDS_InstanceHandleSeq rtiseq; - ::DDS::ReturnCode_t const retval = this->impl ()->get_discovered_participants (rtiseq); + ::DDS::ReturnCode_t const retval = this->rti_entity ()->get_discovered_participants (rtiseq); impl_handles <<= rtiseq; return retval; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::get_discovered_participant_data ( + DDS_DomainParticipant_i::get_discovered_participant_data ( ::DDS::ParticipantBuiltinTopicData & impl_data, DDS_INSTANCE_HANDLE_T_IN impl_handle) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::get_discovered_participant_data"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_discovered_participant_data"); DDS_ParticipantBuiltinTopicData dds_part_data; dds_part_data <<= impl_data; ::DDS_InstanceHandle_t dds_hnd; dds_hnd <<= impl_handle; ::DDS_ReturnCode_t retcode = - this->impl ()->get_discovered_participant_data (dds_part_data, + this->rti_entity ()->get_discovered_participant_data (dds_part_data, dds_hnd); impl_data <<= dds_part_data; return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::get_discovered_topics ( + DDS_DomainParticipant_i::get_discovered_topics ( ::DDS::InstanceHandleSeq & impl_handles) { ::DDS_InstanceHandleSeq rtiseq; - ::DDS::ReturnCode_t const retval = this->impl ()->get_discovered_topics (rtiseq); + ::DDS::ReturnCode_t const retval = this->rti_entity ()->get_discovered_topics (rtiseq); impl_handles <<= rtiseq; return retval; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::get_discovered_topic_data ( + DDS_DomainParticipant_i::get_discovered_topic_data ( ::DDS::TopicBuiltinTopicData & impl_data, DDS_INSTANCE_HANDLE_T_IN impl_handle) { - DDS4CCM_TRACE ("DDS_DomainParticipant_T::get_discovered_topic_data"); + DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_discovered_topic_data"); DDS_TopicBuiltinTopicData dds_tp_data; dds_tp_data <<= impl_data; ::DDS_InstanceHandle_t dds_hnd; dds_hnd <<= impl_handle; ::DDS_ReturnCode_t retcode = - this->impl ()->get_discovered_topic_data (dds_tp_data, + this->rti_entity ()->get_discovered_topic_data (dds_tp_data, dds_hnd); impl_data <<= dds_tp_data; return retcode; } - template <typename DDS_TYPE> + ::CORBA::Boolean - DDS_DomainParticipant_T<DDS_TYPE>::contains_entity ( + DDS_DomainParticipant_i::contains_entity ( DDS_INSTANCE_HANDLE_T_IN a_handle) { ::DDS_InstanceHandle_t ccm_dds_handle; ccm_dds_handle <<= a_handle; - return this->impl ()->contains_entity (ccm_dds_handle); + return this->rti_entity ()->contains_entity (ccm_dds_handle); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::get_current_time ( + DDS_DomainParticipant_i::get_current_time ( ::DDS::Time_t & current_time) { DDS_Time_t ccm_dds_time; - ::DDS::ReturnCode_t const retval = this->impl ()->get_current_time (ccm_dds_time); + ::DDS::ReturnCode_t const retval = this->rti_entity ()->get_current_time (ccm_dds_time); current_time <<= ccm_dds_time; return retval; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipant_T<DDS_TYPE>::enable (void) + DDS_DomainParticipant_i::enable (void) { - return this->impl ()->enable (); + return this->rti_entity ()->enable (); } - template <typename DDS_TYPE> + ::DDS::StatusCondition_ptr - DDS_DomainParticipant_T<DDS_TYPE>::get_statuscondition (void) + DDS_DomainParticipant_i::get_statuscondition (void) { ::DDS::StatusCondition_var retval; - DDSStatusCondition* sc = this->impl ()->get_statuscondition (); + DDSStatusCondition* sc = this->rti_entity ()->get_statuscondition (); if (sc) { ACE_NEW_THROW_EX (retval, - DDS_StatusCondition_i (sc), + DDS_StatusCondition_i (sc, this), ::CORBA::NO_MEMORY ()); } return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::StatusMask - DDS_DomainParticipant_T<DDS_TYPE>::get_status_changes (void) + DDS_DomainParticipant_i::get_status_changes (void) { - return this->impl ()->get_status_changes (); + return this->rti_entity ()->get_status_changes (); } - template <typename DDS_TYPE> + DDS_INSTANCE_HANDLE_T_RETN - DDS_DomainParticipant_T<DDS_TYPE>::get_instance_handle (void) + DDS_DomainParticipant_i::get_instance_handle (void) { - ::DDS_InstanceHandle_t const rtihandle = this->impl ()->get_instance_handle (); + ::DDS_InstanceHandle_t const rtihandle = this->rti_entity ()->get_instance_handle (); ::DDS::InstanceHandle_t handle; handle <<= rtihandle; return handle; } - template <typename DDS_TYPE> + DDSDomainParticipant * - DDS_DomainParticipant_T<DDS_TYPE>::get_impl (void) + DDS_DomainParticipant_i::get_rti_entity (void) { - return this->impl_; + return this->rti_entity_; } - template <typename DDS_TYPE> + void - DDS_DomainParticipant_T<DDS_TYPE>::set_impl ( + DDS_DomainParticipant_i::set_rti_entity ( DDSDomainParticipant * dp) { - this->impl_ = dp; + this->rti_entity_ = dp; } - template <typename DDS_TYPE> + DDSDomainParticipant * - DDS_DomainParticipant_T<DDS_TYPE>::impl (void) + DDS_DomainParticipant_i::rti_entity (void) { - if (!this->impl_) + if (!this->rti_entity_) { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DDS_DomainParticipant_i::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); throw ::CORBA::BAD_INV_ORDER (); } - return this->impl_; + return this->rti_entity_; } } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant_T.h b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.h index ca3dc5fab68..6c2eeebce9d 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.h @@ -11,80 +11,45 @@ #define DOMAINPARTICIPANT_T_H_ #include "dds4ccm/idl/dds_rtf2_dcpsC.h" -#include "convertors/InstanceHandle_t.h" - -#include "tao/LocalObject.h" +#include "dds4ccm/impl/ndds/convertors/InstanceHandle_t.h" +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "dds4ccm/impl/ndds/DataWriter_T.h" #include "dds4ccm/impl/ndds/DataReader_T.h" +#include "tao/LocalObject.h" #include <map> class TypeFactory { public: - virtual DDS::DataWriter_ptr create_datawriter (DDSDataWriter* dw) = 0; - virtual DDS::DataReader_ptr create_datareader (DDSDataReader* dr) = 0; + virtual DDS::DataWriter_ptr create_datawriter (DDSDataWriter* dw, ::DDS::DomainParticipant_ptr dp) = 0; + virtual DDS::DataReader_ptr create_datareader (DDSDataReader* dr, ::DDS::DomainParticipant_ptr dp) = 0; }; template <typename DDS_TYPE> class DDSTypeFactory : public TypeFactory { public: - DDS::DataWriter_ptr create_datawriter (DDSDataWriter* dw) + DDS::DataWriter_ptr create_datawriter (DDSDataWriter* dw, ::DDS::DomainParticipant_ptr dp) { - typedef CIAO::DDS4CCM::DDS_DataWriter_T<DDS_TYPE> DataWriter_type; - return new DataWriter_type (dw); + typedef CIAO::NDDS::DataWriter_T<DDS_TYPE> DataWriter_type; + return new DataWriter_type (dw, dp); } - DDS::DataReader_ptr create_datareader (DDSDataReader* dr) + DDS::DataReader_ptr create_datareader (DDSDataReader* dr, ::DDS::DomainParticipant_ptr dp) { - typedef CIAO::DDS4CCM::DataReader_T<DDS_TYPE> DataReader_type; - return new DataReader_type (dr); + typedef CIAO::NDDS::DataReader_T<DDS_TYPE> DataReader_type; + return new DataReader_type (dr, dp); } }; namespace CIAO { - namespace DDS4CCM + namespace NDDS { - // Forward declarations - template <typename DDS_TYPE> - class DDS_Topic_T; - - template <typename DDS_TYPE> - class DDS_SubscriberListener_T; - - template <typename DDS_TYPE> - class DDS_Publisher_T; - - template <typename DDS_TYPE> - class DDS_Subscriber_T; - - template <typename DDS_TYPE> - class DDS_TopicListener_T; - - template <typename DDS_TYPE> - class DDS_Topic_T; - - template <typename DDS_TYPE> - class DDS_ContentFilteredTopic_T; - - template <typename DDS_TYPE> - class DDS_PublisherListener_T; - - // Class declaration - template <typename DDS_TYPE> - class DDS_DomainParticipant_T : + class DDS4CCM_NDDS_Export DDS_DomainParticipant_i : public virtual ::DDS::DomainParticipant, public virtual ::CORBA::LocalObject { - typedef DDS_Subscriber_T<DDS_TYPE> Subscriber_type; - typedef DDS_SubscriberListener_T<DDS_TYPE> SubscriberListener_type; - typedef DDS_Publisher_T<DDS_TYPE> Publisher_type; - typedef DDS_PublisherListener_T<DDS_TYPE> PublisherListener_type; - typedef DDS_TopicListener_T<DDS_TYPE> TopicListener_type; - typedef DDS_Topic_T<DDS_TYPE> Topic_type; - typedef DDS_ContentFilteredTopic_T<DDS_TYPE> ContentFilteredTopic_type; - public: /* @todo, cleanup this */ void register_type (const char* type, TypeFactory*); @@ -92,10 +57,10 @@ namespace CIAO ::DDS::DataReader_ptr create_datareader (DDSDataReader* dr); /// Constructor - DDS_DomainParticipant_T (DDSDomainParticipant * dp); + DDS_DomainParticipant_i (DDSDomainParticipant * dp); /// Destructor - virtual ~DDS_DomainParticipant_T (void); + virtual ~DDS_DomainParticipant_i (void); virtual ::DDS::Publisher_ptr create_publisher ( const ::DDS::PublisherQos & qos, @@ -243,20 +208,18 @@ namespace CIAO virtual DDS_INSTANCE_HANDLE_T_RETN get_instance_handle (void); - DDSDomainParticipant * get_impl (void); + ::DDSDomainParticipant * get_rti_entity (void); - void set_impl (DDSDomainParticipant * dp); + void set_rti_entity (::DDSDomainParticipant * dp); protected: typedef std::map <ACE_CString, TypeFactory*> typefactories; typefactories type_factories; TypeFactory* factory_; - DDSDomainParticipant *impl_; - DDSDomainParticipant * impl (void); + ::DDSDomainParticipant *rti_entity_; + ::DDSDomainParticipant * rti_entity (void); }; } } -#include "dds4ccm/impl/ndds/DomainParticipant_T.cpp" - #endif /* DOMAINPARTICIPANT_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp index 16ce84d7be5..68ed2988c09 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp @@ -1,51 +1,41 @@ // $Id$ -#include "dds4ccm/impl/ndds/DomainParticipantFactory_T.h" -#include "dds4ccm/impl/ndds/DomainParticipant_T.h" - -#include "dds4ccm/impl/ndds/DDSDomainParticipantListener.h" +#include "dds4ccm/impl/ndds/DomainParticipantFactory.h" +#include "dds4ccm/impl/ndds/DomainParticipant.h" +#include "dds4ccm/impl/ndds/DomainParticipantListener.h" #include "dds4ccm/impl/ndds/convertors/DomainParticipantFactoryQos.h" #include "dds4ccm/impl/ndds/convertors/DomainParticipantQos.h" - #include "dds4ccm/impl/Utils.h" - #include "dds4ccm/impl/logger/Log_Macros.h" -#include "dds4ccm/idl/dds4ccm_BaseC.h" -#include "dds4ccm/impl/dds4ccm_conf.h" - #include "dds4ccm/impl/ndds/DomainParticipantManager.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - DDS_DomainParticipantFactory_T<DDS_TYPE>::DDS_DomainParticipantFactory_T (void) + DDS_DomainParticipantFactory_i::DDS_DomainParticipantFactory_i (void) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::DDS_DomainParticipantFactory_T"); + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::DDS_DomainParticipantFactory_i"); } - template <typename DDS_TYPE> - DDS_DomainParticipantFactory_T<DDS_TYPE>::~DDS_DomainParticipantFactory_T (void) + DDS_DomainParticipantFactory_i::~DDS_DomainParticipantFactory_i (void) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::~DDS_DomainParticipantFactory_T"); + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::~DDS_DomainParticipantFactory_i"); } - template <typename DDS_TYPE> ::DDS::DomainParticipant_ptr - DDS_DomainParticipantFactory_T<DDS_TYPE>::create_participant (::DDS::DomainId_t domain_id, + DDS_DomainParticipantFactory_i::create_participant (::DDS::DomainId_t domain_id, const ::DDS::DomainParticipantQos & qos, ::DDS::DomainParticipantListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::create_participant"); + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::create_participant"); ACE_UNUSED_ARG (qos); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T<DDS_TYPE, " - "VENDOR_TYPE>::create_participant - " + "DDS_DomainParticipantFactory_i::create_participant - " "Start creating domain participant for domain <%d>\n", domain_id)); @@ -73,8 +63,8 @@ namespace CIAO if (!dds_dp) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T" - "<DDS_TYPE>::create_participant - " + "DDS_DomainParticipantFactory_i" + "::create_participant - " "Error: Unable to create DomainParticipant for domain <%d>\n", domain_id)); throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0); @@ -82,7 +72,7 @@ namespace CIAO ::DDS::DomainParticipant_var retval; ACE_NEW_THROW_EX (retval, - DomainParticipant_type (dds_dp), + DDS_DomainParticipant_i (dds_dp), ::CORBA::NO_MEMORY ()); dds_dp->enable (); @@ -93,34 +83,32 @@ namespace CIAO else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T<DDS_TYPE, " - "VENDOR_TYPE>::create_participant - Re-using participant " + "DDS_DomainParticipantFactory_i::create_participant - Re-using participant " "for QOS profile <%C> and domain <%d>.\n", qos_profile.c_str (), domain_id)); ::DDS::DomainParticipant_var retval; ACE_NEW_THROW_EX (retval, - DomainParticipant_type (dds_dp), + DDS_DomainParticipant_i (dds_dp), ::CORBA::NO_MEMORY ()); return retval._retn (); } } - template <typename DDS_TYPE> + ::DDS::DomainParticipant_ptr - DDS_DomainParticipantFactory_T<DDS_TYPE>::create_participant_with_profile ( + DDS_DomainParticipantFactory_i::create_participant_with_profile ( ::DDS::DomainId_t domain_id, const char * library_name, const char * profile_name, ::DDS::DomainParticipantListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::" + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::" "create_participant_with_profile"); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T<DDS_TYPE, " - "VENDOR_TYPE>::create_participant_with_profile - " + "DDS_DomainParticipantFactory_i::create_participant_with_profile - " "Start creating domain participant: " "profile <%C#%C> - domain <%d>\n", library_name, profile_name, domain_id)); @@ -143,8 +131,7 @@ namespace CIAO if (!dds_dp) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T<DDS_TYPE, " - "VENDOR_TYPE>::create_participant_with_profile - " + "DDS_DomainParticipantFactory_i::create_participant_with_profile - " "Creating participant: profile <%C> - domain <%d>\n", qos_profile.c_str (), domain_id)); @@ -157,119 +144,115 @@ namespace CIAO if (!dds_dp) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T<DDS_TYPE, " - "VENDOR_TYPE>::create_participant_with_profile - " + "DDS_DomainParticipantFactory_i::create_participant_with_profile - " "Error: Unable to create DomainParticipant\n")); throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0); } ::DDS::DomainParticipant_var retval; ACE_NEW_THROW_EX (retval, - DomainParticipant_type (dds_dp), + DDS_DomainParticipant_i (dds_dp), ::CORBA::NO_MEMORY ()); dds_dp->enable (); - DomainParticipant_type * typed_dp = - dynamic_cast < DomainParticipant_type *> + DDS_DomainParticipant_i * typed_dp = + dynamic_cast < DDS_DomainParticipant_i *> (retval.in ()); - typed_dp->set_impl (dds_dp); + typed_dp->set_rti_entity (dds_dp); DPMANAGER->add_participant (qos_profile.c_str (), dds_dp); return retval._retn (); } else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T<DDS_TYPE, " - "VENDOR_TYPE>::create_participant_with_profile - Re-using " + "DDS_DomainParticipantFactory_i::create_participant_with_profile - Re-using " "participant for QOS profile <%C> and domain <%d>.\n", qos_profile.c_str (), domain_id)); ::DDS::DomainParticipant_var retval; ACE_NEW_THROW_EX (retval, - DomainParticipant_type (dds_dp), + DDS_DomainParticipant_i (dds_dp), ::CORBA::NO_MEMORY ()); return retval._retn (); } } - - template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_DomainParticipantFactory_T<DDS_TYPE>::delete_participant ( + DDS_DomainParticipantFactory_i::delete_participant ( ::DDS::DomainParticipant_ptr a_participant) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::delete_participant"); + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::delete_participant"); - DomainParticipant_type *part = - dynamic_cast< DomainParticipant_type * > (a_participant); + DDS_DomainParticipant_i *part = + dynamic_cast< DDS_DomainParticipant_i * > (a_participant); if (!part) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T" - "<DDS_TYPE>::delete_participant - " + "DDS_DomainParticipantFactory_i" + "::delete_participant - " "Unable to cast provided object reference to servant " "type, bailing.\n")); return DDS::RETCODE_ERROR; } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_SUCCESSFUL, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T" - "<DDS_TYPE>::delete_participant - " + "DDS_DomainParticipantFactory_i" + "::delete_participant - " "Successfully casted provided object reference to servant type.\n")); ::DDS::ReturnCode_t retval = DDS::RETCODE_OK; - if (DPMANAGER->remove_participant (part->get_impl ())) + if (DPMANAGER->remove_participant (part->get_rti_entity ())) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_TRACE, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T" - "<DDS_TYPE>::delete_participant - " + "DDS_DomainParticipantFactory_i" + "::delete_participant - " "Going to delete participant.\n")); retval = DDSDomainParticipantFactory::get_instance ()-> - delete_participant (part->get_impl ()); + delete_participant (part->get_rti_entity ()); if (retval != DDS::RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T" - "<DDS_TYPE>::delete_participant - " + "DDS_DomainParticipantFactory_i" + "::delete_participant - " "RTI delete_participant returned non-ok error code %C\n", - translate_retcode (retval))); + ::CIAO::DDS4CCM::translate_retcode (retval))); } else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_DomainParticipantFactory_T" - "<DDS_TYPE>::delete_participant - " + "DDS_DomainParticipantFactory_i" + "::delete_participant - " "Successfully deleted provided participant.\n")); } } return retval; } - template <typename DDS_TYPE> + ::DDS::DomainParticipant_ptr - DDS_DomainParticipantFactory_T<DDS_TYPE>::lookup_participant ( + DDS_DomainParticipantFactory_i::lookup_participant ( ::DDS::DomainId_t domain_id) { ::DDS::DomainParticipant_var retval; ::DDSDomainParticipant* dp = DDSDomainParticipantFactory::get_instance () ->lookup_participant (domain_id); ACE_NEW_THROW_EX (retval, - DomainParticipant_type (dp), + DDS_DomainParticipant_i (dp), ::CORBA::NO_MEMORY ()); return retval._retn (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipantFactory_T<DDS_TYPE>::set_default_participant_qos ( + DDS_DomainParticipantFactory_i::set_default_participant_qos ( const ::DDS::DomainParticipantQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::" + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::" "set_default_participant_qos"); DDS_DomainParticipantQos ccm_dds_qos; ccm_dds_qos <<= qos; @@ -277,12 +260,12 @@ namespace CIAO set_default_participant_qos (ccm_dds_qos); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipantFactory_T<DDS_TYPE>::get_default_participant_qos ( + DDS_DomainParticipantFactory_i::get_default_participant_qos ( ::DDS::DomainParticipantQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::" + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::" "get_default_participant_qos"); DDS_DomainParticipantQos ccm_dds_qos; ::DDS::ReturnCode_t retcode = @@ -292,23 +275,23 @@ namespace CIAO return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipantFactory_T<DDS_TYPE>::set_qos ( + DDS_DomainParticipantFactory_i::set_qos ( const ::DDS::DomainParticipantFactoryQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::set_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::set_qos"); DDS_DomainParticipantFactoryQos ccm_dds_qos; ccm_dds_qos <<= qos; return DDSDomainParticipantFactory::get_instance ()->set_qos (ccm_dds_qos); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipantFactory_T<DDS_TYPE>::get_qos ( + DDS_DomainParticipantFactory_i::get_qos ( ::DDS::DomainParticipantFactoryQos & qos) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::get_qos"); + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::get_qos"); DDS_DomainParticipantFactoryQos ccm_dds_qos; ::DDS::ReturnCode_t retcode = DDSDomainParticipantFactory::get_instance ()->get_qos (ccm_dds_qos); @@ -316,13 +299,13 @@ namespace CIAO return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_DomainParticipantFactory_T<DDS_TYPE>::set_default_participant_qos_with_profile ( + DDS_DomainParticipantFactory_i::set_default_participant_qos_with_profile ( const char * library_name, const char * profile_name) { - DDS4CCM_TRACE ("DDS_DomainParticipantFactory_T<DDS_TYPE>::" + DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::" "set_default_participant_qos_with_profile"); return DDSDomainParticipantFactory::get_instance ()-> diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory_T.h b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.h index d64110ff927..f15442de39c 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.h @@ -11,32 +11,28 @@ #define DOMAINPARTICIPANTFACTORY_T_H_ #include "dds4ccm/idl/dds_rtf2_dcpsC.h" +#include "tao/LocalObject.h" +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include <map> namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_DomainParticipant_T; - - template <typename DDS_TYPE> - class DDS_DomainParticipantFactory_T : + class DDS4CCM_NDDS_Export DDS_DomainParticipantFactory_i : public virtual ::DDS::DomainParticipantFactory, public virtual ::CORBA::LocalObject { public: - typedef DDS_DomainParticipant_T<DDS_TYPE> DomainParticipant_type; - typedef DDS_DomainParticipantFactory_T<DDS_TYPE> DomainParticipantFactory_type; - friend class ACE_Singleton<DomainParticipantFactory_type, TAO_SYNCH_MUTEX>; + friend class ACE_Singleton<DDS_DomainParticipantFactory_i, TAO_SYNCH_MUTEX>; /// Constructor - DDS_DomainParticipantFactory_T (void); + DDS_DomainParticipantFactory_i (void); /// Destructor - virtual ~DDS_DomainParticipantFactory_T (void); + virtual ~DDS_DomainParticipantFactory_i (void); virtual ::DDS::DomainParticipant_ptr create_participant ( ::DDS::DomainId_t domain_id, @@ -76,6 +72,4 @@ namespace CIAO } } -#include "dds4ccm/impl/ndds/DomainParticipantFactory_T.cpp" - #endif /* DOMAINPARTICIPANTFACTORY_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSDomainParticipantListener.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantListener.cpp index 49f9074b1ff..e59329a7c97 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSDomainParticipantListener.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantListener.cpp @@ -1,23 +1,11 @@ // $Id$ -#include "dds4ccm/impl/DomainParticipantListener_T.h" - -#include "dds4ccm/impl/ndds/DomainParticipant_T.h" - -#include "dds4ccm/impl/ndds/convertors/SampleLostStatus.h" -#include "dds4ccm/impl/ndds/convertors/SubscriptionMatchedStatus.h" -#include "dds4ccm/impl/ndds/convertors/RequestedDeadlineMissedStatus.h" -#include "dds4ccm/impl/ndds/convertors/SampleRejectedStatus.h" -#include "dds4ccm/impl/ndds/convertors/LivelinessChangedStatus.h" -#include "dds4ccm/impl/ndds/convertors/RequestedIncompatibleQosStatus.h" - -#include "dds4ccm/idl/dds4ccm_BaseC.h" - +#include "dds4ccm/impl/ndds/DomainParticipantListener.h" #include "dds4ccm/impl/logger/Log_Macros.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { DDS_DomainParticipantListener_i::DDS_DomainParticipantListener_i ( ::DDS::DomainParticipantListener_ptr p) @@ -31,90 +19,90 @@ namespace CIAO void DDS_DomainParticipantListener_i::on_inconsistent_topic ( - ::DDS::Topic_ptr, - const ::DDS::InconsistentTopicStatus & ) + ::DDSTopic*, + const ::DDS_InconsistentTopicStatus & ) { } void DDS_DomainParticipantListener_i::on_requested_deadline_missed ( - ::DDS::DataReader_ptr , - const ::DDS::RequestedDeadlineMissedStatus & ) + ::DDSDataReader* , + const ::DDS_RequestedDeadlineMissedStatus & ) { } void DDS_DomainParticipantListener_i::on_requested_incompatible_qos ( - ::DDS::DataReader_ptr , - const ::DDS::RequestedIncompatibleQosStatus & ) + ::DDSDataReader* , + const ::DDS_RequestedIncompatibleQosStatus & ) { } void DDS_DomainParticipantListener_i::on_sample_rejected ( - ::DDS::DataReader_ptr , - const ::DDS::SampleRejectedStatus & ) + ::DDSDataReader* , + const ::DDS_SampleRejectedStatus & ) { } void DDS_DomainParticipantListener_i::on_liveliness_changed ( - ::DDS::DataReader_ptr , - const ::DDS::LivelinessChangedStatus & ) + ::DDSDataReader* , + const ::DDS_LivelinessChangedStatus & ) { } void DDS_DomainParticipantListener_i::on_data_available ( - ::DDS::DataReader_ptr ) + ::DDSDataReader* ) { } void DDS_DomainParticipantListener_i::on_subscription_matched ( - ::DDS::DataReader_ptr , - const ::DDS::SubscriptionMatchedStatus & ) + ::DDSDataReader* , + const ::DDS_SubscriptionMatchedStatus & ) { } void DDS_DomainParticipantListener_i::on_sample_lost ( - ::DDS::DataReader_ptr , - const ::DDS::SampleLostStatus & ) + ::DDSDataReader* , + const ::DDS_SampleLostStatus & ) { } void DDS_DomainParticipantListener_i::on_offered_deadline_missed ( - ::DDS::DataWriter_ptr , - const ::DDS::OfferedDeadlineMissedStatus & ) + ::DDSDataWriter* , + const ::DDS_OfferedDeadlineMissedStatus & ) { } void DDS_DomainParticipantListener_i::on_offered_incompatible_qos ( - ::DDS::DataWriter_ptr , - const ::DDS::OfferedIncompatibleQosStatus & ) + ::DDSDataWriter* , + const ::DDS_OfferedIncompatibleQosStatus & ) { } void DDS_DomainParticipantListener_i::on_liveliness_lost ( - ::DDS::DataWriter_ptr , - const ::DDS::LivelinessLostStatus & ) + ::DDSDataWriter* , + const ::DDS_LivelinessLostStatus & ) { } void DDS_DomainParticipantListener_i::on_publication_matched ( - ::DDS::DataWriter_ptr , - const ::DDS::PublicationMatchedStatus & ) + ::DDSDataWriter* , + const ::DDS_PublicationMatchedStatus & ) { } void DDS_DomainParticipantListener_i::on_data_on_readers ( - ::DDS::Subscriber_ptr ) + ::DDSSubscriber* ) { } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSDomainParticipantListener.h b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantListener.h index 8f6bcbc1ac4..fcd4830d614 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSDomainParticipantListener.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantListener.h @@ -11,17 +11,15 @@ #define DOMAINPARTICIPANTLISTENER_H_ #include "dds4ccm/idl/dds_rtf2_dcpsC.h" - #include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" - # include "ndds/ndds_cpp.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { class DDS4CCM_NDDS_Export DDS_DomainParticipantListener_i : - public virtual ::DDSDomainParticipantListener + public ::DDSDomainParticipantListener { public: /// Constructor @@ -34,66 +32,66 @@ namespace CIAO virtual void on_inconsistent_topic ( - ::DDS::Topic_ptr, - const ::DDS::InconsistentTopicStatus & ); + ::DDSTopic*, + const ::DDS_InconsistentTopicStatus & ); virtual void on_requested_deadline_missed ( - ::DDS::DataReader_ptr , - const ::DDS::RequestedDeadlineMissedStatus & ); + ::DDSDataReader* , + const ::DDS_RequestedDeadlineMissedStatus & ); virtual void on_requested_incompatible_qos ( - ::DDS::DataReader_ptr , - const ::DDS::RequestedIncompatibleQosStatus & ); + ::DDSDataReader* , + const ::DDS_RequestedIncompatibleQosStatus & ); virtual void on_sample_rejected ( - ::DDS::DataReader_ptr , - const ::DDS::SampleRejectedStatus & ); + ::DDSDataReader*, + const ::DDS_SampleRejectedStatus & ); virtual void on_liveliness_changed ( - ::DDS::DataReader_ptr , - const ::DDS::LivelinessChangedStatus & ); + ::DDSDataReader* , + const ::DDS_LivelinessChangedStatus & ); virtual void on_data_available ( - ::DDS::DataReader_ptr ); + ::DDSDataReader* ); virtual void on_subscription_matched ( - ::DDS::DataReader_ptr , - const ::DDS::SubscriptionMatchedStatus & ); + ::DDSDataReader* , + const ::DDS_SubscriptionMatchedStatus & ); virtual void on_sample_lost ( - ::DDS::DataReader_ptr , - const ::DDS::SampleLostStatus & ); + ::DDSDataReader* , + const ::DDS_SampleLostStatus & ); virtual void on_offered_deadline_missed ( - ::DDS::DataWriter_ptr , - const ::DDS::OfferedDeadlineMissedStatus & ); + ::DDSDataWriter* , + const ::DDS_OfferedDeadlineMissedStatus & ); virtual void on_offered_incompatible_qos ( - ::DDS::DataWriter_ptr , - const ::DDS::OfferedIncompatibleQosStatus & ); + ::DDSDataWriter* , + const ::DDS_OfferedIncompatibleQosStatus & ); virtual void on_liveliness_lost ( - ::DDS::DataWriter_ptr , - const ::DDS::LivelinessLostStatus & ); + ::DDSDataWriter* , + const ::DDS_LivelinessLostStatus & ); virtual void on_publication_matched ( - ::DDS::DataWriter_ptr , - const ::DDS::PublicationMatchedStatus & ); + ::DDSDataWriter* , + const ::DDS_PublicationMatchedStatus & ); virtual void on_data_on_readers ( - ::DDS::Subscriber_ptr ); + ::DDSSubscriber* ); private: ::DDS::DomainParticipantListener_var impl_; diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp index b02b9eb5c7d..4516dc57f00 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp @@ -6,7 +6,7 @@ namespace CIAO { - namespace DDS4CCM + namespace NDDS { //============================================================ // DomainParticipantManager::DDSParticipantTopic::DDSParticipantTopic diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h index b758e9c1340..381efcc6024 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h @@ -22,7 +22,7 @@ namespace CIAO { - namespace DDS4CCM + namespace NDDS { class DDS4CCM_NDDS_Export DomainParticipantManager : private ACE_Copy_Disabled { @@ -88,11 +88,11 @@ namespace CIAO } } -#define DPMANAGER ::CIAO::DDS4CCM::Domain_Participant_Factory::instance () +#define DPMANAGER ::CIAO::NDDS::Domain_Participant_Factory::instance () /// Declare a process wide singleton DDS4CCM_DDS_NDDS_SINGLETON_DECLARE (ACE_Singleton, - ::CIAO::DDS4CCM::DomainParticipantManager, + ::CIAO::NDDS::DomainParticipantManager, TAO_SYNCH_MUTEX) #endif diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Publisher.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Publisher.cpp new file mode 100644 index 00000000000..f33c4ed3882 --- /dev/null +++ b/CIAO/connectors/dds4ccm/impl/ndds/Publisher.cpp @@ -0,0 +1,411 @@ +// $Id$ + +#include "dds4ccm/impl/Utils.h" + +#include "dds4ccm/impl/ndds/Publisher.h" +#include "dds4ccm/impl/ndds/PublisherListener.h" +#include "dds4ccm/impl/ndds/DomainParticipant.h" +#include "dds4ccm/impl/ndds/Topic.h" +#include "dds4ccm/impl/ndds/DataWriter_T.h" +#include "dds4ccm/impl/ndds/StatusCondition.h" +#include "dds4ccm/impl/ndds/DataWriterListener.h" +#include "dds4ccm/impl/ndds/convertors/InstanceHandle_t.h" +#include "dds4ccm/impl/ndds/convertors/Duration_t.h" +#include "dds4ccm/impl/ndds/convertors/DataWriterQos.h" +#include "dds4ccm/impl/ndds/convertors/PublisherQos.h" +#include "dds4ccm/impl/ndds/convertors/TopicQos.h" + +#include "dds4ccm/impl/logger/Log_Macros.h" +#include "ndds/ndds_cpp.h" + +namespace CIAO +{ + namespace NDDS + { + DDS_Publisher_i::DDS_Publisher_i (::DDSPublisher * p, + ::DDS::DomainParticipant_ptr dp) + : rti_entity_ (p), + dp_ (::DDS::DomainParticipant::_duplicate (dp)) + { + DDS4CCM_TRACE ("DDS_Publisher_i::DDS_Publisher_i"); + } + + DDS_Publisher_i::~DDS_Publisher_i (void) + { + DDS4CCM_TRACE ("DDS_Publisher_i::~DDS_Publisher_i"); + } + + ::DDS::DataWriter_ptr + DDS_Publisher_i::create_datawriter ( + ::DDS::Topic_ptr a_topic, + const ::DDS::DataWriterQos &, + ::DDS::DataWriterListener_ptr a_listener, + ::DDS::StatusMask mask) + { + DDS4CCM_TRACE ("DDS_Publisher_i::create_datawriter"); + + DDS_Topic_i * topic = dynamic_cast < DDS_Topic_i * > (a_topic); + + if (!topic) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_Publisher_i::create_datawriter - " + "Error: Unable to cast provided topic to its servant.\n")); + throw ::CCM_DDS::InternalError (::DDS::RETCODE_BAD_PARAMETER, 0); + } + + DDS_DataWriterListener_i *ccm_dds_drl = 0; + if (! ::CORBA::is_nil (a_listener)) + { + ACE_NEW_THROW_EX (ccm_dds_drl, + DDS_DataWriterListener_i (a_listener, 0), + ::CORBA::NO_MEMORY ()); + } + DDS_DataWriterQos ccm_dds_qos = DDS_DATAWRITER_QOS_DEFAULT; + DDSDataWriter *ccm_dds_dw = this->rti_entity ()->create_datawriter ( + topic->get_rti_entity (), + ccm_dds_qos, + ccm_dds_drl, + mask); + + if (!ccm_dds_dw) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO + "DDS_Publisher_i::create_datawriter - " + "Error: RTI Topic returned a nil datawriter.\n")); + delete ccm_dds_drl; + return ::DDS::DataWriter::_nil (); + } + ::CIAO::NDDS::DDS_DomainParticipant_i* p = dynamic_cast < ::CIAO::NDDS::DDS_DomainParticipant_i*> (this->dp_.in ()); + + ::DDS::DataWriter_var retval = p->create_datawriter (ccm_dds_dw); + if (ccm_dds_drl) + { + ccm_dds_drl->set_dds_entity (retval.in ()); + } + ccm_dds_dw->enable (); + return retval._retn (); + } + + + ::DDS::DataWriter_ptr + DDS_Publisher_i::create_datawriter_with_profile (::DDS::Topic_ptr a_topic, + const char* library_name, + const char *profile_name, + ::DDS::DataWriterListener_ptr a_listener, + ::DDS::StatusMask mask) + { + DDS4CCM_TRACE ("DDS_Publisher_i::create_datawriter_with_profile"); + + DDS_Topic_i * topic = dynamic_cast < DDS_Topic_i * > (a_topic); + + if (!topic) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_Publisher_i::create_datawriter_with_profile - " + "Error: Unable to cast provided topic to its servant.\n")); + throw ::CCM_DDS::InternalError (::DDS::RETCODE_BAD_PARAMETER, 0); + } + + DDS_DataWriterListener_i *ccm_dds_drl = 0; + if (! ::CORBA::is_nil (a_listener)) + { + ACE_NEW_THROW_EX (ccm_dds_drl, + DDS_DataWriterListener_i (a_listener, 0), + ::CORBA::NO_MEMORY ()); + } + DDSDataWriter *ccm_dds_dw = this->rti_entity ()->create_datawriter_with_profile ( + topic->get_rti_entity (), + library_name, + profile_name, + ccm_dds_drl, + mask); + + if (!ccm_dds_dw) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO + "DDS_Publisher_i::create_datawriter_with_profile - " + "Error: RTI Topic returned a nil datawriter.\n")); + delete ccm_dds_drl; + return ::DDS::DataWriter::_nil (); + } + else + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_Publisher_i::create_datawriter_with_profile - " + "Successfully created datawriter with profile <%C#%C>.\n", + library_name, + profile_name)); + } + + ::CIAO::NDDS::DDS_DomainParticipant_i* p = dynamic_cast < ::CIAO::NDDS::DDS_DomainParticipant_i*> (this->dp_.in ()); + + ::DDS::DataWriter_var retval = p->create_datawriter (ccm_dds_dw); + if (ccm_dds_drl) + { + ccm_dds_drl->set_dds_entity (retval.in ()); + } + ccm_dds_dw->enable (); + return retval._retn (); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::delete_datawriter (::DDS::DataWriter_ptr a_datawriter) + { + DDS4CCM_TRACE ("DDS_Publisher_i::delete_datawriter"); + + DDS_DataWriter_Base *top = dynamic_cast< DDS_DataWriter_Base * > (a_datawriter); + + if (!top) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_Publisher_i::delete_datawriter - " + "Unable to cast provided object reference to servant.\n")); + return ::DDS::RETCODE_BAD_PARAMETER; + } + + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_SUCCESSFUL, (LM_TRACE, DDS4CCM_INFO + "DDS_Publisher_i::delete_datawriter - " + "Successfully casted provided object reference to servant.\n")); + + DDS_ReturnCode_t const retval = this->rti_entity ()->delete_datawriter (top->get_rti_entity ()); + + if (retval != DDS_RETCODE_OK) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_Publisher_i::delete_datawriter - " + "Error: RTI delete_datawriter returned non-ok error code %C\n", + ::CIAO::DDS4CCM::translate_retcode (retval))); + } + else + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO + "DDS_Publisher_i::delete_datawriter - " + "Provided datawriter successfully deleted\n")); + } + + return retval; + } + + + ::DDS::DataWriter_ptr + DDS_Publisher_i::lookup_datawriter (const char * impl_name) + { + DDSDataWriter* dw = this->rti_entity ()->lookup_datawriter (impl_name); + ::CIAO::NDDS::DDS_DomainParticipant_i* p = dynamic_cast < ::CIAO::NDDS::DDS_DomainParticipant_i*> (this->dp_.in ()); + ::DDS::DataWriter_var retval = p->create_datawriter (dw); + return retval._retn (); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::delete_contained_entities (void) + { + return this->rti_entity ()->delete_contained_entities (); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::set_qos (const ::DDS::PublisherQos & qos) + { + DDS4CCM_TRACE ("DDS_Publisher_i::set_qos"); + ::DDS_PublisherQos ccm_dds_qos; + ccm_dds_qos <<= qos; + return this->rti_entity ()->set_qos (ccm_dds_qos); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::get_qos (::DDS::PublisherQos & qos) + { + DDS4CCM_TRACE ("DDS_Publisher_i::get_qos"); + ::DDS_PublisherQos ccm_dds_qos; + ccm_dds_qos <<= qos; + ::DDS::ReturnCode_t retcode = this->rti_entity ()-> + get_qos (ccm_dds_qos); + qos <<= ccm_dds_qos; + return retcode; + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::set_listener ( + ::DDS::PublisherListener_ptr a_listener, + ::DDS::StatusMask mask) + { + DDS4CCM_TRACE ("DDS_Publisher_i::set_listener"); + + // Delete the previously set listener + DDSPublisherListener *listener = this->rti_entity ()->get_listener (); + delete listener; + + DDS_PublisherListener_i * ccm_dds_impl_list = 0; + if (! ::CORBA::is_nil (a_listener)) + { + ACE_NEW_THROW_EX (ccm_dds_impl_list, + DDS_PublisherListener_i (a_listener, this->dp_.in ()), + ::CORBA::NO_MEMORY ()); + } + return this->rti_entity ()->set_listener (ccm_dds_impl_list, mask); + } + + + ::DDS::PublisherListener_ptr + DDS_Publisher_i::get_listener (void) + { + DDS4CCM_TRACE ("DDS_Publisher_i::get_listener"); + + DDSPublisherListener *ccm_dds_pub_list = this->rti_entity ()->get_listener (); + DDS_PublisherListener_i * list_proxy = + dynamic_cast <DDS_PublisherListener_i *> (ccm_dds_pub_list); + if (!list_proxy) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_Publisher_i::get_listener - " + "DDS returned a NIL listener.\n")); + return ::DDS::PublisherListener::_nil (); + } + return list_proxy->get_publisher_listener (); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::suspend_publications (void) + { + return this->rti_entity ()->suspend_publications (); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::resume_publications (void) + { + return this->rti_entity ()->resume_publications (); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::begin_coherent_changes (void) + { + return this->rti_entity ()->begin_coherent_changes (); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::end_coherent_changes (void) + { + return this->rti_entity ()->end_coherent_changes (); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::wait_for_acknowledgments ( + const ::DDS::Duration_t & max_wait) + { + DDS_Duration_t ccm_dds_dds_duration; + ccm_dds_dds_duration <<= max_wait; + return this->rti_entity ()->wait_for_acknowledgments (ccm_dds_dds_duration); + } + + + ::DDS::DomainParticipant_ptr + DDS_Publisher_i::get_participant (void) + { + DDS4CCM_TRACE ("DDS_Publisher_i::get_participant"); + return ::DDS::DomainParticipant::_duplicate (this->dp_.in ()); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::set_default_datawriter_qos (const ::DDS::DataWriterQos & qos) + { + DDS4CCM_TRACE ("DDS_Publisher_i::set_default_datawriter_qos"); + ::DDS_DataWriterQos ccm_dds_qos; + ccm_dds_qos <<= qos; + return this->rti_entity ()->set_default_datawriter_qos (ccm_dds_qos); + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::get_default_datawriter_qos (::DDS::DataWriterQos & qos) + { + DDS4CCM_TRACE ("DDS_Publisher_i::get_default_datawriter_qos"); + ::DDS_DataWriterQos ccm_dds_qos; + ::DDS::ReturnCode_t retcode = + this->rti_entity ()->get_default_datawriter_qos (ccm_dds_qos); + qos <<= ccm_dds_qos; + return retcode; + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::copy_from_topic_qos (::DDS::DataWriterQos & a_dataimpl_qos, + const ::DDS::TopicQos & a_impl_qos) + { + DDS4CCM_TRACE ("DDS_Publisher_i::copy_from_topic_qos"); + ::DDS_DataWriterQos ccm_dds_qos; + ::DDS_TopicQos ccm_dds_topic_qos; + + ccm_dds_qos <<= a_dataimpl_qos; + ccm_dds_topic_qos <<= a_impl_qos; + ::DDS::ReturnCode_t const retcode = + this->rti_entity ()->copy_from_topic_qos (ccm_dds_qos, ccm_dds_topic_qos); + a_dataimpl_qos <<= ccm_dds_qos; + return retcode; + } + + + ::DDS::ReturnCode_t + DDS_Publisher_i::enable (void) + { + return this->rti_entity ()->enable (); + } + + + ::DDS::StatusCondition_ptr + DDS_Publisher_i::get_statuscondition (void) + { + ::DDS::StatusCondition_var retval; + DDSStatusCondition* sc = this->rti_entity ()->get_statuscondition (); + ACE_NEW_THROW_EX (retval, + DDS_StatusCondition_i (sc, 0), // @todo + ::CORBA::NO_MEMORY ()); + return retval._retn (); + } + + + ::DDS::StatusMask + DDS_Publisher_i::get_status_changes (void) + { + return this->rti_entity ()->get_status_changes (); + } + + + ::DDS::InstanceHandle_t + DDS_Publisher_i::get_instance_handle (void) + { + ::DDS_InstanceHandle_t const rtihandle = this->rti_entity ()->get_instance_handle (); + ::DDS::InstanceHandle_t handle; + handle <<= rtihandle; + return handle; + } + + + DDSPublisher * + DDS_Publisher_i::get_rti_entity (void) + { + return this->rti_entity_; + } + + DDSPublisher * + DDS_Publisher_i::rti_entity (void) + { + if (!this->rti_entity_) + { + throw ::CORBA::BAD_INV_ORDER (); + } + return this->rti_entity_; + } + } +} + diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Publisher_T.h b/CIAO/connectors/dds4ccm/impl/ndds/Publisher.h index 8a2d59f5d3a..cea2dc04712 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/Publisher_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/Publisher.h @@ -10,45 +10,27 @@ #ifndef PUBLISHER_T_H_ #define PUBLISHER_T_H_ +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "dds4ccm/idl/dds_rtf2_dcpsC.h" +#include "tao/LocalObject.h" -# include "ndds/ndds_cpp.h" +class DDSPublisher; namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_DataWriter_T; - - template <typename DDS_TYPE> - class DDS_DataWriterListener_T; - - template <typename DDS_TYPE> - class DDS_PublisherListener_T; - - template <typename DDS_TYPE> - class DDS_DomainParticipant_T; - - template <typename DDS_TYPE> - class DDS_Publisher_T : + class DDS4CCM_NDDS_Export DDS_Publisher_i : public virtual ::DDS::Publisher, public virtual ::CORBA::LocalObject { - typedef DDS_Topic_T<DDS_TYPE> Topic_type; - - typedef DDS_DataWriter_T<DDS_TYPE> DataWriter_type; - typedef DDS_DataWriterListener_T<DDS_TYPE> DataWriterListener_type; - - typedef DDS_PublisherListener_T<DDS_TYPE> PublisherListener_type; - typedef DDS_DomainParticipant_T<DDS_TYPE> DomainParticipant_type; public: /// Constructor - DDS_Publisher_T (DDSPublisher * dw, - DDS_DomainParticipant_T<DDS_TYPE>* dp); + DDS_Publisher_i (DDSPublisher * p, + ::DDS::DomainParticipant_ptr dp); /// Destructor - virtual ~DDS_Publisher_T (void); + virtual ~DDS_Publisher_i (void); virtual ::DDS::DataWriter_ptr create_datawriter (::DDS::Topic_ptr a_topic, @@ -125,19 +107,15 @@ namespace CIAO virtual ::DDS::InstanceHandle_t get_instance_handle (void); - DDSPublisher * get_impl (void); - - void set_impl (DDSPublisher *p); + DDSPublisher * get_rti_entity (void); private: - DDSPublisher *impl_; - DDS_DomainParticipant_T<DDS_TYPE>* dp_; + DDSPublisher *rti_entity_; + ::DDS::DomainParticipant_var dp_; - DDSPublisher *impl (void); + DDSPublisher *rti_entity (void); }; } } -#include "dds4ccm/impl/ndds/Publisher_T.cpp" - #endif /* PUBLISHER_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSPublisherListener_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/PublisherListener.cpp index 9141e8b5f95..3e97e2b3cd5 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSPublisherListener_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/PublisherListener.cpp @@ -1,8 +1,9 @@ // $Id$ -#include "dds4ccm/impl/ndds/DDSPublisherListener_T.h" -#include "dds4ccm/impl/ndds/Publisher_T.h" +#include "dds4ccm/impl/ndds/PublisherListener.h" +#include "dds4ccm/impl/ndds/Publisher.h" #include "dds4ccm/impl/ndds/DataWriter_T.h" +#include "dds4ccm/impl/ndds/DomainParticipant.h" #include "dds4ccm/impl/ndds/convertors/PublicationMatchedStatus.h" #include "dds4ccm/impl/ndds/convertors/LivelinessLostStatus.h" @@ -11,45 +12,51 @@ #include "dds4ccm/impl/ndds/convertors/ReliableReaderActivityChangedStatus.h" #include "dds4ccm/impl/ndds/convertors/ReliableWriterCacheChangedStatus.h" -#include "dds4ccm/idl/dds4ccm_BaseC.h" - #include "dds4ccm/impl/logger/Log_Macros.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - DDS_PublisherListener_T<DDS_TYPE>::DDS_PublisherListener_T ( ::DDS::PublisherListener_ptr p) - : impl_ (::DDS::PublisherListener::_duplicate (p)) + DDS_PublisherListener_i::DDS_PublisherListener_i ( + ::DDS::PublisherListener_ptr p, + ::DDS::DomainParticipant_ptr dp) + : impl_ (::DDS::PublisherListener::_duplicate (p)), + dp_ (::DDS::DomainParticipant::_duplicate (dp)) { - DDS4CCM_TRACE ("DDS_PublisherListener_T<DDS_TYPE>::DDS_PublisherListener_T"); + DDS4CCM_TRACE ("DDS_PublisherListener_i::DDS_PublisherListener_i"); } - template <typename DDS_TYPE> - DDS_PublisherListener_T<DDS_TYPE>::~DDS_PublisherListener_T (void) + DDS_PublisherListener_i::~DDS_PublisherListener_i (void) { - DDS4CCM_TRACE ("DDS_PublisherListener_T<DDS_TYPE>::~DDS_PublisherListener_T"); + DDS4CCM_TRACE ("DDS_PublisherListener_i::~DDS_PublisherListener_i"); } - template <typename DDS_TYPE> ::DDS::DataWriter_ptr - DDS_PublisherListener_T<DDS_TYPE>::get_datawriter_proxy (::DDSDataWriter * the_writer) + DDS_PublisherListener_i::get_datawriter_proxy (::DDSDataWriter * the_writer) { - DDS4CCM_TRACE ("DDS_PublisherListener_T<DDS_TYPE>::get_datawriter_proxy"); + DDS4CCM_TRACE ("DDS_PublisherListener_i::get_datawriter_proxy"); + ::CIAO::NDDS::DDS_DomainParticipant_i* p = dynamic_cast < ::CIAO::NDDS::DDS_DomainParticipant_i*> (this->dp_.in ()); ::DDS::DataWriter_var dds_writer; - ACE_NEW_NORETURN (dds_writer, - DataWriter_type (the_writer)); + if (p) + { + dds_writer = p->create_datawriter (the_writer); + } + else + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, + "DDS_PublisherListener_i::get_datawriter_proxy - " + "No dp_.\n")); + } return dds_writer._retn (); } - template <typename DDS_TYPE> void - DDS_PublisherListener_T<DDS_TYPE>::on_offered_deadline_missed ( + DDS_PublisherListener_i::on_offered_deadline_missed ( ::DDSDataWriter* the_writer, const ::DDS_OfferedDeadlineMissedStatus & status) { - DDS4CCM_TRACE ("DDS_PublisherListener_T<DDS_TYPE>::on_offered_deadline_missed"); + DDS4CCM_TRACE ("DDS_PublisherListener_i::on_offered_deadline_missed"); ::DDS::OfferedDeadlineMissedStatus ddsstatus; ::DDS::DataWriter_var proxy = this->get_datawriter_proxy (the_writer); @@ -57,13 +64,12 @@ namespace CIAO this->impl_->on_offered_deadline_missed (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_PublisherListener_T<DDS_TYPE>::on_offered_incompatible_qos ( + DDS_PublisherListener_i::on_offered_incompatible_qos ( ::DDSDataWriter* the_writer, const ::DDS_OfferedIncompatibleQosStatus & status) { - DDS4CCM_TRACE ("DDS_PublisherListener_T<DDS_TYPE>::on_offered_incompatible_qos"); + DDS4CCM_TRACE ("DDS_PublisherListener_i::on_offered_incompatible_qos"); ::DDS::OfferedIncompatibleQosStatus ddsstatus; ::DDS::DataWriter_var proxy = this->get_datawriter_proxy (the_writer); @@ -71,13 +77,12 @@ namespace CIAO this->impl_->on_offered_incompatible_qos (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_PublisherListener_T<DDS_TYPE>::on_liveliness_lost ( + DDS_PublisherListener_i::on_liveliness_lost ( ::DDSDataWriter* the_writer, const ::DDS_LivelinessLostStatus & status) { - DDS4CCM_TRACE ("DDS_PublisherListener_T<DDS_TYPE>::on_liveliness_lost"); + DDS4CCM_TRACE ("DDS_PublisherListener_i::on_liveliness_lost"); ::DDS::LivelinessLostStatus ddsstatus; ::DDS::DataWriter_var proxy = this->get_datawriter_proxy (the_writer); @@ -85,13 +90,12 @@ namespace CIAO this->impl_->on_liveliness_lost (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_PublisherListener_T<DDS_TYPE>::on_publication_matched ( + DDS_PublisherListener_i::on_publication_matched ( ::DDSDataWriter* the_writer, const ::DDS_PublicationMatchedStatus & status) { - DDS4CCM_TRACE ("DDS_PublisherListener_T<DDS_TYPE>::on_publication_matched"); + DDS4CCM_TRACE ("DDS_PublisherListener_i::on_publication_matched"); ::DDS::PublicationMatchedStatus ddsstatus; ::DDS::DataWriter_var proxy = this->get_datawriter_proxy (the_writer); @@ -99,13 +103,12 @@ namespace CIAO this->impl_->on_publication_matched (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_PublisherListener_T<DDS_TYPE>::on_reliable_reader_activity_changed ( + DDS_PublisherListener_i::on_reliable_reader_activity_changed ( ::DDSDataWriter *the_writer, const ::DDS_ReliableReaderActivityChangedStatus & status) { - DDS4CCM_TRACE ("DDS_PublisherListener_T<DDS_TYPE>::on_reliable_reader_activity_changed"); + DDS4CCM_TRACE ("DDS_PublisherListener_i::on_reliable_reader_activity_changed"); ::DDS::ReliableReaderActivityChangedStatus ddsstatus; ::DDS::DataWriter_var proxy = this->get_datawriter_proxy (the_writer); @@ -113,13 +116,12 @@ namespace CIAO this->impl_->on_reliable_reader_activity_changed (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_PublisherListener_T<DDS_TYPE>::on_reliable_writer_cache_changed ( + DDS_PublisherListener_i::on_reliable_writer_cache_changed ( ::DDSDataWriter* the_writer, const ::DDS_ReliableWriterCacheChangedStatus & status) { - DDS4CCM_TRACE ("DDS_PublisherListener_T<DDS_TYPE>::on_reliable_writer_cache_changed"); + DDS4CCM_TRACE ("DDS_PublisherListener_i::on_reliable_writer_cache_changed"); ::DDS::ReliableWriterCacheChangedStatus ddsstatus; ::DDS::DataWriter_var proxy = this->get_datawriter_proxy (the_writer); @@ -127,9 +129,8 @@ namespace CIAO this->impl_->on_reliable_writer_cache_changed (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> ::DDS::PublisherListener_ptr - DDS_PublisherListener_T<DDS_TYPE>::get_publisher_listener (void) + DDS_PublisherListener_i::get_publisher_listener (void) { return ::DDS::PublisherListener::_duplicate (this->impl_.in ()); } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSPublisherListener_T.h b/CIAO/connectors/dds4ccm/impl/ndds/PublisherListener.h index ca402e60fd1..3d2fb303080 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSPublisherListener_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/PublisherListener.h @@ -11,27 +11,24 @@ #define DDSPUBLISHERLISTENER_T_H_ #include "dds4ccm/idl/dds_rtf2_dcpsC.h" - +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "ndds/ndds_cpp.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_DataWriter_T; - - template <typename DDS_TYPE> - class DDS_PublisherListener_T : - public virtual ::DDSPublisherListener + class DDS4CCM_NDDS_Export DDS_PublisherListener_i : + public ::DDSPublisherListener { - typedef DDS_DataWriter_T<DDS_TYPE> DataWriter_type; public: /// Constructor - DDS_PublisherListener_T (::DDS::PublisherListener_ptr p); + DDS_PublisherListener_i ( + ::DDS::PublisherListener_ptr p, + ::DDS::DomainParticipant_ptr dp); /// Destructor - virtual ~DDS_PublisherListener_T (void); + virtual ~DDS_PublisherListener_i (void); virtual void on_offered_deadline_missed ( @@ -66,6 +63,7 @@ namespace CIAO ::DDS::PublisherListener_ptr get_publisher_listener (void); private: ::DDS::PublisherListener_var impl_; + ::DDS::DomainParticipant_var dp_; ::DDS::DataWriter_ptr get_datawriter_proxy (::DDSDataWriter * the_writer); @@ -73,6 +71,4 @@ namespace CIAO } } -#include "dds4ccm/impl/ndds/DDSPublisherListener_T.cpp" - #endif /* DDSPUBLISHERLISTENER_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Publisher_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Publisher_T.cpp deleted file mode 100644 index 28dee36dde0..00000000000 --- a/CIAO/connectors/dds4ccm/impl/ndds/Publisher_T.cpp +++ /dev/null @@ -1,429 +0,0 @@ -// $Id$ - -#include "dds4ccm/impl/PublisherListener_T.h" -#include "dds4ccm/impl/Utils.h" - -#include "dds4ccm/impl/ndds/Publisher_T.h" -#include "dds4ccm/impl/ndds/Topic_T.h" -#include "dds4ccm/impl/ndds/DataWriter_T.h" -#include "dds4ccm/impl/ndds/StatusCondition.h" -#include "dds4ccm/impl/ndds/DDSDataWriterListener_T.h" -#include "dds4ccm/impl/ndds/convertors/InstanceHandle_t.h" -#include "dds4ccm/impl/ndds/convertors/Duration_t.h" -#include "dds4ccm/impl/ndds/convertors/DataWriterQos.h" -#include "dds4ccm/impl/ndds/convertors/PublisherQos.h" -#include "dds4ccm/impl/ndds/convertors/TopicQos.h" - -#include "dds4ccm/idl/dds4ccm_BaseC.h" - -#include "dds4ccm/impl/logger/Log_Macros.h" - -namespace CIAO -{ - namespace DDS4CCM - { - template <typename DDS_TYPE> - DDS_Publisher_T<DDS_TYPE>::DDS_Publisher_T (DDSPublisher * dw, - DDS_DomainParticipant_T<DDS_TYPE>* dp) - : impl_ (dw), - dp_ (dp) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::DDS_Publisher_T"); - } - - template <typename DDS_TYPE> - DDS_Publisher_T<DDS_TYPE>::~DDS_Publisher_T (void) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::~DDS_Publisher_T"); - } - - template <typename DDS_TYPE> - ::DDS::DataWriter_ptr - DDS_Publisher_T<DDS_TYPE>::create_datawriter ( - ::DDS::Topic_ptr a_topic, - const ::DDS::DataWriterQos &, - ::DDS::DataWriterListener_ptr a_listener, - ::DDS::StatusMask mask) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::create_datawriter"); - - Topic_type * topic = dynamic_cast < Topic_type * > (a_topic); - - if (!topic) - { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datawriter - " - "Error: Unable to cast provided topic to its servant.\n")); - throw ::CCM_DDS::InternalError (::DDS::RETCODE_BAD_PARAMETER, 0); - } - - DDSDataWriterListener *ccm_dds_drl = 0; - if (! ::CORBA::is_nil (a_listener)) - { - ACE_NEW_THROW_EX (ccm_dds_drl, - DataWriterListener_type (a_listener, 0), - ::CORBA::NO_MEMORY ()); - } - DDS_DataWriterQos ccm_dds_qos = DDS_DATAWRITER_QOS_DEFAULT; - DDSDataWriter *ccm_dds_dw = this->impl ()->create_datawriter ( - topic->get_impl (), - ccm_dds_qos, - ccm_dds_drl, - mask); - - if (!ccm_dds_dw) - { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datawriter - " - "Error: RTI Topic returned a nil datawriter.\n")); - delete ccm_dds_drl; - return ::DDS::DataWriter::_nil (); - } - - ::DDS::DataWriter_var retval = this->dp_->create_datawriter (ccm_dds_dw); - ccm_dds_dw->enable (); - return retval._retn (); - } - - template <typename DDS_TYPE> - ::DDS::DataWriter_ptr - DDS_Publisher_T<DDS_TYPE>::create_datawriter_with_profile (::DDS::Topic_ptr a_topic, - const char* library_name, - const char *profile_name, - ::DDS::DataWriterListener_ptr a_listener, - ::DDS::StatusMask mask) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::create_datawriter_with_profile"); - - Topic_type * topic = dynamic_cast < Topic_type * > (a_topic); - - if (!topic) - { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datawriter_with_profile - " - "Error: Unable to cast provided topic to its servant.\n")); - throw ::CCM_DDS::InternalError (::DDS::RETCODE_BAD_PARAMETER, 0); - } - - DDSDataWriterListener *ccm_dds_drl = 0; - if (! ::CORBA::is_nil (a_listener)) - { - ACE_NEW_THROW_EX (ccm_dds_drl, - DataWriterListener_type (a_listener, 0), - ::CORBA::NO_MEMORY ()); - } - DDSDataWriter *ccm_dds_dw = this->impl ()->create_datawriter_with_profile ( - topic->get_impl (), - library_name, - profile_name, - ccm_dds_drl, - mask); - - if (!ccm_dds_dw) - { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datawriter_with_profile - " - "Error: RTI Topic returned a nil datawriter.\n")); - delete ccm_dds_drl; - return ::DDS::DataWriter::_nil (); - } - else - { - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datawriter_with_profile - " - "Successfully created datawriter with profile <%C#%C>.\n", - library_name, - profile_name)); - } - - ::DDS::DataWriter_var retval = this->dp_->create_datawriter (ccm_dds_dw); - ccm_dds_dw->enable (); - - return retval._retn (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::delete_datawriter (::DDS::DataWriter_ptr a_datawriter) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::delete_datawriter"); - - DataWriter_type *top = dynamic_cast< DataWriter_type * > (a_datawriter); - - if (!top) - { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_datawriter - " - "Unable to cast provided object reference to servant.\n")); - return ::DDS::RETCODE_BAD_PARAMETER; - } - - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_SUCCESSFUL, (LM_TRACE, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_datawriter - " - "Successfully casted provided object reference to servant.\n")); - - DDS_ReturnCode_t const retval = this->impl ()->delete_datawriter (top->get_impl ()); - - if (retval != DDS_RETCODE_OK) - { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_datawriter - " - "Error: RTI delete_datawriter returned non-ok error code %C\n", - translate_retcode (retval))); - } - else - { - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_datawriter - " - "Provided datawriter successfully deleted\n")); - } - - return retval; - } - - template <typename DDS_TYPE> - ::DDS::DataWriter_ptr - DDS_Publisher_T<DDS_TYPE>::lookup_datawriter (const char * impl_name) - { - ::DDS::DataWriter_var retval; - DDSDataWriter* dw = this->impl ()->lookup_datawriter (impl_name); - ACE_NEW_THROW_EX (retval, - DataWriter_type (dw), - ::CORBA::NO_MEMORY ()); - return retval._retn (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::delete_contained_entities (void) - { - return this->impl ()->delete_contained_entities (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::set_qos (const ::DDS::PublisherQos & qos) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::set_qos"); - ::DDS_PublisherQos ccm_dds_qos; - ccm_dds_qos <<= qos; - return this->impl ()->set_qos (ccm_dds_qos); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::get_qos (::DDS::PublisherQos & qos) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::get_qos"); - ::DDS_PublisherQos ccm_dds_qos; - ccm_dds_qos <<= qos; - ::DDS::ReturnCode_t retcode = this->impl()-> - get_qos (ccm_dds_qos); - qos <<= ccm_dds_qos; - return retcode; - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::set_listener ( - ::DDS::PublisherListener_ptr a_listener, - ::DDS::StatusMask mask) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::set_listener"); - - // Delete the previously set listener - DDSPublisherListener *listener = this->impl ()->get_listener (); - delete listener; - - PublisherListener_type * ccm_dds_impl_list = 0; - if (! ::CORBA::is_nil (a_listener)) - { - ACE_NEW_THROW_EX (ccm_dds_impl_list, - PublisherListener_type (a_listener), - ::CORBA::NO_MEMORY ()); - } - return this->impl ()->set_listener (ccm_dds_impl_list, mask); - } - - template <typename DDS_TYPE> - ::DDS::PublisherListener_ptr - DDS_Publisher_T<DDS_TYPE>::get_listener (void) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::get_listener"); - - DDSPublisherListener *ccm_dds_pub_list = this->impl ()->get_listener (); - PublisherListener_type * list_proxy = - dynamic_cast <PublisherListener_type *> (ccm_dds_pub_list); - if (!list_proxy) - { - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_Publisher_T<DDS_TYPE, " - "VENDOR_TYPE>::get_listener - " - "DDS returned a NIL listener.\n")); - return ::DDS::PublisherListener::_nil (); - } - return list_proxy->get_publisher_listener (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::suspend_publications (void) - { - return this->impl ()->suspend_publications (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::resume_publications (void) - { - return this->impl ()->resume_publications (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::begin_coherent_changes (void) - { - return this->impl ()->begin_coherent_changes (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::end_coherent_changes (void) - { - return this->impl ()->end_coherent_changes (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::wait_for_acknowledgments ( - const ::DDS::Duration_t & max_wait) - { - DDS_Duration_t ccm_dds_dds_duration; - ccm_dds_dds_duration <<= max_wait; - return this->impl ()->wait_for_acknowledgments (ccm_dds_dds_duration); - } - - template <typename DDS_TYPE> - ::DDS::DomainParticipant_ptr - DDS_Publisher_T<DDS_TYPE>::get_participant (void) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::get_participant"); - ::DDS::DomainParticipant_var retval; - DDSDomainParticipant* p = this->impl ()->get_participant (); - ACE_NEW_THROW_EX (retval, - DomainParticipant_type (p), - ::CORBA::NO_MEMORY ()); - return retval._retn (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::set_default_datawriter_qos (const ::DDS::DataWriterQos & qos) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::set_default_datawriter_qos"); - ::DDS_DataWriterQos ccm_dds_qos; - ccm_dds_qos <<= qos; - return this->impl()->set_default_datawriter_qos (ccm_dds_qos); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::get_default_datawriter_qos (::DDS::DataWriterQos & qos) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::get_default_datawriter_qos"); - ::DDS_DataWriterQos ccm_dds_qos; - ::DDS::ReturnCode_t retcode = - this->impl()->get_default_datawriter_qos (ccm_dds_qos); - qos <<= ccm_dds_qos; - return retcode; - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::copy_from_topic_qos (::DDS::DataWriterQos & a_dataimpl_qos, - const ::DDS::TopicQos & a_impl_qos) - { - DDS4CCM_TRACE ("DDS_Publisher_T<DDS_TYPE>::copy_from_topic_qos"); - ::DDS_DataWriterQos ccm_dds_qos; - ::DDS_TopicQos ccm_dds_topic_qos; - - ccm_dds_qos <<= a_dataimpl_qos; - ccm_dds_topic_qos <<= a_impl_qos; - ::DDS::ReturnCode_t const retcode = - this->impl()->copy_from_topic_qos (ccm_dds_qos, ccm_dds_topic_qos); - a_dataimpl_qos <<= ccm_dds_qos; - return retcode; - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Publisher_T<DDS_TYPE>::enable (void) - { - return this->impl ()->enable (); - } - - template <typename DDS_TYPE> - ::DDS::StatusCondition_ptr - DDS_Publisher_T<DDS_TYPE>::get_statuscondition (void) - { - ::DDS::StatusCondition_var retval; - DDSStatusCondition* sc = this->impl ()->get_statuscondition (); - ACE_NEW_THROW_EX (retval, - DDS_StatusCondition_i (sc), - ::CORBA::NO_MEMORY ()); - return retval._retn (); - } - - template <typename DDS_TYPE> - ::DDS::StatusMask - DDS_Publisher_T<DDS_TYPE>::get_status_changes (void) - { - return this->impl ()->get_status_changes (); - } - - template <typename DDS_TYPE> - ::DDS::InstanceHandle_t - DDS_Publisher_T<DDS_TYPE>::get_instance_handle (void) - { - ::DDS_InstanceHandle_t const rtihandle = this->impl ()->get_instance_handle (); - ::DDS::InstanceHandle_t handle; - handle <<= rtihandle; - return handle; - } - - template <typename DDS_TYPE> - DDSPublisher * - DDS_Publisher_T<DDS_TYPE>::get_impl (void) - { - return this->impl_; - } - - template <typename DDS_TYPE> - void - DDS_Publisher_T<DDS_TYPE>::set_impl (DDSPublisher * dw) - { - this->impl_ = dw; - } - - template <typename DDS_TYPE> - DDSPublisher * - DDS_Publisher_T<DDS_TYPE>::impl (void) - { - if (!this->impl_) - { - throw ::CORBA::BAD_INV_ORDER (); - } - return this->impl_; - } - } -} - diff --git a/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.cpp b/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.cpp new file mode 100644 index 00000000000..572a0ab09e3 --- /dev/null +++ b/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.cpp @@ -0,0 +1,124 @@ +// $Id$ + +#include "ndds/ndds_cpp.h" +#include "dds4ccm/impl/ndds/QueryCondition.h" +#include "dds4ccm/impl/ndds/convertors/StringSeq.h" +#include "dds4ccm/impl/logger/Log_Macros.h" + +namespace CIAO +{ + namespace NDDS + { + DDS_QueryCondition_i::DDS_QueryCondition_i ( + ::DDSQueryCondition * qc, + ::DDS::DataReader_ptr dr) + : rti_entity_ (qc), + dr_ (::DDS::DataReader::_duplicate (dr)) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::DDS_QueryCondition_i"); + } + + DDS_QueryCondition_i::~DDS_QueryCondition_i (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::~DDS_QueryCondition_i"); + } + + ::CORBA::Boolean + DDS_QueryCondition_i::get_trigger_value (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::get_trigger_value"); + + return this->rti_entity ()->get_trigger_value (); + } + + ::DDS::SampleStateMask + DDS_QueryCondition_i::get_sample_state_mask (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::get_sample_state_mask"); + + return this->rti_entity ()->get_sample_state_mask (); + } + + ::DDS::ViewStateMask + DDS_QueryCondition_i::get_view_state_mask (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::get_view_state_mask"); + + return this->rti_entity ()->get_view_state_mask (); + } + + ::DDS::InstanceStateMask + DDS_QueryCondition_i::get_instance_state_mask (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::get_instance_state_mask"); + + return this->rti_entity ()->get_instance_state_mask (); + } + + ::DDS::DataReader_ptr + DDS_QueryCondition_i::get_datareader (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::get_datareader"); + + return ::DDS::DataReader::_duplicate (this->dr_.in ()); + } + + char * + DDS_QueryCondition_i::get_query_expression (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::get_query_expression"); + + return ::CORBA::string_dup (this->rti_entity ()->get_query_expression ()); + } + + ::DDS::ReturnCode_t + DDS_QueryCondition_i::get_query_parameters ( + ::DDS::StringSeq & query_parameters) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::get_query_parameters"); + + DDS_StringSeq parameters; + ::DDS::ReturnCode_t const retval = + this->rti_entity ()->get_query_parameters (parameters); + query_parameters <<= parameters; + return retval; + } + + ::DDS::ReturnCode_t + DDS_QueryCondition_i::set_query_parameters ( + const ::DDS::StringSeq & query_parameters) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_i::set_query_parameters"); + + DDS_StringSeq parameters; + parameters <<= query_parameters; + + return this->rti_entity ()->set_query_parameters (parameters); + } + + DDSQueryCondition * + DDS_QueryCondition_i::get_rti_entity (void) + { + return this->rti_entity_; + } + + void + DDS_QueryCondition_i::set_rti_entity (DDSQueryCondition *entity) + { + this->rti_entity_ = entity; + } + + DDSQueryCondition * + DDS_QueryCondition_i::rti_entity (void) + { + if (!this->rti_entity_) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DDS_QueryCondition_i::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); + throw ::CORBA::BAD_INV_ORDER (); + } + return this->rti_entity_; + } + } +} diff --git a/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition_T.h b/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.h index ac473f92c18..55ebb39adb0 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.h @@ -10,30 +10,27 @@ #ifndef QUERYCONDITION_T_H_ #define QUERYCONDITION_T_H_ +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "dds4ccm/idl/dds_rtf2_dcpsC.h" +#include "tao/LocalObject.h" -#include "ndds/ndds_cpp.h" +class DDSQueryCondition; namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DataReader_T; - - template <typename DDS_TYPE> - class DDS_QueryCondition_T : + class DDS4CCM_NDDS_Export DDS_QueryCondition_i : public virtual ::DDS::QueryCondition, public virtual ::CORBA::LocalObject { - typedef DataReader_T<DDS_TYPE> DataReader_type; - public: /// Constructor - DDS_QueryCondition_T (DDSQueryCondition * qc); + DDS_QueryCondition_i (::DDSQueryCondition * qc, + ::DDS::DataReader_ptr dr); /// Destructor - virtual ~DDS_QueryCondition_T (void); + virtual ~DDS_QueryCondition_i (void); virtual ::CORBA::Boolean get_trigger_value (void); @@ -53,18 +50,17 @@ namespace CIAO virtual ::DDS::ReturnCode_t set_query_parameters (const ::DDS::StringSeq & query_parameters); - DDSQueryCondition * get_impl (void); + ::DDSQueryCondition * get_rti_entity (void); - void set_impl (DDSQueryCondition * qc); + void set_rti_entity (::DDSQueryCondition *entity); private: - DDSQueryCondition * impl_; + ::DDSQueryCondition * rti_entity_; + ::DDS::DataReader_var dr_; - DDSQueryCondition * impl (); + ::DDSQueryCondition * rti_entity (); }; } } -#include "dds4ccm/impl/ndds/QueryCondition_T.cpp" - #endif /* QUERYCONDITION_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition_T.cpp deleted file mode 100644 index 7c1c2882967..00000000000 --- a/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition_T.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// $Id$ - -#include "QueryCondition_T.h" -#include "dds4ccm/impl/ndds/Subscriber_T.h" - -#include "dds4ccm/impl/ndds/convertors/StringSeq.h" - -#include "dds4ccm/idl/dds4ccm_BaseC.h" - -#include "dds4ccm/impl/logger/Log_Macros.h" - -template <typename DDS_TYPE> -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::DDS_QueryCondition_T (DDSQueryCondition * qc) - : impl_ (qc) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::DDS_QueryCondition_T"); -} - -template <typename DDS_TYPE> -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::~DDS_QueryCondition_T (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::~DDS_QueryCondition_T"); -} - -template <typename DDS_TYPE> -::CORBA::Boolean -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::get_trigger_value (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::get_trigger_value"); - - return this->impl ()->get_trigger_value (); -} - -template <typename DDS_TYPE> -::DDS::SampleStateMask -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::get_sample_state_mask (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::get_sample_state_mask"); - - return this->impl ()->get_sample_state_mask (); -} - -template <typename DDS_TYPE> -::DDS::ViewStateMask -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::get_view_state_mask (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::get_view_state_mask"); - - return this->impl ()->get_view_state_mask (); -} - -template <typename DDS_TYPE> -::DDS::InstanceStateMask -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::get_instance_state_mask (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::get_instance_state_mask"); - - return this->impl ()->get_instance_state_mask (); -} - -template <typename DDS_TYPE> -::DDS::DataReader_ptr -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::get_datareader (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::get_datareader"); - - ::DDS::DataReader_var dds_reader; - DDSDataReader* reader = this->impl ()->get_datareader (); - if (reader) - { - ACE_NEW_THROW_EX (dds_reader, - DataReader_type (reader), - ::CORBA::NO_MEMORY ()); - } - return dds_reader._retn (); -} - -template <typename DDS_TYPE> -char * -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::get_query_expression (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::get_query_expression"); - - return ::CORBA::string_dup (this->impl ()->get_query_expression ()); -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::get_query_parameters ( - ::DDS::StringSeq & query_parameters) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::get_query_parameters"); - - DDS_StringSeq parameters; - ::DDS::ReturnCode_t const retval = - this->impl ()->get_query_parameters (parameters); - query_parameters <<= parameters; - return retval; -} - -template <typename DDS_TYPE> -::DDS::ReturnCode_t -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::set_query_parameters ( - const ::DDS::StringSeq & query_parameters) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_QueryCondition_T::set_query_parameters"); - - DDS_StringSeq parameters; - parameters <<= query_parameters; - - return this->impl ()->set_query_parameters (parameters); -} - -template <typename DDS_TYPE> -DDSQueryCondition * -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::get_impl (void) -{ - return this->impl_; -} - -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::set_impl (DDSQueryCondition * dw) -{ - this->impl_ = dw; -} - -template <typename DDS_TYPE> -DDSQueryCondition * -CIAO::DDS4CCM::DDS_QueryCondition_T<DDS_TYPE>::impl (void) -{ - if (!this->impl_) - { - throw ::CORBA::BAD_INV_ORDER (); - } - return this->impl_; -} - diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.cpp b/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.cpp new file mode 100644 index 00000000000..73b5aa0d161 --- /dev/null +++ b/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.cpp @@ -0,0 +1,91 @@ +// $Id$ + +#include "dds4ccm/impl/ndds/ReadCondition.h" +#include "dds4ccm/impl/logger/Log_Macros.h" +#include "ndds/ndds_cpp.h" + +namespace CIAO +{ + namespace NDDS + { + DDS_ReadCondition_i::DDS_ReadCondition_i ( + ::DDSReadCondition * rc, + ::DDS::DataReader_ptr dr) + : rti_entity_ (rc), + dr_ (::DDS::DataReader::_duplicate (dr)) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_i::DDS_ReadCondition_i"); + } + + DDS_ReadCondition_i::~DDS_ReadCondition_i (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_i::~DDS_ReadCondition_i"); + } + + ::CORBA::Boolean + DDS_ReadCondition_i::get_trigger_value (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_i::get_trigger_value"); + + return this->rti_entity ()->get_trigger_value (); + } + + ::DDS::SampleStateMask + DDS_ReadCondition_i::get_sample_state_mask (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_i::get_sample_state_mask"); + + return this->rti_entity ()->get_sample_state_mask (); + } + + ::DDS::ViewStateMask + DDS_ReadCondition_i::get_view_state_mask (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_i::get_view_state_mask"); + + return this->rti_entity ()->get_view_state_mask (); + } + + ::DDS::InstanceStateMask + DDS_ReadCondition_i::get_instance_state_mask (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_i::get_instance_state_mask"); + + return this->rti_entity ()->get_instance_state_mask (); + } + + ::DDS::DataReader_ptr + DDS_ReadCondition_i::get_datareader (void) + { + DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_i::get_datareader"); + + return ::DDS::DataReader::_duplicate (this->dr_.in ()); + } + + DDSReadCondition * + DDS_ReadCondition_i::get_rti_entity (void) + { + return this->rti_entity_; + } + + void + DDS_ReadCondition_i::set_rti_entity (DDSReadCondition *entity) + { + this->rti_entity_ = entity; + } + + DDSReadCondition * + DDS_ReadCondition_i::rti_entity (void) + { + if (!this->rti_entity_) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DDS_ReadCondition_i::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); + throw ::CORBA::BAD_INV_ORDER (); + } + return this->rti_entity_; + } + } +} + diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition_T.h b/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.h index 77af56fb2bd..6d121b36bc6 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.h @@ -10,30 +10,27 @@ #ifndef READCONDITION_T_H_ #define READCONDITION_T_H_ +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "dds4ccm/idl/dds_rtf2_dcpsC.h" +#include "tao/LocalObject.h" -#include "ndds/ndds_cpp.h" +class DDSReadCondition; namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DataReader_T; - - template <typename DDS_TYPE> - class DDS_ReadCondition_T : + class DDS4CCM_NDDS_Export DDS_ReadCondition_i : public virtual ::DDS::ReadCondition, public virtual ::CORBA::LocalObject { - typedef DataReader_T<DDS_TYPE> DataReader_type; - public: /// Constructor - DDS_ReadCondition_T (DDSReadCondition * rc); + DDS_ReadCondition_i (::DDSReadCondition * rc, + ::DDS::DataReader_ptr dr); /// Destructor - virtual ~DDS_ReadCondition_T (void); + virtual ~DDS_ReadCondition_i (void); virtual ::CORBA::Boolean get_trigger_value (void); @@ -45,18 +42,17 @@ namespace CIAO virtual ::DDS::DataReader_ptr get_datareader (void); - DDSReadCondition * get_impl (void); + ::DDSReadCondition * get_rti_entity (void); - void set_impl (DDSReadCondition * rc); + void set_rti_entity (::DDSReadCondition* entity); private: - DDSReadCondition *impl_; + ::DDSReadCondition *rti_entity_; + ::DDS::DataReader_var dr_; - DDSReadCondition * impl (void); + ::DDSReadCondition * rti_entity (void); }; } } -#include "dds4ccm/impl/ndds/ReadCondition_T.cpp" - #endif /* READCONDITION_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition_T.cpp deleted file mode 100644 index 349fba12d3b..00000000000 --- a/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition_T.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// $Id$ - -#include "ReadCondition_T.h" - -template <typename DDS_TYPE> -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::DDS_ReadCondition_T ( - DDSReadCondition * rc) - : impl_ (rc) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_T::DDS_ReadCondition_T"); -} - -template <typename DDS_TYPE> -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::~DDS_ReadCondition_T (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_T::~DDS_ReadCondition_T"); -} - -template <typename DDS_TYPE> -::CORBA::Boolean -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::get_trigger_value (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_T::get_trigger_value"); - - return this->impl ()->get_trigger_value (); -} - -template <typename DDS_TYPE> -::DDS::SampleStateMask -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::get_sample_state_mask (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_T::get_sample_state_mask"); - - return this->impl ()->get_sample_state_mask (); -} - -template <typename DDS_TYPE> -::DDS::ViewStateMask -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::get_view_state_mask (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_T::get_view_state_mask"); - - return this->impl ()->get_view_state_mask (); -} - -template <typename DDS_TYPE> -::DDS::InstanceStateMask -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::get_instance_state_mask (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_T::get_instance_state_mask"); - - return this->impl ()->get_instance_state_mask (); -} - -template <typename DDS_TYPE> -::DDS::DataReader_ptr -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::get_datareader (void) -{ - DDS4CCM_TRACE ("CIAO::DDS4CCM::DDS_ReadCondition_T::get_datareader"); - - ::DDS::DataReader_var retval; - DDSDataReader* rd = this->impl ()->get_datareader (); - if (rd) - { - ACE_NEW_THROW_EX (retval, - DataReader_type (rd), - ::CORBA::NO_MEMORY ()); - } - return retval._retn (); -} - -template <typename DDS_TYPE> -DDSReadCondition * -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::get_impl (void) -{ - return this->impl_; -} - -template <typename DDS_TYPE> -void -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::set_impl ( - DDSReadCondition * rc) -{ - this->impl_ = rc; -} - -template <typename DDS_TYPE> -DDSReadCondition * -CIAO::DDS4CCM::DDS_ReadCondition_T<DDS_TYPE>::impl (void) -{ - if (!this->impl_) - { - throw ::CORBA::BAD_INV_ORDER (); - } - return this->impl_; -} - diff --git a/CIAO/connectors/dds4ccm/impl/ndds/StatusCondition.cpp b/CIAO/connectors/dds4ccm/impl/ndds/StatusCondition.cpp index e8d5b09e0e4..b7483e36ee1 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/StatusCondition.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/StatusCondition.cpp @@ -1,19 +1,18 @@ // $Id$ -#include "StatusCondition.h" -#include "Subscriber_T.h" - -#include "dds4ccm/idl/dds4ccm_BaseC.h" - +#include "dds4ccm/impl/ndds/StatusCondition.h" #include "dds4ccm/impl/logger/Log_Macros.h" +#include "ndds/ndds_cpp.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { DDS_StatusCondition_i::DDS_StatusCondition_i ( - DDSStatusCondition * sc) : - impl_ (sc) + ::DDSStatusCondition * sc, + ::DDS::Entity_ptr entity) : + rti_entity_ (sc), + entity_ (::DDS::Entity::_duplicate (entity)) { } @@ -24,48 +23,45 @@ namespace CIAO ::CORBA::Boolean DDS_StatusCondition_i::get_trigger_value (void) { - return this->impl ()->get_trigger_value (); + return this->rti_entity ()->get_trigger_value (); } ::DDS::StatusMask DDS_StatusCondition_i::get_enabled_statuses (void) { - return this->impl ()->get_enabled_statuses (); + return this->rti_entity ()->get_enabled_statuses (); } ::DDS::ReturnCode_t DDS_StatusCondition_i::set_enabled_statuses ( ::DDS::StatusMask mask) { - return this->impl ()->set_enabled_statuses (mask); + return this->rti_entity ()->set_enabled_statuses (mask); } ::DDS::Entity_ptr DDS_StatusCondition_i::get_entity (void) { - throw ::CORBA::NO_IMPLEMENT (); - } - - DDSStatusCondition * - DDS_StatusCondition_i::get_impl (void) - { - return this->impl_; + return ::DDS::Entity::_duplicate (this->entity_.in ()); } - void - DDS_StatusCondition_i::set_impl (DDSStatusCondition * sc) + ::DDSStatusCondition * + DDS_StatusCondition_i::get_rti_entity (void) { - this->impl_ = sc; + return this->rti_entity_; } - DDSStatusCondition * - DDS_StatusCondition_i::impl (void) + ::DDSStatusCondition * + DDS_StatusCondition_i::rti_entity (void) { - if (!this->impl_) + if (!this->rti_entity_) { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DDS_StatusCondition_i::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); throw ::CORBA::BAD_INV_ORDER (); } - return this->impl_; + return this->rti_entity_; } } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/StatusCondition.h b/CIAO/connectors/dds4ccm/impl/ndds/StatusCondition.h index f23a1fa89ea..7335b98f71e 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/StatusCondition.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/StatusCondition.h @@ -10,17 +10,15 @@ #ifndef DDS4CCM_STATUSCONDITION_H #define DDS4CCM_STATUSCONDITION_H -#include "dds4ccm/idl/dds_rtf2_dcpsC.h" - #include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" - +#include "dds4ccm/idl/dds_rtf2_dcpsC.h" #include "tao/LocalObject.h" -#include "ndds/ndds_cpp.h" +class DDSStatusCondition; namespace CIAO { - namespace DDS4CCM + namespace NDDS { class DDS4CCM_NDDS_Export DDS_StatusCondition_i : public virtual ::DDS::StatusCondition, @@ -28,7 +26,8 @@ namespace CIAO { public: /// Constructor - DDS_StatusCondition_i (DDSStatusCondition *sc); + DDS_StatusCondition_i (::DDSStatusCondition *sc, + ::DDS::Entity_ptr entity); /// Destructor virtual ~DDS_StatusCondition_i (void); @@ -41,13 +40,12 @@ namespace CIAO virtual ::DDS::Entity_ptr get_entity (void); - DDSStatusCondition * get_impl (void); - - void set_impl (DDSStatusCondition * sc); + ::DDSStatusCondition * get_rti_entity (void); private: - DDSStatusCondition * impl_; - DDSStatusCondition * impl (void); + ::DDSStatusCondition * rti_entity_; + ::DDS::Entity_var entity_; + ::DDSStatusCondition * rti_entity (void); }; } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Subscriber_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp index 9b40643a163..ea5c0cee3c9 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/Subscriber_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp @@ -1,85 +1,78 @@ // $Id$ -#include "dds4ccm/impl/ndds/Subscriber_T.h" -#include "dds4ccm/impl/ndds/Topic_T.h" -#include "dds4ccm/impl/ndds/ContentFilteredTopic_T.h" +#include "dds4ccm/impl/ndds/Subscriber.h" +#include "dds4ccm/impl/ndds/Topic.h" +#include "dds4ccm/impl/ndds/ContentFilteredTopic.h" #include "dds4ccm/impl/ndds/DataReader_T.h" -#include "dds4ccm/impl/ndds/DDSDataReaderListener_T.h" +#include "dds4ccm/impl/ndds/DataReaderListener.h" #include "dds4ccm/impl/ndds/StatusCondition.h" +#include "dds4ccm/impl/ndds/DomainParticipant.h" #include "dds4ccm/impl/Utils.h" -#include "dds4ccm/impl/SubscriberListener_T.h" +#include "dds4ccm/impl/ndds/SubscriberListener.h" -#include "convertors/InstanceHandle_t.h" -#include "convertors/DataReaderQos.h" -#include "convertors/SubscriberQos.h" -#include "convertors/TopicQos.h" - -#include "dds4ccm/idl/dds4ccm_BaseC.h" +#include "dds4ccm/impl/ndds/convertors/InstanceHandle_t.h" +#include "dds4ccm/impl/ndds/convertors/DataReaderQos.h" +#include "dds4ccm/impl/ndds/convertors/SubscriberQos.h" +#include "dds4ccm/impl/ndds/convertors/TopicQos.h" #include "dds4ccm/impl/logger/Log_Macros.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - DDS_Subscriber_T<DDS_TYPE>::DDS_Subscriber_T (DDSSubscriber * sub, - DDS_DomainParticipant_T<DDS_TYPE>* dp) - : impl_ (sub), - dp_ (dp) + DDS_Subscriber_i::DDS_Subscriber_i (::DDSSubscriber * sub, + ::DDS::DomainParticipant_ptr dp) + : rti_entity_ (sub), + dp_ (::DDS::DomainParticipant::_duplicate (dp)) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::DDS_Subscriber_T"); + DDS4CCM_TRACE ("DDS_Subscriber_i::DDS_Subscriber_i"); } - template <typename DDS_TYPE> - DDS_Subscriber_T<DDS_TYPE>::~DDS_Subscriber_T (void) + DDS_Subscriber_i::~DDS_Subscriber_i (void) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::~DDS_Subscriber_T"); + DDS4CCM_TRACE ("DDS_Subscriber_i::~DDS_Subscriber_i"); } - template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::enable (void) + DDS_Subscriber_i::enable (void) { - return this->impl ()->enable (); + return this->rti_entity ()->enable (); } - template <typename DDS_TYPE> ::DDS::StatusCondition_ptr - DDS_Subscriber_T<DDS_TYPE>::get_statuscondition (void) + DDS_Subscriber_i::get_statuscondition (void) { ::DDS::StatusCondition_var retval; - DDSStatusCondition* sc = this->impl ()->get_statuscondition (); + ::DDSStatusCondition* sc = this->rti_entity ()->get_statuscondition (); if (sc) { ACE_NEW_THROW_EX (retval, - DDS_StatusCondition_i (sc), + DDS_StatusCondition_i (sc, this->dp_.in ()), ::CORBA::NO_MEMORY ()); } return retval._retn (); } - template <typename DDS_TYPE> ::DDS::StatusMask - DDS_Subscriber_T<DDS_TYPE>::get_status_changes (void) + DDS_Subscriber_i::get_status_changes (void) { - return this->impl ()->get_status_changes (); + return this->rti_entity ()->get_status_changes (); } - template <typename DDS_TYPE> ::DDS::InstanceHandle_t - DDS_Subscriber_T<DDS_TYPE>::get_instance_handle (void) + DDS_Subscriber_i::get_instance_handle (void) { - ::DDS_InstanceHandle_t const rtihandle = this->impl ()->get_instance_handle (); + ::DDS_InstanceHandle_t const rtihandle = + this->rti_entity ()->get_instance_handle (); ::DDS::InstanceHandle_t handle; handle <<= rtihandle; return handle; } - template <typename DDS_TYPE> DDSDataReader * - DDS_Subscriber_T<DDS_TYPE>::create_datareader ( + DDS_Subscriber_i::create_datareader ( DDSContentFilteredTopic * topic, DDSDataReaderListener * ccm_dds_drl, ::DDS::StatusMask mask, @@ -87,15 +80,14 @@ namespace CIAO { ACE_UNUSED_ARG (qos); DDS_DataReaderQos ccm_dds_qos = DDS_DATAREADER_QOS_DEFAULT; - return this->impl ()->create_datareader (topic, + return this->rti_entity ()->create_datareader (topic, ccm_dds_qos, ccm_dds_drl, mask); } - template <typename DDS_TYPE> DDSDataReader * - DDS_Subscriber_T<DDS_TYPE>::create_datareader ( + DDS_Subscriber_i::create_datareader ( DDSTopic * topic, DDSDataReaderListener * ccm_dds_drl, ::DDS::StatusMask mask, @@ -103,94 +95,89 @@ namespace CIAO { ACE_UNUSED_ARG (qos); DDS_DataReaderQos ccm_dds_qos = DDS_DATAREADER_QOS_DEFAULT; - return this->impl ()->create_datareader (topic, + return this->rti_entity ()->create_datareader (topic, ccm_dds_qos, ccm_dds_drl, mask); } - template <typename DDS_TYPE> DDSDataReader * - DDS_Subscriber_T<DDS_TYPE>::create_datareader_with_profile ( + DDS_Subscriber_i::create_datareader_with_profile ( DDSContentFilteredTopic * topic, const char * library_name, const char * profile_name, DDSDataReaderListener * ccm_dds_drl, ::DDS::StatusMask mask) { - return this->impl ()->create_datareader_with_profile (topic, + return this->rti_entity ()->create_datareader_with_profile (topic, library_name, profile_name, ccm_dds_drl, mask); } - template <typename DDS_TYPE> DDSDataReader * - DDS_Subscriber_T<DDS_TYPE>::create_datareader_with_profile ( + DDS_Subscriber_i::create_datareader_with_profile ( DDSTopic * topic, const char * library_name, const char * profile_name, DDSDataReaderListener * ccm_dds_drl, ::DDS::StatusMask mask) { - return this->impl ()->create_datareader_with_profile (topic, + return this->rti_entity ()->create_datareader_with_profile (topic, library_name, profile_name, ccm_dds_drl, mask); } - template <typename DDS_TYPE> ::DDS::DataReader_ptr - DDS_Subscriber_T<DDS_TYPE>::create_datareader ( + DDS_Subscriber_i::create_datareader ( ::DDS::TopicDescription_ptr a_topic, const ::DDS::DataReaderQos & qos, ::DDS::DataReaderListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::create_datareader"); - ::DDS::DataReader_var retval; - DDSDataReaderListener *ccm_dds_drl = 0; + DDS4CCM_TRACE ("DDS_Subscriber_i::create_datareader"); + DDS_DataReaderListener_i *ccm_dds_drl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_drl, - DataReaderListener_type (a_listener, 0), + DDS_DataReaderListener_i (a_listener, ::DDS::DataReader::_nil ()), ::CORBA::NO_MEMORY ()); } DDSDataReader * ccm_dds_dr = 0; - Topic_type* topic = dynamic_cast < Topic_type * > (a_topic); + DDS_Topic_i* topic = dynamic_cast < DDS_Topic_i * > (a_topic); if (!topic) { - ContentFilteredTopic_type * cf_topic = - dynamic_cast < ContentFilteredTopic_type * > (a_topic); + DDS_ContentFilteredTopic_i * cf_topic = + dynamic_cast < DDS_ContentFilteredTopic_i * > (a_topic); if (!cf_topic) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datareader - Error: Unable to " + "DDS_Subscriber_i::create_datareader - Error: Unable to " "cast provided topic to one of its servant.\n")); delete ccm_dds_drl; return ::DDS::DataReader::_nil (); } else - ccm_dds_dr = this->create_datareader (cf_topic->get_impl (), + ccm_dds_dr = this->create_datareader (cf_topic->get_rti_entity (), ccm_dds_drl, mask, qos); } else - ccm_dds_dr = this->create_datareader (topic->get_impl (), + ccm_dds_dr = this->create_datareader (topic->get_rti_entity (), ccm_dds_drl, mask, qos); if (!ccm_dds_dr) { - DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO "DDS_Subscriber_T" - "<DDS_TYPE>::create_datareader - " + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO "DDS_Subscriber_i" + "::create_datareader - " "Error: RTI Topic returned a nil datareader.\n")); delete ccm_dds_drl; return ::DDS::DataReader::_nil (); @@ -198,48 +185,49 @@ namespace CIAO else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datareader - " + "DDS_Subscriber_i::create_datareader - " "Successfully created datareader.\n")); } + ::CIAO::NDDS::DDS_DomainParticipant_i* p = dynamic_cast < ::CIAO::NDDS::DDS_DomainParticipant_i*> (this->dp_.in ()); + ::DDS::DataReader_var reader = p->create_datareader (ccm_dds_dr); + if (ccm_dds_drl) + { + ccm_dds_drl->set_dds_entity (reader.in ()); + } ccm_dds_dr->enable (); - ACE_NEW_THROW_EX (retval, - DataReader_type (ccm_dds_dr), - ::CORBA::NO_MEMORY ()); - return retval._retn (); + return reader._retn (); } - template <typename DDS_TYPE> + ::DDS::DataReader_ptr - DDS_Subscriber_T<DDS_TYPE>::create_datareader_with_profile ( + DDS_Subscriber_i::create_datareader_with_profile ( ::DDS::TopicDescription_ptr a_topic, const char * library_name, const char * profile_name, ::DDS::DataReaderListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::create_datareader_with_profile"); - DDSDataReaderListener *ccm_dds_drl = 0; + DDS4CCM_TRACE ("DDS_Subscriber_i::create_datareader_with_profile"); + DDS_DataReaderListener_i *ccm_dds_drl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_drl, - DataReaderListener_type (a_listener, 0), + DDS_DataReaderListener_i (a_listener, ::DDS::DataReader::_nil ()), ::CORBA::NO_MEMORY ()); } DDSDataReader * ccm_dds_dr = 0; - Topic_type * topic = dynamic_cast < Topic_type * > (a_topic); + DDS_Topic_i * topic = dynamic_cast < DDS_Topic_i * > (a_topic); if (!topic) { - ContentFilteredTopic_type * cf_topic = - dynamic_cast < ContentFilteredTopic_type * > (a_topic); + DDS_ContentFilteredTopic_i * cf_topic = + dynamic_cast < DDS_ContentFilteredTopic_i * > (a_topic); if (!cf_topic) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datareader_with_profile - " + "DDS_Subscriber_i::create_datareader_with_profile - " "Error: Unable to cast provided topic to one " "of its servant.\n")); delete ccm_dds_drl; @@ -247,7 +235,7 @@ namespace CIAO } else { - ccm_dds_dr = this->create_datareader_with_profile (cf_topic->get_impl (), + ccm_dds_dr = this->create_datareader_with_profile (cf_topic->get_rti_entity (), library_name, profile_name, ccm_dds_drl, @@ -256,7 +244,7 @@ namespace CIAO } else { - ccm_dds_dr = this->create_datareader_with_profile (topic->get_impl (), + ccm_dds_dr = this->create_datareader_with_profile (topic->get_rti_entity (), library_name, profile_name, ccm_dds_drl, @@ -266,8 +254,7 @@ namespace CIAO if (!ccm_dds_dr) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datareader_with_profile - " + "DDS_Subscriber_i::create_datareader_with_profile - " "Error: RTI Topic returned a nil datareader.\n")); delete ccm_dds_drl; throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0); @@ -275,282 +262,265 @@ namespace CIAO else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::create_datareader_with_profile - " + "DDS_Subscriber_i::create_datareader_with_profile - " "Successfully created datareader with profile <%C#%C>.\n", library_name, profile_name)); } - ::DDS::DataReader_var retval = this->dp_->create_datareader (ccm_dds_dr); - + ::CIAO::NDDS::DDS_DomainParticipant_i* p = dynamic_cast < ::CIAO::NDDS::DDS_DomainParticipant_i*> (this->dp_.in ()); + ::DDS::DataReader_var reader = p->create_datareader (ccm_dds_dr); + if (ccm_dds_drl) + { + ccm_dds_drl->set_dds_entity (reader.in ()); + } ccm_dds_dr->enable (); - - return retval._retn (); + return reader._retn (); } - template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::delete_datareader ( + DDS_Subscriber_i::delete_datareader ( ::DDS::DataReader_ptr a_datareader) { - DataReader_type *dr = dynamic_cast< DataReader_type *> (a_datareader); + DDS_DataReader_Base *dr = dynamic_cast< DDS_DataReader_Base *> (a_datareader); if (!dr) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_datareader -Unable to cast " + "DDS_Subscriber_i::delete_datareader - Unable to cast " "provided object reference to servant.\n")); return ::DDS::RETCODE_BAD_PARAMETER; } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_CAST_SUCCESSFUL, (LM_TRACE, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_datareader - " + "DDS_Subscriber_i::delete_datareader - " "Successfully casted provided object reference " "to servant.\n")); - DDS_ReturnCode_t const retval = this->impl ()->delete_datareader (dr->get_impl ()); + DDS_ReturnCode_t const retval = this->rti_entity ()->delete_datareader (dr->get_rti_entity ()); if (retval != DDS_RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_datareader - " + "DDS_Subscriber_i::delete_datareader - " "Error: Returned non-ok error code %C\n", - translate_retcode (retval))); + ::CIAO::DDS4CCM::translate_retcode (retval))); } else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::delete_datareader - " - "Datareader successfully deleted\n")); + "DDS_Subscriber_i::delete_datareader - " + "Datareader successfully deleted\n")); } return retval; } - template <typename DDS_TYPE> ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::delete_contained_entities (void) + DDS_Subscriber_i::delete_contained_entities (void) { - return this->impl ()->delete_contained_entities (); + return this->rti_entity ()->delete_contained_entities (); } - template <typename DDS_TYPE> ::DDS::DataReader_ptr - DDS_Subscriber_T<DDS_TYPE>::lookup_datareader ( + DDS_Subscriber_i::lookup_datareader ( const char * impl_name) { ::DDS::DataReader_var retval; - DDSDataReader* dr = this->impl ()->lookup_datareader (impl_name); + DDSDataReader* dr = this->rti_entity ()->lookup_datareader (impl_name); if (dr) { - ACE_NEW_THROW_EX (retval, - DataReader_type (dr), - ::CORBA::NO_MEMORY ()); + ::CIAO::NDDS::DDS_DomainParticipant_i* p = dynamic_cast < ::CIAO::NDDS::DDS_DomainParticipant_i*> (this->dp_.in ()); + retval = p->create_datareader (dr); } - return retval._retn (); + return retval._retn(); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::get_datareaders ( + DDS_Subscriber_i::get_datareaders ( ::DDS::DataReaderSeq & readers, ::DDS::SampleStateMask sample_states, ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::set_qos"); + DDS4CCM_TRACE ("DDS_Subscriber_i::set_qos"); ::DDSDataReaderSeq dds_readers; ::DDS_ReturnCode_t retcode = - this->impl ()->get_datareaders (dds_readers, + this->rti_entity ()->get_datareaders (dds_readers, sample_states, view_states, instance_states); if (retcode == DDS_RETCODE_OK) { + ::CIAO::NDDS::DDS_DomainParticipant_i* p = dynamic_cast < ::CIAO::NDDS::DDS_DomainParticipant_i*> (this->dp_.in ()); readers.length (dds_readers.length ()); for (::DDS_Long i = 0; i < dds_readers.length (); ++i) { - ::DDS::DataReader_var rdr; - ACE_NEW_THROW_EX (rdr, - DataReader_type (dds_readers[i]), - ::CORBA::NO_MEMORY ()); + ::DDS::DataReader_var rdr = p->create_datareader (dds_readers[i]); readers [i] = rdr._retn (); } } return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::notify_datareaders (void) + DDS_Subscriber_i::notify_datareaders (void) { - return this->impl ()->notify_datareaders (); + return this->rti_entity ()->notify_datareaders (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::set_qos ( + DDS_Subscriber_i::set_qos ( const ::DDS::SubscriberQos & qos) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::set_qos"); + DDS4CCM_TRACE ("DDS_Subscriber_i::set_qos"); ::DDS_SubscriberQos ccm_dds_qos; ccm_dds_qos <<= qos; - return this->impl ()->get_qos (ccm_dds_qos); + return this->rti_entity ()->get_qos (ccm_dds_qos); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::get_qos ( + DDS_Subscriber_i::get_qos ( ::DDS::SubscriberQos & qos) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::get_qos"); + DDS4CCM_TRACE ("DDS_Subscriber_i::get_qos"); ::DDS_SubscriberQos ccm_dds_qos; - ::DDS::ReturnCode_t retcode = this->impl ()->get_qos (ccm_dds_qos); + ::DDS::ReturnCode_t retcode = this->rti_entity ()->get_qos (ccm_dds_qos); qos <<= ccm_dds_qos; return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::set_listener ( + DDS_Subscriber_i::set_listener ( ::DDS::SubscriberListener_ptr a_listener, ::DDS::StatusMask mask) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::set_listener"); + DDS4CCM_TRACE ("DDS_Subscriber_i::set_listener"); // Delete the previously set listener - DDSSubscriberListener *listener = this->impl ()->get_listener (); + DDSSubscriberListener *listener = this->rti_entity ()->get_listener (); delete listener; + listener = 0; - SubscriberListener_type * ccm_dds_impl_list = 0; if (! ::CORBA::is_nil (a_listener)) { - ACE_NEW_THROW_EX (ccm_dds_impl_list, - SubscriberListener_type (a_listener), + ACE_NEW_THROW_EX (listener, + DDS_SubscriberListener_i (a_listener, this->dp_.in ()), ::CORBA::NO_MEMORY ()); } - return this->impl ()->set_listener (ccm_dds_impl_list, mask); + return this->rti_entity ()->set_listener (listener, mask); } - template <typename DDS_TYPE> + ::DDS::SubscriberListener_ptr - DDS_Subscriber_T<DDS_TYPE>::get_listener (void) + DDS_Subscriber_i::get_listener (void) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::get_listener"); + DDS4CCM_TRACE ("DDS_Subscriber_i::get_listener"); - DDSSubscriberListener *ccm_dds_impl_list = this->impl ()->get_listener (); - SubscriberListener_type *list_proxy = - dynamic_cast <SubscriberListener_type *> (ccm_dds_impl_list); + DDSSubscriberListener *ccm_dds_impl_list = this->rti_entity ()->get_listener (); + DDS_SubscriberListener_i *list_proxy = + dynamic_cast <DDS_SubscriberListener_i *> (ccm_dds_impl_list); if (!list_proxy) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_Subscriber_T<DDS_TYPE, " - "VENDOR_TYPE>::get_listener - " + "DDS_Subscriber_i::get_listener - " "DDS returned a NIL listener.\n")); return ::DDS::SubscriberListener::_nil (); } return list_proxy->get_subscriber_listener (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::begin_access (void) + DDS_Subscriber_i::begin_access (void) { - return this->impl ()->begin_access (); + return this->rti_entity ()->begin_access (); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::end_access (void) + DDS_Subscriber_i::end_access (void) { - return this->impl ()->end_access (); + return this->rti_entity ()->end_access (); } - template <typename DDS_TYPE> + ::DDS::DomainParticipant_ptr - DDS_Subscriber_T<DDS_TYPE>::get_participant (void) + DDS_Subscriber_i::get_participant (void) { - ::DDS::DomainParticipant_var retval; - DDSDomainParticipant* p = this->impl ()->get_participant (); - if (p) - { - ACE_NEW_THROW_EX (retval, - DomainParticipant_type (p), - ::CORBA::NO_MEMORY ()); - } - return retval._retn (); + return DDS::DomainParticipant::_duplicate (this->dp_.in ()); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::set_default_datareader_qos ( + DDS_Subscriber_i::set_default_datareader_qos ( const ::DDS::DataReaderQos & qos) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::set_default_datareader_qos"); + DDS4CCM_TRACE ("DDS_Subscriber_i::set_default_datareader_qos"); ::DDS_DataReaderQos ccm_dds_qos; ccm_dds_qos <<= qos; - return this->impl ()->set_default_datareader_qos (ccm_dds_qos); + return this->rti_entity ()->set_default_datareader_qos (ccm_dds_qos); } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::get_default_datareader_qos ( + DDS_Subscriber_i::get_default_datareader_qos ( ::DDS::DataReaderQos & qos) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::get_default_datareader_qos"); + DDS4CCM_TRACE ("DDS_Subscriber_i::get_default_datareader_qos"); ::DDS_DataReaderQos ccm_dds_qos; - ::DDS::ReturnCode_t retcode = this->impl ()->get_default_datareader_qos (ccm_dds_qos); + ::DDS::ReturnCode_t retcode = this->rti_entity ()->get_default_datareader_qos (ccm_dds_qos); qos <<= ccm_dds_qos; return retcode; } - template <typename DDS_TYPE> + ::DDS::ReturnCode_t - DDS_Subscriber_T<DDS_TYPE>::copy_from_topic_qos ( + DDS_Subscriber_i::copy_from_topic_qos ( ::DDS::DataReaderQos & a_datareader_qos, const ::DDS::TopicQos & a_impl_qos) { - DDS4CCM_TRACE ("DDS_Subscriber_T<DDS_TYPE>::copy_from_topic_qos"); + DDS4CCM_TRACE ("DDS_Subscriber_i::copy_from_topic_qos"); ::DDS_DataReaderQos ccm_dds_qos; ::DDS_TopicQos ccm_dds_topic_qos; ccm_dds_qos <<= a_datareader_qos; ccm_dds_topic_qos <<= a_impl_qos; ::DDS::ReturnCode_t retcode = - this->impl()->copy_from_topic_qos (ccm_dds_qos, + this->rti_entity ()->copy_from_topic_qos (ccm_dds_qos, ccm_dds_topic_qos); a_datareader_qos <<= ccm_dds_qos; return retcode; } - template <typename DDS_TYPE> DDSSubscriber * - DDS_Subscriber_T<DDS_TYPE>::get_impl (void) + DDS_Subscriber_i::get_rti_entity (void) { - return this->impl_; + return this->rti_entity_; } - template <typename DDS_TYPE> void - DDS_Subscriber_T<DDS_TYPE>::set_impl (DDSSubscriber * sub) + DDS_Subscriber_i::set_rti_entity (DDSSubscriber * sub) { - this->impl_ = sub; + this->rti_entity_ = sub; } - template <typename DDS_TYPE> DDSSubscriber * - DDS_Subscriber_T<DDS_TYPE>::impl (void) + DDS_Subscriber_i::rti_entity (void) { - if (!this->impl_) + if (!this->rti_entity_) { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DDS_Subscriber_i::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); throw ::CORBA::BAD_INV_ORDER (); } - return this->impl_; + return this->rti_entity_; } } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Subscriber_T.h b/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.h index 8cefd2e0db1..09b14377419 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/Subscriber_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.h @@ -11,52 +11,26 @@ #define SUBSCRIBER_T_H_ #include "dds4ccm/idl/dds_rtf2_dcpsC.h" - #include "dds4ccm/impl/ndds/DataReader_T.h" - #include "tao/LocalObject.h" -#include "ndds/ndds_cpp.h" +class DDSSubscriber; namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_DataReaderListener_T; - - template <typename DDS_TYPE> - class DDS_Topic_T; - - template <typename DDS_TYPE> - class DDS_ContentFilteredTopic_T; - - template <typename DDS_TYPE> - class DDS_SubscriberListener_T; - - template <typename DDS_TYPE> - class DDS_DomainParticipant_T; - - template <typename DDS_TYPE> - class DDS_Subscriber_T : + class DDS4CCM_NDDS_Export DDS_Subscriber_i : public virtual ::DDS::Subscriber, public virtual ::CORBA::LocalObject { - - typedef DDS_DataReaderListener_T<DDS_TYPE> DataReaderListener_type; - typedef DDS_Topic_T<DDS_TYPE> Topic_type; - typedef DDS_ContentFilteredTopic_T<DDS_TYPE> ContentFilteredTopic_type; - typedef DataReader_T<DDS_TYPE> DataReader_type; - typedef DDS_SubscriberListener_T<DDS_TYPE> SubscriberListener_type; - typedef DDS_DomainParticipant_T<DDS_TYPE> DomainParticipant_type; - public: /// Constructor - DDS_Subscriber_T (DDSSubscriber * sub, - DDS_DomainParticipant_T<DDS_TYPE>* dp); + DDS_Subscriber_i (::DDSSubscriber * sub, + ::DDS::DomainParticipant_ptr dp); /// Destructor - virtual ~DDS_Subscriber_T (void); + virtual ~DDS_Subscriber_i (void); virtual ::DDS::ReturnCode_t enable (void); @@ -126,15 +100,15 @@ namespace CIAO ::DDS::DataReaderQos & a_datareader_qos, const ::DDS::TopicQos & a_impl_qos); - DDSSubscriber * get_impl (void); + ::DDSSubscriber * get_rti_entity (void); - void set_impl (DDSSubscriber * sub); + void set_rti_entity (::DDSSubscriber * sub); private: - DDSSubscriber *impl_; - DDS_DomainParticipant_T<DDS_TYPE>* dp_; + DDSSubscriber *rti_entity_; + ::DDS::DomainParticipant_var dp_; - DDSSubscriber *impl (void); + DDSSubscriber *rti_entity (void); DDSDataReader * create_datareader ( @@ -169,6 +143,4 @@ namespace CIAO } } -#include "dds4ccm/impl/ndds/Subscriber_T.cpp" - #endif /* SUBSCRIBER_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSSubscriberListener_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/SubscriberListener.cpp index 608d0f45d02..9438a1f931f 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSSubscriberListener_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/SubscriberListener.cpp @@ -1,7 +1,8 @@ // $Id$ -#include "dds4ccm/impl/ndds/DDSSubscriberListener_T.h" -#include "dds4ccm/impl/ndds/Subscriber_T.h" +#include "dds4ccm/impl/ndds/SubscriberListener.h" +#include "dds4ccm/impl/ndds/Subscriber.h" +#include "dds4ccm/impl/ndds/DomainParticipant.h" #include "dds4ccm/impl/ndds/convertors/SampleLostStatus.h" #include "dds4ccm/impl/ndds/convertors/SubscriptionMatchedStatus.h" @@ -14,54 +15,51 @@ namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - DDS_SubscriberListener_T<DDS_TYPE>::DDS_SubscriberListener_T (::DDS::SubscriberListener_ptr p) - : impl_ ( ::DDS::SubscriberListener::_duplicate (p)) + DDS_SubscriberListener_i::DDS_SubscriberListener_i ( + ::DDS::SubscriberListener_ptr p, + ::DDS::DomainParticipant_ptr dp) + : impl_ ( ::DDS::SubscriberListener::_duplicate (p)), + dp_ (::DDS::DomainParticipant::_duplicate (dp)) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::DDS_SubscriberListener_T"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::DDS_SubscriberListener_i"); } - template <typename DDS_TYPE> - DDS_SubscriberListener_T<DDS_TYPE>::~DDS_SubscriberListener_T (void) + DDS_SubscriberListener_i::~DDS_SubscriberListener_i (void) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::~DDS_SubscriberListener_T"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::~DDS_SubscriberListener_i"); } - template <typename DDS_TYPE> void - DDS_SubscriberListener_T<DDS_TYPE>::on_data_on_readers ( + DDS_SubscriberListener_i::on_data_on_readers ( ::DDSSubscriber* the_subscriber) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::on_data_on_readers"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::on_data_on_readers"); ::DDS::Subscriber_var sub; ACE_NEW (sub, - Subscriber_type (the_subscriber, 0)); //@todo + DDS_Subscriber_i (the_subscriber, dp_.in ())); this->impl_->on_data_on_readers (sub.in ()); the_subscriber->notify_datareaders (); } - template <typename DDS_TYPE> ::DDS::DataReader_ptr - DDS_SubscriberListener_T<DDS_TYPE>::get_datareader_proxy ( + DDS_SubscriberListener_i::get_datareader_proxy ( ::DDSDataReader * the_reader) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::get_datareader_proxy"); - ::DDS::DataReader_var dds_reader; - ACE_NEW_NORETURN (dds_reader, - DataReader_type (the_reader)); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::get_datareader_proxy"); + ::CIAO::NDDS::DDS_DomainParticipant_i* p = dynamic_cast < ::CIAO::NDDS::DDS_DomainParticipant_i*> (this->dp_.in ()); + ::DDS::DataReader_var dds_reader = p->create_datareader (the_reader); return dds_reader._retn (); } - template <typename DDS_TYPE> void - DDS_SubscriberListener_T<DDS_TYPE>::on_requested_deadline_missed ( + DDS_SubscriberListener_i::on_requested_deadline_missed ( ::DDSDataReader* the_reader, const ::DDS_RequestedDeadlineMissedStatus & status) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::on_requested_deadline_missed"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::on_requested_deadline_missed"); ::DDS::RequestedDeadlineMissedStatus ddsstatus; ::DDS::DataReader_var proxy = this->get_datareader_proxy (the_reader); @@ -69,13 +67,12 @@ namespace CIAO this->impl_->on_requested_deadline_missed (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_SubscriberListener_T<DDS_TYPE>::on_requested_incompatible_qos ( + DDS_SubscriberListener_i::on_requested_incompatible_qos ( ::DDSDataReader* the_reader, const ::DDS_RequestedIncompatibleQosStatus & status) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::on_requested_incompatible_qos"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::on_requested_incompatible_qos"); ::DDS::RequestedIncompatibleQosStatus ddsstatus; ::DDS::DataReader_var proxy = this->get_datareader_proxy (the_reader); @@ -83,13 +80,12 @@ namespace CIAO this->impl_->on_requested_incompatible_qos (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_SubscriberListener_T<DDS_TYPE>::on_sample_rejected ( + DDS_SubscriberListener_i::on_sample_rejected ( ::DDSDataReader* the_reader, const ::DDS_SampleRejectedStatus & status) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::on_sample_rejected"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::on_sample_rejected"); ::DDS::SampleRejectedStatus ddsstatus; ::DDS::DataReader_var proxy = this->get_datareader_proxy (the_reader); @@ -97,13 +93,12 @@ namespace CIAO this->impl_->on_sample_rejected (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_SubscriberListener_T<DDS_TYPE>::on_liveliness_changed ( + DDS_SubscriberListener_i::on_liveliness_changed ( ::DDSDataReader* the_reader, const ::DDS_LivelinessChangedStatus & status) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::on_liveliness_changed"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::on_liveliness_changed"); ::DDS::LivelinessChangedStatus ddsstatus; ::DDS::DataReader_var proxy = this->get_datareader_proxy (the_reader); @@ -111,24 +106,22 @@ namespace CIAO this->impl_->on_liveliness_changed (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_SubscriberListener_T<DDS_TYPE>::on_data_available ( + DDS_SubscriberListener_i::on_data_available ( ::DDSDataReader* the_reader) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::on_data_available"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::on_data_available"); ::DDS::DataReader_var proxy = this->get_datareader_proxy (the_reader); this->impl_->on_data_available (proxy.in ()); } - template <typename DDS_TYPE> void - DDS_SubscriberListener_T<DDS_TYPE>::on_subscription_matched ( + DDS_SubscriberListener_i::on_subscription_matched ( ::DDSDataReader* the_reader, const ::DDS_SubscriptionMatchedStatus & status) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::on_subscription_matched"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::on_subscription_matched"); ::DDS::SubscriptionMatchedStatus ddsstatus; ::DDS::DataReader_var proxy = this->get_datareader_proxy (the_reader); @@ -136,13 +129,12 @@ namespace CIAO this->impl_->on_subscription_matched (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> void - DDS_SubscriberListener_T<DDS_TYPE>::on_sample_lost ( + DDS_SubscriberListener_i::on_sample_lost ( ::DDSDataReader* the_reader, const ::DDS_SampleLostStatus & status) { - DDS4CCM_TRACE ("DDS_SubscriberListener_T<DDS_TYPE>::on_sample_lost"); + DDS4CCM_TRACE ("DDS_SubscriberListener_i::on_sample_lost"); ::DDS::SampleLostStatus ddsstatus; ::DDS::DataReader_var proxy = this->get_datareader_proxy (the_reader); @@ -150,9 +142,8 @@ namespace CIAO this->impl_->on_sample_lost (proxy.in (), ddsstatus); } - template <typename DDS_TYPE> ::DDS::SubscriberListener_ptr - DDS_SubscriberListener_T<DDS_TYPE>::get_subscriber_listener (void) + DDS_SubscriberListener_i::get_subscriber_listener (void) { return ::DDS::SubscriberListener::_duplicate (this->impl_.in ()); } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSSubscriberListener_T.h b/CIAO/connectors/dds4ccm/impl/ndds/SubscriberListener.h index 4f7ccb20c63..0108869faf9 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSSubscriberListener_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/SubscriberListener.h @@ -11,31 +11,24 @@ #define DDSSUBSCRIBERLISTENER_T_H_ #include "dds4ccm/idl/dds_rtf2_dcpsC.h" - +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "ndds/ndds_cpp.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DataReader_T; - - template <typename DDS_TYPE> - class DDS_Subscriber_T; - - template <typename DDS_TYPE> - class DDS_SubscriberListener_T : - public virtual ::DDSSubscriberListener + class DDS4CCM_NDDS_Export DDS_SubscriberListener_i : + public ::DDSSubscriberListener { - typedef DDS_Subscriber_T<DDS_TYPE> Subscriber_type; - typedef DataReader_T<DDS_TYPE> DataReader_type; public: /// Constructor - DDS_SubscriberListener_T ( ::DDS::SubscriberListener_ptr s); + DDS_SubscriberListener_i ( + ::DDS::SubscriberListener_ptr s, + ::DDS::DomainParticipant_ptr dp); /// Destructor - virtual ~DDS_SubscriberListener_T (void); + virtual ~DDS_SubscriberListener_i (void); virtual void on_requested_deadline_missed ( @@ -78,6 +71,7 @@ namespace CIAO ::DDS::SubscriberListener_ptr get_subscriber_listener (void); private: ::DDS::SubscriberListener_var impl_; + ::DDS::DomainParticipant_var dp_; ::DDS::DataReader_ptr get_datareader_proxy (::DDSDataReader * the_reader); @@ -85,7 +79,5 @@ namespace CIAO } } -#include "dds4ccm/impl/ndds/DDSSubscriberListener_T.cpp" - #endif /* DDSSUBSCRIBERLISTENER_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Topic.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Topic.cpp new file mode 100644 index 00000000000..bbd31b2132a --- /dev/null +++ b/CIAO/connectors/dds4ccm/impl/ndds/Topic.cpp @@ -0,0 +1,158 @@ +// $Id$ + +#include "dds4ccm/impl/ndds/Topic.h" +#include "dds4ccm/impl/ndds/StatusCondition.h" +#include "dds4ccm/impl/ndds/TopicListener.h" + +#include "dds4ccm/impl/ndds/convertors/InstanceHandle_t.h" +#include "dds4ccm/impl/ndds/convertors/InconsistentTopicStatus.h" +#include "dds4ccm/impl/ndds/convertors/TopicQos.h" + +#include "dds4ccm/impl/logger/Log_Macros.h" + +namespace CIAO +{ + namespace NDDS + { + DDS_Topic_i::DDS_Topic_i (::DDSTopic* topic, + ::DDS::DomainParticipant_ptr dp) + : rti_entity_ (topic), + dp_ (::DDS::DomainParticipant::_duplicate (dp)) + { + } + + DDS_Topic_i::~DDS_Topic_i (void) + { + } + + ::DDS::ReturnCode_t + DDS_Topic_i::set_qos (const ::DDS::TopicQos &qos) + { + ::DDS_TopicQos ddsqos; + ddsqos <<= qos; + return this->rti_entity ()->set_qos (ddsqos); + } + + ::DDS::ReturnCode_t + DDS_Topic_i::get_qos (::DDS::TopicQos &qos) + { + ::DDS_TopicQos ddsqos; + ::DDS_ReturnCode_t const retval = this->rti_entity ()->get_qos (ddsqos); + qos <<= ddsqos; + return retval; + } + + ::DDS::ReturnCode_t + DDS_Topic_i::set_listener ( + ::DDS::TopicListener_ptr a_listener, + ::DDS::StatusMask mask) + { + DDS4CCM_TRACE ("DDS_Topic_i::set_listener"); + + // Delete the previously set listener + DDSTopicListener *listener = this->rti_entity ()->get_listener (); + delete listener; + listener = 0; + + this->topic_listener_ = ::DDS::TopicListener::_duplicate (a_listener); + + if (! ::CORBA::is_nil (a_listener)) + { + ACE_NEW_THROW_EX (listener, + DDS_TopicListener_i (this, a_listener), + ::CORBA::NO_MEMORY ()); + + } + return this->rti_entity ()->set_listener (listener, mask); + } + + ::DDS::TopicListener_ptr + DDS_Topic_i::get_listener (void) + { + DDS4CCM_TRACE ("DDS_Topic_i::get_listener"); + + return ::DDS::TopicListener::_duplicate (this->topic_listener_.in ()); + } + + ::DDS::ReturnCode_t + DDS_Topic_i::get_inconsistent_topic_status ( + ::DDS::InconsistentTopicStatus & a_status) + { + DDS_InconsistentTopicStatus ddsstatus; + ::DDS::ReturnCode_t const retval = + this->rti_entity ()->get_inconsistent_topic_status (ddsstatus); + a_status <<= ddsstatus; + return retval; + } + + ::DDS::ReturnCode_t + DDS_Topic_i::enable (void) + { + return this->rti_entity ()->enable (); + } + + ::DDS::StatusCondition_ptr + DDS_Topic_i::get_statuscondition (void) + { + ::DDS::StatusCondition_var retval; + DDSStatusCondition* sc = this->rti_entity ()->get_statuscondition (); + ACE_NEW_THROW_EX (retval, + DDS_StatusCondition_i (sc, this->dp_.in ()), + ::CORBA::NO_MEMORY ()); + return retval._retn (); + } + + ::DDS::StatusMask + DDS_Topic_i::get_status_changes (void) + { + return this->rti_entity ()->get_status_changes (); + } + + ::DDS::InstanceHandle_t + DDS_Topic_i::get_instance_handle (void) + { + ::DDS_InstanceHandle_t const rtihandle = + this->rti_entity ()->get_instance_handle (); + ::DDS::InstanceHandle_t handle; + handle <<= rtihandle; + return handle; + } + + char * + DDS_Topic_i::get_type_name (void) + { + return CORBA::string_dup (this->rti_entity ()->get_type_name ()); + } + + char * + DDS_Topic_i::get_name (void) + { + return CORBA::string_dup (this->rti_entity ()->get_name ()); + } + + ::DDS::DomainParticipant_ptr + DDS_Topic_i::get_participant (void) + { + return ::DDS::DomainParticipant::_duplicate (this->dp_.in ()); + } + + DDSTopic * + DDS_Topic_i::get_rti_entity (void) + { + return this->rti_entity_; + } + + DDSTopic * + DDS_Topic_i::rti_entity (void) + { + if (!this->rti_entity_) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DDS_Topic_i::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); + throw ::CORBA::BAD_INV_ORDER (); + } + return this->rti_entity_; + } + } +} diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Topic_T.h b/CIAO/connectors/dds4ccm/impl/ndds/Topic.h index 02f6fde2f03..2bc1cefb067 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/Topic_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/Topic.h @@ -1,5 +1,4 @@ /** - * @author William R. Otte <wotte@dre.vanderbilt.edu> * @author Johnny Willemsen <jwillemsen@remedy.nl> * * $Id$ @@ -10,29 +9,27 @@ #ifndef NDDS_TOPIC_H #define NDDS_TOPIC_H -#include "dds4ccm/impl/ndds/DomainParticipant_T.h" -#include "dds4ccm/impl/ndds/DDSTopicListener_T.h" - +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" +#include "dds4ccm/idl/dds_rtf2_dcpsC.h" #include "tao/LocalObject.h" +class DDSTopic; + namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_Topic_T : + class DDS4CCM_NDDS_Export DDS_Topic_i : public virtual ::DDS::Topic, public virtual ::CORBA::LocalObject { - typedef DDS_TopicListener_T<DDS_TYPE> TopicListener_type; - typedef DDS_DomainParticipant_T<DDS_TYPE> DomainParticipant_type; - public: /// Constructor - DDS_Topic_T (DDSTopic* topic); + DDS_Topic_i (::DDSTopic* topic, + ::DDS::DomainParticipant_ptr dp); /// Destructor - virtual ~DDS_Topic_T (void); + virtual ~DDS_Topic_i (void); virtual ::DDS::ReturnCode_t set_qos (const ::DDS::TopicQos & qos); @@ -61,18 +58,18 @@ namespace CIAO virtual ::DDS::DomainParticipant_ptr get_participant (void); - DDSTopic * get_impl (void); + ::DDSTopic * get_rti_entity (void); - void set_impl (DDSTopic* topic); + void get_rti_entity (::DDSTopic* topic); private: - DDSTopic * impl_; + ::DDSTopic * rti_entity_; + ::DDS::DomainParticipant_var dp_; + ::DDS::TopicListener_var topic_listener_; - DDSTopic * impl (void); + DDSTopic * rti_entity (void); }; } } -#include "dds4ccm/impl/ndds/Topic_T.cpp" - #endif diff --git a/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription.cpp b/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription.cpp new file mode 100644 index 00000000000..8378fcf10a9 --- /dev/null +++ b/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription.cpp @@ -0,0 +1,61 @@ +// $Id$ + +#include "dds4ccm/impl/ndds/TopicDescription.h" +#include "dds4ccm/impl/logger/Log_Macros.h" +#include "ndds/ndds_cpp.h" + +namespace CIAO +{ + namespace NDDS + { + DDS_TopicDescription_i::DDS_TopicDescription_i ( + ::DDSTopicDescription * rc, + ::DDS::DomainParticipant_ptr dp) : + rti_entity_ (rc), + dp_ (::DDS::DomainParticipant::_duplicate (dp)) + { + } + + DDS_TopicDescription_i::~DDS_TopicDescription_i (void) + { + } + + char * + DDS_TopicDescription_i::get_type_name (void) + { + return CORBA::string_dup (this->rti_entity ()->get_type_name ()); + } + + char * + DDS_TopicDescription_i::get_name (void) + { + return CORBA::string_dup (this->rti_entity ()->get_name ()); + } + + ::DDS::DomainParticipant_ptr + DDS_TopicDescription_i::get_participant (void) + { + return ::DDS::DomainParticipant::_duplicate (this->dp_.in ()); + } + + ::DDSTopicDescription * + DDS_TopicDescription_i::get_rti_entity (void) + { + return this->rti_entity_; + } + + ::DDSTopicDescription * + DDS_TopicDescription_i::rti_entity (void) + { + if (!this->rti_entity_) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, + "DDS_TopicDescription_i::rti_entity - " + "Throwing BAD_INV_ORDER.\n")); + throw ::CORBA::BAD_INV_ORDER (); + } + return this->rti_entity_; + } + } +} + diff --git a/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription_T.h b/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription.h index 68d4ba2f149..15be9193827 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription.h @@ -10,30 +10,27 @@ #ifndef TOPICDESCRIPTION_T_H_ #define TOPICDESCRIPTION_T_H_ +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "dds4ccm/idl/dds_rtf2_dcpsC.h" +#include "tao/LocalObject.h" -#include "ndds/ndds_cpp.h" +class DDSTopicDescription; namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_DomainParticipant; - - template <typename DDS_TYPE> - class DDS_TopicDescription_T : + class DDS4CCM_NDDS_Export DDS_TopicDescription_i : public virtual ::DDS::TopicDescription, public virtual ::CORBA::LocalObject { - typedef DDS_DomainParticipant<DDS_TYPE> DomainParticipant_type; - public: /// Constructor - DDS_TopicDescription_T (DDSTopicDescription * rc); + DDS_TopicDescription_i (::DDSTopicDescription * rc, + ::DDS::DomainParticipant_ptr dp); /// Destructor - virtual ~DDS_TopicDescription_T (void); + virtual ~DDS_TopicDescription_i (void); virtual char * get_type_name (void); @@ -41,18 +38,15 @@ namespace CIAO virtual ::DDS::DomainParticipant_ptr get_participant (void); - DDSTopicDescription * get_impl (void); - - void set_impl (DDSTopicDescription * rc); + ::DDSTopicDescription * get_rti_entity (void); private: - DDSTopicDescription * impl_; + ::DDSTopicDescription * rti_entity_; + ::DDS::DomainParticipant_var dp_; - DDSTopicDescription * impl (void); + ::DDSTopicDescription * rti_entity (void); }; } } -#include "dds4ccm/impl/ndds/TopicDescription_T.cpp" - #endif /* TOPICDESCRIPTION_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription_T.cpp deleted file mode 100644 index 8e6eedc1eba..00000000000 --- a/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription_T.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// $Id$ - -#include "TopicDescription_T.h" -#include "DomainParticipant_T.h" - -#include "dds4ccm/idl/dds4ccm_BaseC.h" -#include "dds4ccm/impl/logger/Log_Macros.h" - -namespace CIAO -{ - namespace DDS4CCM - { - template <typename DDS_TYPE> - DDS_TopicDescription_T<DDS_TYPE>::DDS_TopicDescription_T ( - DDSTopicDescription * rc) : impl_ (rc) - { - } - - template <typename DDS_TYPE> - DDS_TopicDescription_T<DDS_TYPE>::~DDS_TopicDescription_T (void) - { - } - - template <typename DDS_TYPE> - char * - DDS_TopicDescription_T<DDS_TYPE>::get_type_name (void) - { - return CORBA::string_dup (this->impl ()->get_type_name ()); - } - - template <typename DDS_TYPE> - char * - DDS_TopicDescription_T<DDS_TYPE>::get_name (void) - { - return CORBA::string_dup (this->impl ()->get_name ()); - } - - template <typename DDS_TYPE> - ::DDS::DomainParticipant_ptr - DDS_TopicDescription_T<DDS_TYPE>::get_participant (void) - { - ::DDS::DomainParticipant_var retval; - DDSDomainParticipant* p = this->impl ()->get_participant (); - if (p) - { - ACE_NEW_THROW_EX (retval, - DomainParticipant_type (p), - ::CORBA::NO_MEMORY ()); - } - return retval._retn (); - } - - template <typename DDS_TYPE> - DDSTopicDescription * - DDS_TopicDescription_T<DDS_TYPE>::get_impl (void) - { - return this->impl_; - } - - template <typename DDS_TYPE> - void - DDS_TopicDescription_T<DDS_TYPE>::set_impl (DDSTopicDescription * rc) - { - this->impl_ = rc; - } - - template <typename DDS_TYPE> - DDSTopicDescription * - DDS_TopicDescription_T<DDS_TYPE>::impl (void) - { - if (!this->impl_) - { - throw ::CORBA::BAD_INV_ORDER (); - } - return this->impl_; - } - } -} - diff --git a/CIAO/connectors/dds4ccm/impl/ndds/TopicListener.cpp b/CIAO/connectors/dds4ccm/impl/ndds/TopicListener.cpp new file mode 100644 index 00000000000..0afb1a5bd93 --- /dev/null +++ b/CIAO/connectors/dds4ccm/impl/ndds/TopicListener.cpp @@ -0,0 +1,43 @@ +// $Id$ + +#include "dds4ccm/impl/ndds/TopicListener.h" +#include "dds4ccm/impl/ndds/Topic.h" +#include "dds4ccm/impl/ndds/convertors/InconsistentTopicStatus.h" +#include "dds4ccm/impl/logger/Log_Macros.h" + +namespace CIAO +{ + namespace NDDS + { + DDS_TopicListener_i::DDS_TopicListener_i ( + ::DDS::Topic_ptr topic, + ::DDS::TopicListener_ptr topic_listener) + : topic_ (::DDS::Topic::_duplicate (topic)), + topic_listener_ (::DDS::TopicListener::_duplicate (topic_listener)) + { + } + + DDS_TopicListener_i::~DDS_TopicListener_i (void) + { + } + + void + DDS_TopicListener_i::on_inconsistent_topic ( + ::DDSTopic*, + const ::DDS_InconsistentTopicStatus & status) + { + DDS4CCM_TRACE ("DDS_TopicListener_i::on_inconsistent_topic"); + + ::DDS::InconsistentTopicStatus ddsstatus; + ddsstatus <<= status; + this->topic_listener_->on_inconsistent_topic (this->topic_.in (), ddsstatus); + } + + void + DDS_TopicListener_i::set_dds_topic (::DDS::Topic_ptr topic) + { + this->topic_ = ::DDS::Topic::_duplicate (topic); + } + } +} + diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDSTopicListener_T.h b/CIAO/connectors/dds4ccm/impl/ndds/TopicListener.h index a3f2dd3cbba..7b6b6699d49 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDSTopicListener_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/TopicListener.h @@ -9,37 +9,36 @@ #ifndef DDSTOPICLISTENER_T_H_ #define DDSTOPICLISTENER_T_H_ +#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h" #include "dds4ccm/idl/dds_rtf2_dcpsC.h" - -# include "ndds/ndds_cpp.h" +#include "ndds/ndds_cpp.h" namespace CIAO { - namespace DDS4CCM + namespace NDDS { - template <typename DDS_TYPE> - class DDS_TopicListener_T : - public virtual ::DDSTopicListener + class DDS4CCM_NDDS_Export DDS_TopicListener_i : + public ::DDSTopicListener { - typedef DDS_Topic_T<DDS_TYPE> Topic_type; public: /// Constructor - DDS_TopicListener_T (::DDS::TopicListener_ptr p); + DDS_TopicListener_i (::DDS::Topic_ptr topic, + ::DDS::TopicListener_ptr topic_listener); /// Destructor - virtual ~DDS_TopicListener_T (void); + virtual ~DDS_TopicListener_i (void); virtual void on_inconsistent_topic( ::DDSTopic* topic, const ::DDS_InconsistentTopicStatus& status); - ::DDS::TopicListener_ptr get_topiclistener (void); + void set_dds_topic (::DDS::Topic_ptr topic); + private: - ::DDS::TopicListener_var impl_; + ::DDS::Topic_var topic_; + ::DDS::TopicListener_var topic_listener_; }; } } -#include "dds4ccm/impl/ndds/DDSTopicListener_T.cpp" - #endif /* TOPICLISTENER_T_H_ */ diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Topic_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Topic_T.cpp deleted file mode 100644 index 1ebc97f851f..00000000000 --- a/CIAO/connectors/dds4ccm/impl/ndds/Topic_T.cpp +++ /dev/null @@ -1,193 +0,0 @@ -// $Id$ - -#include "dds4ccm/impl/ndds/Topic_T.h" -#include "dds4ccm/impl/ndds/ContentFilteredTopic_T.h" -#include "dds4ccm/impl/ndds/StatusCondition.h" -#include "dds4ccm/impl/ndds/DDSTopicListener_T.h" - -#include "convertors/InstanceHandle_t.h" -#include "convertors/InconsistentTopicStatus.h" -#include "convertors/TopicQos.h" - -#include "dds4ccm/impl/logger/Log_Macros.h" -#include "dds4ccm/impl/dds4ccm_conf.h" - -namespace CIAO -{ - namespace DDS4CCM - { - template <typename DDS_TYPE> - DDS_Topic_T<DDS_TYPE>::DDS_Topic_T (DDSTopic* topic) - : impl_ (topic) - { - } - - template <typename DDS_TYPE> - DDS_Topic_T<DDS_TYPE>::~DDS_Topic_T (void) - { - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Topic_T<DDS_TYPE>::set_qos (const ::DDS::TopicQos &qos) - { - ::DDS_TopicQos ddsqos; - ddsqos <<= qos; - return this->impl ()->set_qos (ddsqos); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Topic_T<DDS_TYPE>::get_qos (::DDS::TopicQos &qos) - { - ::DDS_TopicQos ddsqos; - ::DDS_ReturnCode_t const retval = this->impl ()->get_qos (ddsqos); - qos <<= ddsqos; - return retval; - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Topic_T<DDS_TYPE>::set_listener ( - ::DDS::TopicListener_ptr a_listener, - ::DDS::StatusMask mask) - { - DDS4CCM_TRACE ("DDS_Topic_T<DDS_TYPE>::set_listener"); - - // Delete the previously set listener - DDSTopicListener *listener = this->impl ()->get_listener (); - delete listener; - - TopicListener_type *ccm_dds_impl_list = 0; - if (! ::CORBA::is_nil (a_listener)) - { - ACE_NEW_THROW_EX (ccm_dds_impl_list, - TopicListener_type (a_listener), - ::CORBA::NO_MEMORY ()); - } - return this->impl ()->set_listener (ccm_dds_impl_list, mask); - } - - template <typename DDS_TYPE> - ::DDS::TopicListener_ptr - DDS_Topic_T<DDS_TYPE>::get_listener (void) - { - DDS4CCM_TRACE ("DDS_Topic_T<DDS_TYPE>::get_listener"); - - DDSTopicListener *ccm_dds_topic_list = this->impl ()->get_listener (); - TopicListener_type * list_proxy = - dynamic_cast <TopicListener_type *> (ccm_dds_topic_list); - if (!list_proxy) - { - DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO - "DDS_Topic_T<DDS_TYPE>::" - "get_listener - DDS returned a NIL listener.\n")); - return ::DDS::TopicListener::_nil (); - } - return list_proxy->get_topiclistener (); - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Topic_T<DDS_TYPE>::get_inconsistent_topic_status ( - ::DDS::InconsistentTopicStatus & a_status) - { - DDS_InconsistentTopicStatus ddsstatus; - ::DDS::ReturnCode_t const retval = - this->impl ()->get_inconsistent_topic_status (ddsstatus); - a_status <<= ddsstatus; - return retval; - } - - template <typename DDS_TYPE> - ::DDS::ReturnCode_t - DDS_Topic_T<DDS_TYPE>::enable (void) - { - return this->impl ()->enable (); - } - - template <typename DDS_TYPE> - ::DDS::StatusCondition_ptr - DDS_Topic_T<DDS_TYPE>::get_statuscondition (void) - { - ::DDS::StatusCondition_var retval; - DDSStatusCondition* sc = this->impl ()->get_statuscondition (); - ACE_NEW_THROW_EX (retval, - DDS_StatusCondition_i (sc), - ::CORBA::NO_MEMORY ()); - return retval._retn (); - } - - template <typename DDS_TYPE> - ::DDS::StatusMask - DDS_Topic_T<DDS_TYPE>::get_status_changes (void) - { - return this->impl ()->get_status_changes (); - } - - template <typename DDS_TYPE> - ::DDS::InstanceHandle_t - DDS_Topic_T<DDS_TYPE>::get_instance_handle (void) - { - ::DDS_InstanceHandle_t const rtihandle = - this->impl ()->get_instance_handle (); - ::DDS::InstanceHandle_t handle; - handle <<= rtihandle; - return handle; - } - - template <typename DDS_TYPE> - char * - DDS_Topic_T<DDS_TYPE>::get_type_name (void) - { - return CORBA::string_dup (this->impl ()->get_type_name ()); - } - - template <typename DDS_TYPE> - char * - DDS_Topic_T<DDS_TYPE>::get_name (void) - { - return CORBA::string_dup (this->impl ()->get_name ()); - } - - template <typename DDS_TYPE> - ::DDS::DomainParticipant_ptr - DDS_Topic_T<DDS_TYPE>::get_participant (void) - { - ::DDS::DomainParticipant_var retval; - DDSDomainParticipant * p = this->impl ()->get_participant (); - if (p) - { - ACE_NEW_THROW_EX (retval, - DomainParticipant_type (p), - ::CORBA::NO_MEMORY ()); - } - return retval._retn (); - } - - template <typename DDS_TYPE> - DDSTopic * - DDS_Topic_T<DDS_TYPE>::get_impl (void) - { - return this->impl_; - } - - template <typename DDS_TYPE> - void - DDS_Topic_T<DDS_TYPE>::set_impl (DDSTopic * topic) - { - this->impl_ = topic; - } - - template <typename DDS_TYPE> - DDSTopic * - DDS_Topic_T<DDS_TYPE>::impl (void) - { - if (!this->impl_) - { - throw ::CORBA::BAD_INV_ORDER (); - } - return this->impl_; - } - } -} diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ndds.mpc b/CIAO/connectors/dds4ccm/impl/ndds/ndds.mpc index 901527b6f0b..c0f6b776634 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/ndds.mpc +++ b/CIAO/connectors/dds4ccm/impl/ndds/ndds.mpc @@ -15,10 +15,24 @@ project(CIAO_DDS4CCM_DDS_NDDS) : install, dds4ccm_skel, dds4ccm_lem_stub, taolib } Source_Files { + ContentFilteredTopic.cpp DataReader.cpp + DataReaderListener.cpp DataWriter.cpp - StatusCondition.cpp - DDSDomainParticipantListener.cpp + DataWriterListener.cpp + DomainParticipant.cpp + DomainParticipantFactory.cpp + DomainParticipantListener.cpp DomainParticipantManager.cpp + Publisher.cpp + PublisherListener.cpp + QueryCondition.cpp + ReadCondition.cpp + StatusCondition.cpp + Subscriber.cpp + SubscriberListener.cpp + Topic.cpp + TopicDescription.cpp + TopicListener.cpp } } |