From c3805f5825933ae751b993c3ca4b79c902573f0e Mon Sep 17 00:00:00 2001 From: wolff1 Date: Fri, 7 Dec 2007 15:35:33 +0000 Subject: add test for DDS integration into CIAO --- CIAO/tests/DDS/Base/DDSTopic.idl | 1 + CIAO/tests/DDS/Base/DDSTopicBase.mpc | 21 + CIAO/tests/DDS/Base/DDSTopic_Export.h | 58 ++ CIAO/tests/DDS/DDSTest.mwc | 14 + CIAO/tests/DDS/Publisher/DDSPublisher.mpc | 15 + CIAO/tests/DDS/Publisher/publisher.cpp | 170 ++++ CIAO/tests/DDS/Receiver/DDSReceiver.mpc | 60 ++ CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp | 146 ++++ CIAO/tests/DDS/Receiver/DDSReceiver_exec.h | 104 +++ CIAO/tests/DDS/Receiver/DDSReceiver_exec_export.h | 58 ++ CIAO/tests/DDS/Receiver/DDSReceiver_stub_export.h | 58 ++ CIAO/tests/DDS/Receiver/DDSReceiver_svnt_export.h | 58 ++ .../Receiver/DDSTopicDataReaderListenerImpl.cpp | 94 ++ .../DDS/Receiver/DDSTopicDataReaderListenerImpl.h | 61 ++ CIAO/tests/DDS/Receiver/Receiver_Task.cpp | 197 +++++ CIAO/tests/DDS/Receiver/Receiver_Task.h | 55 ++ CIAO/tests/DDS/interface/DDSEvent.idl | 17 + CIAO/tests/DDS/interface/DDSReceiver.cidl | 20 + CIAO/tests/DDS/interface/DDSReceiver.idl | 22 + CIAO/tests/DDS/interface/DDSTopic.idl | 15 + CIAO/tests/DDS/model/DDSComponent.xme | 972 +++++++++++++++++++++ 21 files changed, 2216 insertions(+) create mode 120000 CIAO/tests/DDS/Base/DDSTopic.idl create mode 100644 CIAO/tests/DDS/Base/DDSTopicBase.mpc create mode 100644 CIAO/tests/DDS/Base/DDSTopic_Export.h create mode 100644 CIAO/tests/DDS/DDSTest.mwc create mode 100644 CIAO/tests/DDS/Publisher/DDSPublisher.mpc create mode 100644 CIAO/tests/DDS/Publisher/publisher.cpp create mode 100755 CIAO/tests/DDS/Receiver/DDSReceiver.mpc create mode 100644 CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp create mode 100644 CIAO/tests/DDS/Receiver/DDSReceiver_exec.h create mode 100644 CIAO/tests/DDS/Receiver/DDSReceiver_exec_export.h create mode 100644 CIAO/tests/DDS/Receiver/DDSReceiver_stub_export.h create mode 100644 CIAO/tests/DDS/Receiver/DDSReceiver_svnt_export.h create mode 100644 CIAO/tests/DDS/Receiver/DDSTopicDataReaderListenerImpl.cpp create mode 100644 CIAO/tests/DDS/Receiver/DDSTopicDataReaderListenerImpl.h create mode 100644 CIAO/tests/DDS/Receiver/Receiver_Task.cpp create mode 100644 CIAO/tests/DDS/Receiver/Receiver_Task.h create mode 100755 CIAO/tests/DDS/interface/DDSEvent.idl create mode 100755 CIAO/tests/DDS/interface/DDSReceiver.cidl create mode 100755 CIAO/tests/DDS/interface/DDSReceiver.idl create mode 100755 CIAO/tests/DDS/interface/DDSTopic.idl create mode 100755 CIAO/tests/DDS/model/DDSComponent.xme diff --git a/CIAO/tests/DDS/Base/DDSTopic.idl b/CIAO/tests/DDS/Base/DDSTopic.idl new file mode 120000 index 00000000000..01f85e64ebc --- /dev/null +++ b/CIAO/tests/DDS/Base/DDSTopic.idl @@ -0,0 +1 @@ +../interface/DDSTopic.idl \ No newline at end of file diff --git a/CIAO/tests/DDS/Base/DDSTopicBase.mpc b/CIAO/tests/DDS/Base/DDSTopicBase.mpc new file mode 100644 index 00000000000..59f2d195c35 --- /dev/null +++ b/CIAO/tests/DDS/Base/DDSTopicBase.mpc @@ -0,0 +1,21 @@ +project (DDSTopicBase) : dcps { + + idlflags += -Wb,export_macro=DDSTopic_Export + idlflags += -Wb,export_include=DDSTopic_Export.h + dcps_ts_flags += --export=DDSTopic_Export + dynamicflags = DDSTOPIC_BUILD_DLL + + TypeSupport_Files { + DDSTopic.idl >> DDSTopicTypeSupport.idl DDSTopicTypeSupportImpl.h DDSTopicTypeSupportImpl.cpp + } + + IDL_Files { + gendir = . + DDSTopic.idl + DDSTopicTypeSupport.idl + } + + Source_Files { + DDSTopicTypeSupportImpl.cpp + } +} diff --git a/CIAO/tests/DDS/Base/DDSTopic_Export.h b/CIAO/tests/DDS/Base/DDSTopic_Export.h new file mode 100644 index 00000000000..c7bf150178c --- /dev/null +++ b/CIAO/tests/DDS/Base/DDSTopic_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl DDSTopic +// ------------------------------ +#ifndef DDSTOPIC_EXPORT_H +#define DDSTOPIC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DDSTOPIC_HAS_DLL) +# define DDSTOPIC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DDSTOPIC_HAS_DLL */ + +#if !defined (DDSTOPIC_HAS_DLL) +# define DDSTOPIC_HAS_DLL 1 +#endif /* ! DDSTOPIC_HAS_DLL */ + +#if defined (DDSTOPIC_HAS_DLL) && (DDSTOPIC_HAS_DLL == 1) +# if defined (DDSTOPIC_BUILD_DLL) +# define DDSTopic_Export ACE_Proper_Export_Flag +# define DDSTOPIC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DDSTOPIC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DDSTOPIC_BUILD_DLL */ +# define DDSTopic_Export ACE_Proper_Import_Flag +# define DDSTOPIC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DDSTOPIC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DDSTOPIC_BUILD_DLL */ +#else /* DDSTOPIC_HAS_DLL == 1 */ +# define DDSTopic_Export +# define DDSTOPIC_SINGLETON_DECLARATION(T) +# define DDSTOPIC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DDSTOPIC_HAS_DLL == 1 */ + +// Set DDSTOPIC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DDSTOPIC_NTRACE) +# if (ACE_NTRACE == 1) +# define DDSTOPIC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DDSTOPIC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DDSTOPIC_NTRACE */ + +#if (DDSTOPIC_NTRACE == 1) +# define DDSTOPIC_TRACE(X) +#else /* (DDSTOPIC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DDSTOPIC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DDSTOPIC_NTRACE == 1) */ + +#endif /* DDSTOPIC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/tests/DDS/DDSTest.mwc b/CIAO/tests/DDS/DDSTest.mwc new file mode 100644 index 00000000000..de42423654f --- /dev/null +++ b/CIAO/tests/DDS/DDSTest.mwc @@ -0,0 +1,14 @@ +workspace { + // the -relative and -include cmdlines make it so this workspace + // does not have to be in the $DDS_ROOT directory tree. + + // tell MPC to substitute our DDS_ROOT environment variables for relative paths + cmdline += -relative DDS_ROOT=$DDS_ROOT + + // tell the projects where to find the DDS base projects (*.mpb) + cmdline += -include $DDS_ROOT/MPC/config + + Base + Receiver + +} diff --git a/CIAO/tests/DDS/Publisher/DDSPublisher.mpc b/CIAO/tests/DDS/Publisher/DDSPublisher.mpc new file mode 100644 index 00000000000..94456096f6c --- /dev/null +++ b/CIAO/tests/DDS/Publisher/DDSPublisher.mpc @@ -0,0 +1,15 @@ +project (DDSPublisher) : dcpsexe, svc_utils { + + after += DDSTopicBase + exename = publisher + + libpaths += . + libs += DDSTopicBase + dynamicflags += DDSTOPIC_HAS_DLL + includes += ../Base + + Source_Files { + publisher.cpp + } + +} diff --git a/CIAO/tests/DDS/Publisher/publisher.cpp b/CIAO/tests/DDS/Publisher/publisher.cpp new file mode 100644 index 00000000000..a14c8780e4f --- /dev/null +++ b/CIAO/tests/DDS/Publisher/publisher.cpp @@ -0,0 +1,170 @@ +// -*- C++ -*- +// ******************************************************************* +// +// (c) Copyright 2006, Object Computing, Inc. +// All Rights Reserved. +// +// ******************************************************************* + +#include "DDSTopicTypeSupportImpl.h" +#include +#include +#include +#include +#include + +// constant used by this publisher for transport; +// must match transport id in config file +const OpenDDS::DCPS::TransportIdType TRANSPORT_IMPL_ID = 1; + +// constants for Stock Ddstopicr domain Id, types, and topic +DDS::DomainId_t DDSTOPIC_DOMAIN_ID = 467; +const char* DDSTOPIC_TYPE = "DDS Test"; +const char* DDSTEST_TOPIC = "DDSTopic"; + +int main (int argc, char *argv[]) { + + DDS::DomainParticipantFactory_var dpf = DDS::DomainParticipantFactory::_nil(); + DDS::DomainParticipant_var participant = DDS::DomainParticipant::_nil(); + + try { + // Initialize, and create a DomainParticipant + + dpf = TheParticipantFactoryWithArgs(argc, argv); + + participant = dpf->create_participant( + DDSTOPIC_DOMAIN_ID, + PARTICIPANT_QOS_DEFAULT, + DDS::DomainParticipantListener::_nil()); + + if (CORBA::is_nil (participant.in ())) { + cerr << "create_participant failed." << endl; + ACE_OS::exit(1); + } + + // Create a publisher for the two topics + // (PUBLISHER_QOS_DEFAULT is defined in Marked_Default_Qos.h) + DDS::Publisher_var pub = + participant->create_publisher(PUBLISHER_QOS_DEFAULT, + DDS::PublisherListener::_nil()); + if (CORBA::is_nil (pub.in ())) { + cerr << "create_publisher failed." << endl; + ACE_OS::exit(1); + } + + // Initialize the transport; the TRANSPORT_IMPL_ID must match the + // value in the configuration file. + OpenDDS::DCPS::TransportImpl_rch trans_impl = + TheTransportFactory->create_transport_impl (TRANSPORT_IMPL_ID, + OpenDDS::DCPS::AUTO_CONFIG); + + // Attach the publisher to the TCP transport. + OpenDDS::DCPS::PublisherImpl* pub_impl = + OpenDDS::DCPS::reference_to_servant< OpenDDS::DCPS::PublisherImpl >(pub.in ()); + if (0 == pub_impl) { + cerr << "Failed to obtain publisher servant" << endl; + ACE_OS::exit(1); + } + OpenDDS::DCPS::AttachStatus status = pub_impl->attach_transport(trans_impl.in()); + if (status != OpenDDS::DCPS::ATTACH_OK) { + std::string status_str; + switch (status) { + case OpenDDS::DCPS::ATTACH_BAD_TRANSPORT: + status_str = "ATTACH_BAD_TRANSPORT"; + break; + case OpenDDS::DCPS::ATTACH_ERROR: + status_str = "ATTACH_ERROR"; + break; + case OpenDDS::DCPS::ATTACH_INCOMPATIBLE_QOS: + status_str = "ATTACH_INCOMPATIBLE_QOS"; + break; + default: + status_str = "Unknown Status"; + break; + } + cerr << "Failed to attach to the transport. Status == " + << status_str.c_str() << endl; + ACE_OS::exit(1); + } + + // Register the Ddstopic type + DDSTopicTypeSupport_var ddstopic_servant = new DDSTopicTypeSupportImpl(); + if (DDS::RETCODE_OK != ddstopic_servant->register_type(participant.in (), + DDSTOPIC_TYPE)) { + cerr << "register_type for " << DDSTOPIC_TYPE << " failed." << endl; + ACE_OS::exit(1); + } + + // Create a topic for the Ddstopic type... + DDS::Topic_var ddstopic_topic = + participant->create_topic (DDSTEST_TOPIC, + DDSTOPIC_TYPE, + TOPIC_QOS_DEFAULT, + DDS::TopicListener::_nil()); + if (CORBA::is_nil (ddstopic_topic.in ())) { + cerr << "create_topic for " << DDSTEST_TOPIC << " failed." << endl; + ACE_OS::exit(1); + } + + // Create a DataWriter for the Ddstopic topic + DDS::DataWriter_var ddstopic_base_dw = + pub->create_datawriter(ddstopic_topic.in (), + DATAWRITER_QOS_DEFAULT, + DDS::DataWriterListener::_nil()); + if (CORBA::is_nil (ddstopic_base_dw.in ())) { + cerr << "create_datawriter for " << DDSTEST_TOPIC << " failed." << endl; + ACE_OS::exit(1); + } + DDSTopicDataWriter_var ddstopic_dw + = DDSTopicDataWriter::_narrow(ddstopic_base_dw.in()); + if (CORBA::is_nil (ddstopic_dw.in ())) { + cerr << "DdstopicDataWriter could not be narrowed"<< endl; + ACE_OS::exit(1); + } + + // Register three stocks + DDSTopic topic_template; + topic_template.id = CORBA::string_dup("Asynch Message"); + DDS::InstanceHandle_t topic_handle = + ddstopic_dw->_cxx_register(topic_template); + + // Publish... + + ACE_Time_Value wait_time( 1, 0 ); + for ( int i = 0; i < 8; ++i ) { + DDSTopic ddstopic; + ddstopic.id = CORBA::string_dup("Asynch Message"); + ddstopic.sequence_number = i; + + cout << "Writing Ddstopicr, count " << i << endl; + + DDS::ReturnCode_t ret = ddstopic_dw->write(ddstopic, topic_handle); + if (ret != DDS::RETCODE_OK) { + ACE_ERROR ((LM_ERROR, ACE_TEXT("(%P|%t)ERROR: topic write returned %d.\n"), ret)); + } + + ACE_OS::sleep( wait_time ); + } + + } catch (CORBA::Exception& e) { + cerr << "Exception caught in main.cpp:" << endl + << e << endl; + ACE_OS::exit(1); + } + + // Cleanup + try { + if (!CORBA::is_nil (participant.in ())) { + participant->delete_contained_entities(); + } + if (!CORBA::is_nil (dpf.in ())) { + dpf->delete_participant(participant.in ()); + } + } catch (CORBA::Exception& e) { + cerr << "Exception caught in cleanup." << endl << e << endl; + ACE_OS::exit(1); + } + TheTransportFactory->release(); + TheServiceParticipant->shutdown (); + return 0; +} diff --git a/CIAO/tests/DDS/Receiver/DDSReceiver.mpc b/CIAO/tests/DDS/Receiver/DDSReceiver.mpc new file mode 100755 index 00000000000..447482b1b5a --- /dev/null +++ b/CIAO/tests/DDS/Receiver/DDSReceiver.mpc @@ -0,0 +1,60 @@ +project (DDSReceiver_stub): ciao_client_dnc { + sharedname =DDSReceiver_stub + idlflags += -Wb,stub_export_macro=DDSRECEIVER_STUB_Export -Wb,stub_export_include=DDSReceiver_stub_export.h -Wb,skel_export_macro=DDSRECEIVER_SVNT_Export -Wb,skel_export_include=DDSReceiver_svnt_export.h + idlflags += -I../interface + dynamicflags = DDSRECEIVER_STUB_BUILD_DLL + IDL_Files { + gendir = . + ../interface/DDSEvent.idl + ../interface/DDSReceiver.idl + } + Source_Files { + DDSReceiverC.cpp + DDSEventC.cpp + } + +} +project (DDSReceiver_svnt): ciao_servant_dnc { + after += DDSReceiver_stub + sharedname =DDSReceiver_svnt + idlflags += -Wb,export_macro=DDSRECEIVER_SVNT_Export -Wb,export_include=DDSReceiver_svnt_export.h + idlflags += -I../interface + cidlflags += -I../interface + + libs += DDSReceiver_stub + dynamicflags = DDSRECEIVER_SVNT_BUILD_DLL + CIDL_Files { + gendir = . + ../interface/DDSReceiver.cidl + } + + IDL_Files { + gendir = . + DDSReceiverE.idl + } + Source_Files { + DDSReceiverEC.cpp + DDSReceiverS.cpp + DDSEventS.cpp + DDSReceiver_svnt.cpp + } + +} + +project (DDSReceiver_exec): ciao_component_dnc, dcpsexe { + after += DDSReceiver_svnt DDSTopicBase + sharedname = DDSReceiver_exec + idlflags += -Wb,export_macro=DDSRECEIVER_EXEC_Export -Wb,export_include=DDSReceiver_exec_export.h + idlflags += -I../interface + dynamicflags += DDSRECEIVER_EXEC_BUILD_DLL DDSTOPIC_HAS_DLL + includes += ../Base + + libs += DDSReceiver_svnt DDSReceiver_stub DDSTopicBase + + Source_Files { + DDSReceiver_exec.cpp + Receiver_Task.cpp + DDSTopicDataReaderListenerImpl.cpp + } + +} diff --git a/CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp b/CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp new file mode 100644 index 00000000000..7896a9c05ed --- /dev/null +++ b/CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp @@ -0,0 +1,146 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "DDSReceiver_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIDL_DDSReceiverImpl +{ + //================================================================== + // Component Executor Implementation Class: DDSReceiver_exec_i + //================================================================== + + DDSReceiver_exec_i::DDSReceiver_exec_i (void) + { + } + + DDSReceiver_exec_i::~DDSReceiver_exec_i (void) + { + } + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + void + DDSReceiver_exec_i::push_dds_input ( + ::DDSTest::DDSTopic_event * /* ev */) + { + // Your code here. + } + + // Operations from Components::SessionComponent + + void + DDSReceiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + DDSReceiver_Context::_narrow (ctx); + + if (this->context_ == 0) + { + throw ::CORBA::INTERNAL (); + } + } + + void + DDSReceiver_exec_i::ciao_preactivate () + { + // Your code here. + } + + void + DDSReceiver_exec_i::ciao_postactivate () + { + // Your code here. + } + + void + DDSReceiver_exec_i::ccm_activate () + { + // Your code here. + } + + void + DDSReceiver_exec_i::ccm_passivate () + { + // Your code here. + } + + void + DDSReceiver_exec_i::ccm_remove () + { + // Your code here. + } + + //================================================================== + // Home Executor Implementation Class: DDSReceiverHome_exec_i + //================================================================== + + DDSReceiverHome_exec_i::DDSReceiverHome_exec_i (void) + { + } + + DDSReceiverHome_exec_i::~DDSReceiverHome_exec_i (void) + { + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + DDSReceiverHome_exec_i::create () + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + DDSReceiver_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" DDSRECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_DDSTest_DDSReceiverHome_Impl (void) + { + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + DDSReceiverHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/CIAO/tests/DDS/Receiver/DDSReceiver_exec.h b/CIAO/tests/DDS/Receiver/DDSReceiver_exec.h new file mode 100644 index 00000000000..201c8bd5af9 --- /dev/null +++ b/CIAO/tests/DDS/Receiver/DDSReceiver_exec.h @@ -0,0 +1,104 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_DDSRECEIVER_EXEC_H +#define CIAO_DDSRECEIVER_EXEC_H + +#include /**/ "ace/pre.h" + +#include "DDSReceiver_svnt.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "DDSReceiver_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_DDSReceiverImpl +{ + class DDSRECEIVER_EXEC_Export DDSReceiver_exec_i + : public virtual DDSReceiver_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + DDSReceiver_exec_i (void); + virtual ~DDSReceiver_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + virtual void + push_dds_input ( + ::DDSTest::DDSTopic_event *ev); + + // Operations from Components::SessionComponent + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void ciao_preactivate (); + + virtual void ciao_postactivate (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + protected: + DDSReceiver_Context *context_; + }; + + class DDSRECEIVER_EXEC_Export DDSReceiverHome_exec_i + : public virtual DDSReceiverHome_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + DDSReceiverHome_exec_i (void); + virtual ~DDSReceiverHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" DDSRECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_DDSTest_DDSReceiverHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_DDSRECEIVER_EXEC_H */ + diff --git a/CIAO/tests/DDS/Receiver/DDSReceiver_exec_export.h b/CIAO/tests/DDS/Receiver/DDSReceiver_exec_export.h new file mode 100644 index 00000000000..ccc67afadb7 --- /dev/null +++ b/CIAO/tests/DDS/Receiver/DDSReceiver_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s DDSRECEIVER_EXEC +// ------------------------------ +#ifndef DDSRECEIVER_EXEC_EXPORT_H +#define DDSRECEIVER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DDSRECEIVER_EXEC_HAS_DLL) +# define DDSRECEIVER_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DDSRECEIVER_EXEC_HAS_DLL */ + +#if !defined (DDSRECEIVER_EXEC_HAS_DLL) +# define DDSRECEIVER_EXEC_HAS_DLL 1 +#endif /* ! DDSRECEIVER_EXEC_HAS_DLL */ + +#if defined (DDSRECEIVER_EXEC_HAS_DLL) && (DDSRECEIVER_EXEC_HAS_DLL == 1) +# if defined (DDSRECEIVER_EXEC_BUILD_DLL) +# define DDSRECEIVER_EXEC_Export ACE_Proper_Export_Flag +# define DDSRECEIVER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DDSRECEIVER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DDSRECEIVER_EXEC_BUILD_DLL */ +# define DDSRECEIVER_EXEC_Export ACE_Proper_Import_Flag +# define DDSRECEIVER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DDSRECEIVER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DDSRECEIVER_EXEC_BUILD_DLL */ +#else /* DDSRECEIVER_EXEC_HAS_DLL == 1 */ +# define DDSRECEIVER_EXEC_Export +# define DDSRECEIVER_EXEC_SINGLETON_DECLARATION(T) +# define DDSRECEIVER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DDSRECEIVER_EXEC_HAS_DLL == 1 */ + +// Set DDSRECEIVER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DDSRECEIVER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define DDSRECEIVER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DDSRECEIVER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DDSRECEIVER_EXEC_NTRACE */ + +#if (DDSRECEIVER_EXEC_NTRACE == 1) +# define DDSRECEIVER_EXEC_TRACE(X) +#else /* (DDSRECEIVER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DDSRECEIVER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DDSRECEIVER_EXEC_NTRACE == 1) */ + +#endif /* DDSRECEIVER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/tests/DDS/Receiver/DDSReceiver_stub_export.h b/CIAO/tests/DDS/Receiver/DDSReceiver_stub_export.h new file mode 100644 index 00000000000..064f1af7b4b --- /dev/null +++ b/CIAO/tests/DDS/Receiver/DDSReceiver_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s DDSRECEIVER_STUB +// ------------------------------ +#ifndef DDSRECEIVER_STUB_EXPORT_H +#define DDSRECEIVER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DDSRECEIVER_STUB_HAS_DLL) +# define DDSRECEIVER_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DDSRECEIVER_STUB_HAS_DLL */ + +#if !defined (DDSRECEIVER_STUB_HAS_DLL) +# define DDSRECEIVER_STUB_HAS_DLL 1 +#endif /* ! DDSRECEIVER_STUB_HAS_DLL */ + +#if defined (DDSRECEIVER_STUB_HAS_DLL) && (DDSRECEIVER_STUB_HAS_DLL == 1) +# if defined (DDSRECEIVER_STUB_BUILD_DLL) +# define DDSRECEIVER_STUB_Export ACE_Proper_Export_Flag +# define DDSRECEIVER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DDSRECEIVER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DDSRECEIVER_STUB_BUILD_DLL */ +# define DDSRECEIVER_STUB_Export ACE_Proper_Import_Flag +# define DDSRECEIVER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DDSRECEIVER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DDSRECEIVER_STUB_BUILD_DLL */ +#else /* DDSRECEIVER_STUB_HAS_DLL == 1 */ +# define DDSRECEIVER_STUB_Export +# define DDSRECEIVER_STUB_SINGLETON_DECLARATION(T) +# define DDSRECEIVER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DDSRECEIVER_STUB_HAS_DLL == 1 */ + +// Set DDSRECEIVER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DDSRECEIVER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define DDSRECEIVER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DDSRECEIVER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DDSRECEIVER_STUB_NTRACE */ + +#if (DDSRECEIVER_STUB_NTRACE == 1) +# define DDSRECEIVER_STUB_TRACE(X) +#else /* (DDSRECEIVER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DDSRECEIVER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DDSRECEIVER_STUB_NTRACE == 1) */ + +#endif /* DDSRECEIVER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/tests/DDS/Receiver/DDSReceiver_svnt_export.h b/CIAO/tests/DDS/Receiver/DDSReceiver_svnt_export.h new file mode 100644 index 00000000000..ceb3924fc6f --- /dev/null +++ b/CIAO/tests/DDS/Receiver/DDSReceiver_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s DDSRECEIVER_SVNT +// ------------------------------ +#ifndef DDSRECEIVER_SVNT_EXPORT_H +#define DDSRECEIVER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DDSRECEIVER_SVNT_HAS_DLL) +# define DDSRECEIVER_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DDSRECEIVER_SVNT_HAS_DLL */ + +#if !defined (DDSRECEIVER_SVNT_HAS_DLL) +# define DDSRECEIVER_SVNT_HAS_DLL 1 +#endif /* ! DDSRECEIVER_SVNT_HAS_DLL */ + +#if defined (DDSRECEIVER_SVNT_HAS_DLL) && (DDSRECEIVER_SVNT_HAS_DLL == 1) +# if defined (DDSRECEIVER_SVNT_BUILD_DLL) +# define DDSRECEIVER_SVNT_Export ACE_Proper_Export_Flag +# define DDSRECEIVER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DDSRECEIVER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DDSRECEIVER_SVNT_BUILD_DLL */ +# define DDSRECEIVER_SVNT_Export ACE_Proper_Import_Flag +# define DDSRECEIVER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DDSRECEIVER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DDSRECEIVER_SVNT_BUILD_DLL */ +#else /* DDSRECEIVER_SVNT_HAS_DLL == 1 */ +# define DDSRECEIVER_SVNT_Export +# define DDSRECEIVER_SVNT_SINGLETON_DECLARATION(T) +# define DDSRECEIVER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DDSRECEIVER_SVNT_HAS_DLL == 1 */ + +// Set DDSRECEIVER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DDSRECEIVER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define DDSRECEIVER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DDSRECEIVER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DDSRECEIVER_SVNT_NTRACE */ + +#if (DDSRECEIVER_SVNT_NTRACE == 1) +# define DDSRECEIVER_SVNT_TRACE(X) +#else /* (DDSRECEIVER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DDSRECEIVER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DDSRECEIVER_SVNT_NTRACE == 1) */ + +#endif /* DDSRECEIVER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/tests/DDS/Receiver/DDSTopicDataReaderListenerImpl.cpp b/CIAO/tests/DDS/Receiver/DDSTopicDataReaderListenerImpl.cpp new file mode 100644 index 00000000000..abb7d13c5f8 --- /dev/null +++ b/CIAO/tests/DDS/Receiver/DDSTopicDataReaderListenerImpl.cpp @@ -0,0 +1,94 @@ +// -*- C++ -*- + +#include "DDSTopicDataReaderListenerImpl.h" +#include "DDSTopicTypeSupportC.h" +#include "DDSTopicTypeSupportImpl.h" +#include +#include + + +// Implementation skeleton constructor +DDSTopicDataReaderListenerImpl::DDSTopicDataReaderListenerImpl() +{ +} + +// Implementation skeleton destructor +DDSTopicDataReaderListenerImpl::~DDSTopicDataReaderListenerImpl () +{ +} + +void DDSTopicDataReaderListenerImpl::on_data_available(DDS::DataReader_ptr reader) + throw (CORBA::SystemException) +{ + try { + DDSTopicDataReader_var topic_reader = DDSTopicDataReader::_narrow(reader); + if (CORBA::is_nil (topic_reader.in ())) { + cerr << "DDSTopicDataReaderListenerImpl::on_data_available: _narrow failed." << endl; + ACE_OS::exit(1); + } + + DDSTopic topic; + DDS::SampleInfo si ; + DDS::ReturnCode_t status = topic_reader->take_next_sample(topic, si) ; + + if (status == DDS::RETCODE_OK) { + cout << "Topic name: " << topic.id.in() << " and seq.no.: " + << topic.sequence_number << endl; + } else if (status == DDS::RETCODE_NO_DATA) { + cerr << "ERROR: reader received DDS::RETCODE_NO_DATA!" << endl; + } else { + cerr << "ERROR: read DDSTopic: Error: " << status << endl; + } + } catch (CORBA::Exception& e) { + cerr << "Exception caught in read:" << endl << e << endl; + ACE_OS::exit(1); + } +} + +void DDSTopicDataReaderListenerImpl::on_requested_deadline_missed ( + DDS::DataReader_ptr, + const DDS::RequestedDeadlineMissedStatus &) + throw (CORBA::SystemException) +{ + cerr << "DDSTopicDataReaderListenerImpl::on_requested_deadline_missed" << endl; +} + +void DDSTopicDataReaderListenerImpl::on_requested_incompatible_qos ( + DDS::DataReader_ptr, + const DDS::RequestedIncompatibleQosStatus &) + throw (CORBA::SystemException) +{ + cerr << "DDSTopicDataReaderListenerImpl::on_requested_incompatible_qos" << endl; +} + +void DDSTopicDataReaderListenerImpl::on_liveliness_changed ( + DDS::DataReader_ptr, + const DDS::LivelinessChangedStatus &) + throw (CORBA::SystemException) +{ + cerr << "DDSTopicDataReaderListenerImpl::on_liveliness_changed" << endl; +} + +void DDSTopicDataReaderListenerImpl::on_subscription_match ( + DDS::DataReader_ptr, + const DDS::SubscriptionMatchStatus &) + throw (CORBA::SystemException) +{ + cerr << "DDSTopicDataReaderListenerImpl::on_subscription_match" << endl; +} + +void DDSTopicDataReaderListenerImpl::on_sample_rejected( + DDS::DataReader_ptr, + const DDS::SampleRejectedStatus&) + throw (CORBA::SystemException) +{ + cerr << "DDSTopicDataReaderListenerImpl::on_sample_rejected" << endl; +} + +void DDSTopicDataReaderListenerImpl::on_sample_lost( + DDS::DataReader_ptr, + const DDS::SampleLostStatus&) + throw (CORBA::SystemException) +{ + cerr << "DDSTopicDatabReaderListenerImpl::on_sample_lost" << endl; +} diff --git a/CIAO/tests/DDS/Receiver/DDSTopicDataReaderListenerImpl.h b/CIAO/tests/DDS/Receiver/DDSTopicDataReaderListenerImpl.h new file mode 100644 index 00000000000..bb8392171cd --- /dev/null +++ b/CIAO/tests/DDS/Receiver/DDSTopicDataReaderListenerImpl.h @@ -0,0 +1,61 @@ +// -*- C++ -*- +#ifndef DDSTOPIC_DATAREADER_LISTENER_IMPL +#define DDSTOPIC_DATAREADER_LISTENER_IMPL + +#include + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +class DDSTopicDataReaderListenerImpl + : public virtual OpenDDS::DCPS::LocalObject +{ +public: + //Constructor + DDSTopicDataReaderListenerImpl (); + + //Destructor + virtual ~DDSTopicDataReaderListenerImpl (void); + + virtual void on_requested_deadline_missed ( + DDS::DataReader_ptr reader, + const DDS::RequestedDeadlineMissedStatus & status) + throw (CORBA::SystemException); + + virtual void on_requested_incompatible_qos ( + DDS::DataReader_ptr reader, + const DDS::RequestedIncompatibleQosStatus & status) + throw (CORBA::SystemException); + + virtual void on_liveliness_changed ( + DDS::DataReader_ptr reader, + const DDS::LivelinessChangedStatus & status) + throw (CORBA::SystemException); + + virtual void on_subscription_match ( + DDS::DataReader_ptr reader, + const DDS::SubscriptionMatchStatus & status + ) + throw (CORBA::SystemException); + + virtual void on_sample_rejected( + DDS::DataReader_ptr reader, + const DDS::SampleRejectedStatus& status + ) + throw (CORBA::SystemException); + + virtual void on_data_available( + DDS::DataReader_ptr reader + ) + throw (CORBA::SystemException); + + virtual void on_sample_lost( + DDS::DataReader_ptr reader, + const DDS::SampleLostStatus& status + ) + throw (CORBA::SystemException); +}; + +#endif /* DDSTOPIC_DATAREADER_LISTENER_IMPL */ diff --git a/CIAO/tests/DDS/Receiver/Receiver_Task.cpp b/CIAO/tests/DDS/Receiver/Receiver_Task.cpp new file mode 100644 index 00000000000..5eae08bcfc3 --- /dev/null +++ b/CIAO/tests/DDS/Receiver/Receiver_Task.cpp @@ -0,0 +1,197 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Receiver_Task.cpp + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + * + */ +//============================================================================= + +#include "Receiver_Task.h" +#include "DDSTopicDataReaderListenerImpl.h" +#include "DDSTopicTypeSupportImpl.h" +#include +#include +#include +#include + +namespace CIDL_DDSReceiverImpl +{ + +// constant used by this publisher for transport; +// must match transport id in config file +const OpenDDS::DCPS::TransportIdType TRANSPORT_IMPL_ID = 1; + +DDS::DomainId_t DDSTOPIC_DOMAIN_ID = 467; +const char* DDSTOPIC_TYPE = "DDS Test"; +const char* DDSTEST_TOPIC = "DDSTopic"; + +//----------------------------------------------------------------------------- + + Receiver_Task::Receiver_Task () + { + } + +//----------------------------------------------------------------------------- + + void + Receiver_Task::set_context (DDSReceiver_Context* context) + { + this->context_ = context; + } + +//----------------------------------------------------------------------------- + + int + Receiver_Task::svc () + { + DDS::DomainParticipantFactory_var dpf = + DDS::DomainParticipantFactory::_nil(); + DDS::DomainParticipant_var participant = + DDS::DomainParticipant::_nil(); + + try { + // Initialize, and create a DomainParticipant + + dpf = TheParticipantFactory; + + participant = dpf->create_participant( + DDSTOPIC_DOMAIN_ID, + PARTICIPANT_QOS_DEFAULT, + DDS::DomainParticipantListener::_nil()); + + if (CORBA::is_nil (participant.in ())) { + cerr << "create_participant failed." << endl; + return 1; + } + + // Create a subscriber for the two topics + // (SUBSCRIBER_QOS_DEFAULT is defined in Marked_Default_Qos.h) + DDS::Subscriber_var sub = + participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT, + DDS::SubscriberListener::_nil()); + if (CORBA::is_nil (sub.in ())) { + cerr << "create_subscriber failed." << endl; + return 1; + } + + // Initialize the transport; the TRANSPORT_IMPL_ID must match the + // value in the configuration file. + OpenDDS::DCPS::TransportImpl_rch trans_impl = + TheTransportFactory->create_transport_impl (TRANSPORT_IMPL_ID, + OpenDDS::DCPS::AUTO_CONFIG); + + + // Attach the subscriber to the TCP transport. + // (almost identical to the publisher) + OpenDDS::DCPS::SubscriberImpl* sub_impl = + OpenDDS::DCPS::reference_to_servant< OpenDDS::DCPS::SubscriberImpl >(sub.in ()); + if (0 == sub_impl) { + cerr << "Failed to obtain subscriber servant" << endl; + return 1; + } + + OpenDDS::DCPS::AttachStatus status = sub_impl->attach_transport(trans_impl.in()); + if (status != OpenDDS::DCPS::ATTACH_OK) { + std::string status_str; + switch (status) { + case OpenDDS::DCPS::ATTACH_BAD_TRANSPORT: + status_str = "ATTACH_BAD_TRANSPORT"; + break; + case OpenDDS::DCPS::ATTACH_ERROR: + status_str = "ATTACH_ERROR"; + break; + case OpenDDS::DCPS::ATTACH_INCOMPATIBLE_QOS: + status_str = "ATTACH_INCOMPATIBLE_QOS"; + break; + default: + status_str = "Unknown Status"; + break; + } + cerr << "Failed to attach to the transport. Status == " + << status_str.c_str() << endl; + return 1; + } + + // Register the Ddstopic type + DDSTopicTypeSupport_var ddstopic_servant = new DDSTopicTypeSupportImpl(); + if (DDS::RETCODE_OK != ddstopic_servant->register_type(participant.in (), + DDSTOPIC_TYPE)) { + cerr << "register_type for " << DDSTOPIC_TYPE << " failed." << endl; + return 1; + } + + // Create a topic for the Ddstopic type... + DDS::Topic_var ddstopic_topic = + participant->create_topic (DDSTEST_TOPIC, + DDSTOPIC_TYPE, + TOPIC_QOS_DEFAULT, + DDS::TopicListener::_nil()); + if (CORBA::is_nil (ddstopic_topic.in ())) { + cerr << "create_topic for " << DDSTEST_TOPIC << " failed." << endl; + return 1; + } + + // Create DataReaders and DataReaderListeners for the + // Quote and ExchangeEvent + + DDSTopicDataReaderListenerImpl ddstopic_listener_servant; + + DDS::DataReaderListener_var ddstopic_listener = + OpenDDS::DCPS::servant_to_reference( &ddstopic_listener_servant ); + + if (CORBA::is_nil (ddstopic_listener.in ())) { + cerr << "DDSTopic listener is nil." << endl; + return 1; + } + + DDS::DataReader_var ddstopic_dr = + sub->create_datareader(ddstopic_topic.in (), + DATAREADER_QOS_DEFAULT, + ddstopic_listener.in ()); + + // Wait for events from the Publisher; shut down when "close" received + while ( !this->stopped_ ) { + cout << "DDSTopic Reveicer sleeping for 1 sec..." << endl; + ACE_OS::sleep(1); + } + + } + catch (CORBA::Exception& e) { + cerr << "Exception caught in main.cpp:" << endl + << e << endl; + return 1; + } + + // Cleanup + try { + if (!CORBA::is_nil (participant.in ())) { + participant->delete_contained_entities(); + } + if (!CORBA::is_nil (dpf.in ())) { + dpf->delete_participant(participant.in ()); + } + } catch (CORBA::Exception& e) { + cerr << "Exception caught in cleanup." << endl << e << endl; + return 1; + } + TheTransportFactory->release(); + TheServiceParticipant->shutdown (); + return 0; + } + +//----------------------------------------------------------------------------- + + void + Receiver_Task::stop () + { + this->stopped_ = true; + } + +} /* namespace CIDL_DDSReceiverImpl */ + +//----------------------------------------------------------------------------- diff --git a/CIAO/tests/DDS/Receiver/Receiver_Task.h b/CIAO/tests/DDS/Receiver/Receiver_Task.h new file mode 100644 index 00000000000..e072ace3349 --- /dev/null +++ b/CIAO/tests/DDS/Receiver/Receiver_Task.h @@ -0,0 +1,55 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Receiver_Task.h + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + * + */ +//============================================================================= + +#ifndef _DDS_TEST_RECEIVER_TASK_H_ +#define _DDS_TEST_RECEIVER_TASK_H_ + +#include "DDSReceiver_svnt.h" +#include +#include +#include + +/** + * @class Receiver_Task + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + * @brief This class checks for DDS messages + */ + +namespace CIDL_DDSReceiverImpl +{ + class Receiver_Task : public ACE_Task_Base + { + public: + /// constructor + Receiver_Task (); + + /// initializes the context member + void set_context (DDSReceiver_Context* context); + + /// exectution function of the thread + virtual int svc (); + + /// indicates, that the execution of the thread should stop + void stop (); + + private: + /// flag for thread cancellation + bool stopped_; + + /// component context + DDSReceiver_Context* context_; + }; + +} + +#endif /* _DDS_TEST_RECEIVER_TASK_H_ */ diff --git a/CIAO/tests/DDS/interface/DDSEvent.idl b/CIAO/tests/DDS/interface/DDSEvent.idl new file mode 100755 index 00000000000..d8a91f24558 --- /dev/null +++ b/CIAO/tests/DDS/interface/DDSEvent.idl @@ -0,0 +1,17 @@ + +#ifndef DDSEVENT_IDL +#define DDSEVENT_IDL + +#include + +module DDSTest +{ + eventtype DDSTopic_event + { + public long sequence_number; + public string id; + }; +}; + +#endif // DDSEVENT_IDL + diff --git a/CIAO/tests/DDS/interface/DDSReceiver.cidl b/CIAO/tests/DDS/interface/DDSReceiver.cidl new file mode 100755 index 00000000000..8c664c07791 --- /dev/null +++ b/CIAO/tests/DDS/interface/DDSReceiver.cidl @@ -0,0 +1,20 @@ +// -*- CIDL -*- + +// This file was generated by +// $Id$ + +#ifndef _DDSRECEIVER_CIDL_ +#define _DDSRECEIVER_CIDL_ + +#include "DDSReceiver.idl" + +composition session DDSReceiverImpl +{ + home executor DDSReceiverHome_Exec + { + implements DDSTest::DDSReceiverHome; + manages DDSReceiver_Exec; + }; +}; + +#endif // !defined _DDSRECEIVER_CIDL_ diff --git a/CIAO/tests/DDS/interface/DDSReceiver.idl b/CIAO/tests/DDS/interface/DDSReceiver.idl new file mode 100755 index 00000000000..f6fb21b7148 --- /dev/null +++ b/CIAO/tests/DDS/interface/DDSReceiver.idl @@ -0,0 +1,22 @@ + +#ifndef DDSRECEIVER_IDL +#define DDSRECEIVER_IDL + +#include +#include "DDSEvent.idl" + +module DDSTest +{ + component DDSReceiver + { + consumes DDSTest::DDSTopic_event dds_input; + }; + + home DDSReceiverHome + manages DDSReceiver + { + }; +}; + +#endif // DDSRECEIVER_IDL + diff --git a/CIAO/tests/DDS/interface/DDSTopic.idl b/CIAO/tests/DDS/interface/DDSTopic.idl new file mode 100755 index 00000000000..7ab73ef8d23 --- /dev/null +++ b/CIAO/tests/DDS/interface/DDSTopic.idl @@ -0,0 +1,15 @@ + +#ifndef DDSTOPIC_IDL +#define DDSTOPIC_IDL + +#pragma DCPS_DATA_TYPE "DDSTopic" +#pragma DCPS_DATA_KEY "DDSTopic id" + +struct DDSTopic +{ + long sequence_number; + string id; +}; + +#endif // DDSTOPIC_IDL + diff --git a/CIAO/tests/DDS/model/DDSComponent.xme b/CIAO/tests/DDS/model/DDSComponent.xme new file mode 100755 index 00000000000..96b7a7e825a --- /dev/null +++ b/CIAO/tests/DDS/model/DDSComponent.xme @@ -0,0 +1,972 @@ + + + + + DDSComponent + + + + DDSComponent + + ImplementationArtifacts + + DDSReceiverArtifacts + + entryPoint + + + + + + 440,223 + + + + + create_DDSTest_DDSReceiverHome_Impl + + + String + + + + + + 303,163 + + + + + + + entryPoint + + + + + + 265,118 + + + + + create_DDSTest_DDSReceiverHome_Servant + + + String + + + + + + 499,156 + + + + + + + DDSReceiver_stub + + + + + + 111,118 + + + + + 0AAAEE60-682B-4C30-B609-ABEAB08A7306 + + + x86 + + + 0.0.0.0 + + + Release + + + + + + DDSReceiver_stub + + + Linux + + + + DDSReceiver_svnt + + + + + + 265,230 + + + + + 6261D847-FC88-4944-901D-1E3E01CEA838 + + + x86 + + + 0.0.0.0 + + + Release + + + + + + DDSReceiver_svnt + + + Linux + + + + DDSReceiver_exec + + + + + + 440,314 + + + + + CB007241-052C-43F7-B2A0-1609B79A9338 + + + x86 + + + 0.0.0.0 + + + Release + + + + + + DDSReceiver_exec + + + Linux + + + + ArtifactDependency + + Ws + + + + + + ArtifactDependency + + Ws + + + + + + ArtifactExecParameter + + Ns + + + + + + ArtifactExecParameter + + Ns + + + + + + + + ComponentImplementations + + DDSReceiver + + ComponentIOR + + + + + + 153,160 + + + + + DDSReceiver.ior + + + String + + + + + + 380,128 + + + + + + + DDSReceiverImpl + + + + + + 363,160 + + + + + C70BC55F-5046-483D-AD6C-3F7E59B65412 + + + 0.0.0.0 + + + + + + + DDSReceiver_svnt + + + + + + 363,293 + + + + + + DDSReceiver_exec + + + + + + 503,293 + + + + + + DDSReceiver_stub + + + + + + 209,300 + + + + + + DDSReceiver + + + + + + 642,138 + + + + + + MonolithprimaryArtifact + + Sn + + + + + + MonolithprimaryArtifact + + Sn + + + + + + MonolithprimaryArtifact + + Sn + + + + + + Implements + + Ew + + + + + + ConfigProperty + + We + + + + + + + DDSReceiverAssembly + + DDSReceiverAssembly + + + + + + 366,121 + + + + + 40F07BB7-7E01-4487-B353-F0A207E97C54 + + + + + + DDSReceiver + + + + + + 453,131 + + + + + + + + 5D4C3D7C-D174-4204-8844-D391152EAB29 + + + + + + + + + dds_input + + + + + + + + false + + + false + + + false + + + + + + + + InterfaceDefinitions + + DDSEvent + + + + + + + + DDSTest + + + + + + 121,177 + + + + + + + + + + + + + + DDSTopic_event + + + + + + 174,48 + + + + + + + + + + + + + + false + + + DDSTopic + + + + + + 177,23 + + + + + + + + FileRef + + + + + + 121,93 + + + + + + + DDSReceiver + + + + + + + + DDSTest + + + + + + 275,51 + + + + + + + + + + + + + + DDSReceiver + + + + + + 341,173 + + + + + + 551,61 + + + + + + + + 22001825-8B05-4205-8C67-7AD023C00D47 + + + + + + + + + dds_input + + + + + + 93,184 + + + + + + 76,118 + + + + + + + + + + + false + + + false + + + false + + + + + DDSReceiverHome + + + + + + 76,195 + + + + + + + + + + + + ManagesComponent + + Ew + + + + + + + FileRef + + + + + + 93,51 + + + + + + + DDSTopic + + + + + + + + DDSTopic + + + + + + 261,72 + + + + + + + + + + + sequence_number + + + + + + 221,109 + + + + + + id + + + + + + 109,109 + + + + + + + DCPS_DATA_TYPE + + + + + + 135,65 + + + + + + + + + + + "DDSTopic" + + + + DCPS_DATA_KEY + + + + + + 135,149 + + + + + + + + + + + "DDSTopic 1" + + + + + + ComponentTypes + + DDSReceiver + + DDSReceiver + + + + + + 705,96 + + + + + + + + Targets + + OneNode + + F55AEA8A-9CC2-4EB8-9154-F7883F6F1B22 + + + + + + CCMNode + + + + + + 429,177 + + + + + + + + + + + ComponentBuild + + ProjectDescription + + Transmitter + + + + + + 303,205 + + + + + TransmitterExecutor + + + + + + 265,99 + + + + + + + + + + + + + + ExecutorArtifact + + + + + + 275,121 + + + + + + + TransmitterStub + + + + + + 433,106 + + + + + + + + + + + + + + StubArtifact + + + + + + 191,121 + + + + + + FileRef + + + + + + 307,125 + + + + + + + TransmitterServant + + + + + + 566,106 + + + + + + + + + + + + + + ServantArtifact + + + + + + 142,114 + + + + + + + + Transmitter + + + + + + 310,79 + + + + + + + + DeploymentPlans + + Deployment + + C7335AE9-0193-4D17-93E3-0DA18DB23CD0 + + + + + + CCMNode + + + + + + 207,151 + + + + + + DDSReceiver + + + + + + 348,124 + + + + + + InstanceMapping + + Ew + + + + + + ReceiverProcess + + + + + + 90,153 + + + + + + + + Datatypes + + Any + + + String + + + long + + + + + + Z:\DOC\CCMandDDS\DDSComponent\generated + + + + -- cgit v1.2.1