diff options
32 files changed, 6645 insertions, 0 deletions
diff --git a/dds_io_sub/.cdtbuild b/dds_io_sub/.cdtbuild new file mode 100644 index 0000000..d2e6110 --- /dev/null +++ b/dds_io_sub/.cdtbuild @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?fileVersion 3.1.0?> + +<ManagedProjectBuildInfo> +<project id="dds_io_sub.cdt.managedbuild.target.gnu.exe.1587408287" name="Executable (Gnu)" projectType="cdt.managedbuild.target.gnu.exe"> +<configuration artifactName="dds_io_sub" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.debug.1495543528" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug"> +<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1199063220" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.debug"> +<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.116016170" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"> +<option id="gnu.cpp.compiler.option.include.paths.1464029935" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> +<listOptionValue builtIn="false" value="/opt/ACE_wrappers"/> +<listOptionValue builtIn="false" value="/opt/ACE_wrappers/TAO"/> +<listOptionValue builtIn="false" value="/opt/DDS"/> +</option> +</tool> +<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1759225083" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"/> +<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.945226777" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/> +<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.180299039" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug"> +<option id="gnu.cpp.link.option.libs.768145728" superClass="gnu.cpp.link.option.libs" valueType="libs"> +<listOptionValue builtIn="false" value="OpenDDS_Dcps"/> +<listOptionValue builtIn="false" value="TAO_PI"/> +<listOptionValue builtIn="false" value="TAO_PortableServer"/> +<listOptionValue builtIn="false" value="TAO_AnyTypeCode"/> +<listOptionValue builtIn="false" value="TAO_IFR_Client"/> +<listOptionValue builtIn="false" value="TAO_TypeCodeFactory"/> +<listOptionValue builtIn="false" value="TAO_CodecFactory"/> +<listOptionValue builtIn="false" value="TAO"/> +<listOptionValue builtIn="false" value="TAO_RTCORBA"/> +<listOptionValue builtIn="false" value="ACE"/> +<listOptionValue builtIn="false" value="SimpleTcp"/> +<listOptionValue builtIn="false" value="SimpleUnreliableDgram"/> +</option> +<option id="gnu.cpp.link.option.paths.773575242" superClass="gnu.cpp.link.option.paths" valueType="stringList"> +<listOptionValue builtIn="false" value="/opt/DDS/lib"/> +<listOptionValue builtIn="false" value="/opt/ACE_wrappers/lib"/> +</option> +</tool> +<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.123969843" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug"/> +<macros/> +</toolChain> +</configuration> +<configuration artifactName="dds_io_sub" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.release.1115328087" name="Release" parent="cdt.managedbuild.config.gnu.exe.release"> +<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1850177850" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.release"> +<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1655339216" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release"/> +<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.563732115" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"/> +<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1617451725" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/> +<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1783377509" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"/> +<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1203467" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"/> +</toolChain> +</configuration> +</project> +</ManagedProjectBuildInfo> diff --git a/dds_io_sub/.cdtproject b/dds_io_sub/.cdtproject new file mode 100644 index 0000000..5552453 --- /dev/null +++ b/dds_io_sub/.cdtproject @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse-cdt version="2.0"?> + +<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake"> +<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/> +<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> +<data> +<item id="org.eclipse.cdt.core.pathentry"> +<pathentry kind="src" path=""/> +<pathentry kind="out" path=""/> +<pathentry kind="con" path="org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"/> +</item> +</data> +</cdtproject> diff --git a/dds_io_sub/.project b/dds_io_sub/.project new file mode 100644 index 0000000..db33e90 --- /dev/null +++ b/dds_io_sub/.project @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>dds_io_sub</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> + <nature>org.eclipse.cdt.core.ccnature</nature> + </natures> +</projectDescription> diff --git a/dds_io_sub/.settings/org.eclipse.cdt.core.prefs b/dds_io_sub/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 0000000..938f831 --- /dev/null +++ b/dds_io_sub/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,3 @@ +#Fri Oct 05 19:00:29 CEST 2007 +eclipse.preferences.version=1 +indexerId=org.eclipse.cdt.core.nullindexer diff --git a/dds_io_sub/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/dds_io_sub/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 0000000..2172669 --- /dev/null +++ b/dds_io_sub/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,10 @@ +#Fri Oct 05 18:59:01 CEST 2007 +cdt.managedbuild.config.gnu.exe.debug.1495543528/internalBuilder/enabled=false +cdt.managedbuild.config.gnu.exe.debug.1495543528/internalBuilder/ignoreErr=true +cdt.managedbuild.config.gnu.exe.release.1115328087/internalBuilder/enabled=false +cdt.managedbuild.config.gnu.exe.release.1115328087/internalBuilder/ignoreErr=true +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1495543528=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1495543528=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n +environment/project=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n +environment/project/cdt.managedbuild.config.gnu.exe.debug.1495543528=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n diff --git a/dds_io_sub/DataReaderListener.cpp b/dds_io_sub/DataReaderListener.cpp new file mode 100644 index 0000000..c110174 --- /dev/null +++ b/dds_io_sub/DataReaderListener.cpp @@ -0,0 +1,104 @@ +// -*- C++ -*- +// +// $Id: DataReaderListener.cpp 889 2007-06-29 21:55:06Z johnc $ +#include "DataReaderListener.h" +#include "PortTypeSupportC.h" +#include "PortTypeSupportImpl.h" +#include <dds/DCPS/Service_Participant.h> +#include <ace/streams.h> + +using namespace IOTest; + +// Implementation skeleton constructor +DataReaderListenerImpl::DataReaderListenerImpl() + : num_reads_(0) +{ +} + +// Implementation skeleton destructor +DataReaderListenerImpl::~DataReaderListenerImpl () +{ +} + +void DataReaderListenerImpl::on_data_available(DDS::DataReader_ptr reader) + throw (CORBA::SystemException) +{ + num_reads_ ++; + + try { + ::IOTest::PortDataReader_var port_dr = ::IOTest::PortDataReader::_narrow(reader); + if (CORBA::is_nil (port_dr.in ())) { + cerr << "read: _narrow failed." << endl; + exit(1); + } + + IOTest::Port port_obj; + DDS::SampleInfo si ; + DDS::ReturnCode_t status = port_dr->take_next_sample(port_obj, si) ; + + if (status == DDS::RETCODE_OK) { + cout << "Port: no: = " << port_obj.no << endl + << " value: = " << port_obj.value << endl; + cout << " sample_rank = " << si.sample_rank << endl; + + if(port_obj.no == 1) + io.set(port_obj.value); + + } else if (status == DDS::RETCODE_NO_DATA) { + cerr << "ERROR: reader received DDS::RETCODE_NO_DATA!" << endl; + } else { + cerr << "ERROR: read Message: Error: " << status << endl; + } + } catch (CORBA::Exception& e) { + cerr << "Exception caught in read:" << endl << e << endl; + exit(1); + } +} + +void DataReaderListenerImpl::on_requested_deadline_missed ( + DDS::DataReader_ptr, + const DDS::RequestedDeadlineMissedStatus &) + throw (CORBA::SystemException) +{ + cerr << "DataReaderListenerImpl::on_requested_deadline_missed" << endl; +} + +void DataReaderListenerImpl::on_requested_incompatible_qos ( + DDS::DataReader_ptr, + const DDS::RequestedIncompatibleQosStatus &) + throw (CORBA::SystemException) +{ + cerr << "DataReaderListenerImpl::on_requested_incompatible_qos" << endl; +} + +void DataReaderListenerImpl::on_liveliness_changed ( + DDS::DataReader_ptr, + const DDS::LivelinessChangedStatus &) + throw (CORBA::SystemException) +{ + cerr << "DataReaderListenerImpl::on_liveliness_changed" << endl; +} + +void DataReaderListenerImpl::on_subscription_match ( + DDS::DataReader_ptr, + const DDS::SubscriptionMatchStatus &) + throw (CORBA::SystemException) +{ + cerr << "DataReaderListenerImpl::on_subscription_match" << endl; +} + +void DataReaderListenerImpl::on_sample_rejected( + DDS::DataReader_ptr, + const DDS::SampleRejectedStatus&) + throw (CORBA::SystemException) +{ + cerr << "DataReaderListenerImpl::on_sample_rejected" << endl; +} + +void DataReaderListenerImpl::on_sample_lost( + DDS::DataReader_ptr, + const DDS::SampleLostStatus&) + throw (CORBA::SystemException) +{ + cerr << "DataReaderListenerImpl::on_sample_lost" << endl; +} diff --git a/dds_io_sub/DataReaderListener.h b/dds_io_sub/DataReaderListener.h new file mode 100644 index 0000000..355e2cd --- /dev/null +++ b/dds_io_sub/DataReaderListener.h @@ -0,0 +1,75 @@ +// -*- C++ -*- +// +// $Id: DataReaderListener.h 899 2007-07-05 16:36:52Z mitza $ +#ifndef DATAREADER_LISTENER_IMPL +#define DATAREADER_LISTENER_IMPL + +#include <dds/DdsDcpsSubscriptionS.h> + +#include "diasio.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +//Class DataReaderListenerImpl +class DataReaderListenerImpl + : public virtual OpenDDS::DCPS::LocalObject<DDS::DataReaderListener> +{ +public: + //Constructor + DataReaderListenerImpl (); + + //Destructor + virtual ~DataReaderListenerImpl (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); + + long num_reads() const { + return num_reads_; + } + +private: + DIASIO io; + DDS::DataReader_var reader_; + long num_reads_; +}; + +#endif /* DATAREADER_LISTENER_IMPL */ diff --git a/dds_io_sub/IOTest.idl b/dds_io_sub/IOTest.idl new file mode 100644 index 0000000..82f4025 --- /dev/null +++ b/dds_io_sub/IOTest.idl @@ -0,0 +1,12 @@ +module IOTest{ + +#pragma DCPS_DATA_TYPE "IOTest::Port" +#pragma DCPS_DATA_KEY "IOTest::Port no" + + struct Port { + long no; + long value; + }; + +}; + diff --git a/dds_io_sub/IOTestC.cpp b/dds_io_sub/IOTestC.cpp new file mode 100644 index 0000000..03b24b1 --- /dev/null +++ b/dds_io_sub/IOTestC.cpp @@ -0,0 +1,254 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:381 + + +#include "IOTestC.h" +#include "tao/AnyTypeCode/Null_RefCount_Policy.h" +#include "tao/AnyTypeCode/TypeCode_Constants.h" +#include "tao/AnyTypeCode/Alias_TypeCode_Static.h" +#include "tao/AnyTypeCode/Struct_TypeCode_Static.h" +#include "tao/AnyTypeCode/TypeCode_Struct_Field.h" +#include "tao/CDR.h" +#include "tao/CDR.h" +#include "tao/AnyTypeCode/Any_Dual_Impl_T.h" + +#if !defined (__ACE_INLINE__) +#include "IOTestC.inl" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:72 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_typecode/struct_typecode.cpp:84 + +static TAO::TypeCode::Struct_Field< + char const *, + ::CORBA::TypeCode_ptr const *> const + _tao_fields_IOTest_Port[] = + { + { "no", &CORBA::_tc_long }, + { "value", &CORBA::_tc_long } + }; + +static TAO::TypeCode::Struct< + char const *, + ::CORBA::TypeCode_ptr const *, + TAO::TypeCode::Struct_Field< + char const *, + ::CORBA::TypeCode_ptr const *> const *, + TAO::Null_RefCount_Policy> +_tao_tc_IOTest_Port ( + ::CORBA::tk_struct, + "IDL:IOTest/Port:1.0", + "Port", + _tao_fields_IOTest_Port, + 2); + +namespace IOTest +{ + ::CORBA::TypeCode_ptr const _tc_Port = + &_tao_tc_IOTest_Port; +} + + + +// TAO_IDL - Generated from +// be/be_visitor_structure/structure_cs.cpp:66 + +void +IOTest::Port::_tao_any_destructor ( + void *_tao_void_pointer + ) +{ + Port *_tao_tmp_pointer = + static_cast<Port *> (_tao_void_pointer); + delete _tao_tmp_pointer; +} + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_cs.cpp:54 + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +// Copying insertion. +void operator<<= ( + ::CORBA::Any &_tao_any, + const IOTest::Port &_tao_elem + ) +{ + if (0 == &_tao_elem) // Trying to de-reference NULL object + _tao_any <<= static_cast<IOTest::Port *>( 0 ); // Use non-copying insertion of a NULL + else + TAO::Any_Dual_Impl_T<IOTest::Port>::insert_copy ( + _tao_any, + IOTest::Port::_tao_any_destructor, + IOTest::_tc_Port, + _tao_elem + ); +} + +// Non-copying insertion. +void operator<<= ( + ::CORBA::Any &_tao_any, + IOTest::Port *_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<IOTest::Port>::insert ( + _tao_any, + IOTest::Port::_tao_any_destructor, + IOTest::_tc_Port, + _tao_elem + ); +} + +// Extraction to non-const pointer (deprecated). +::CORBA::Boolean operator>>= ( + const ::CORBA::Any &_tao_any, + IOTest::Port *&_tao_elem + ) +{ + return _tao_any >>= const_cast< + const IOTest::Port *&> ( + _tao_elem + ); +} + +// Extraction to const pointer. +::CORBA::Boolean operator>>= ( + const ::CORBA::Any &_tao_any, + const IOTest::Port *&_tao_elem + ) +{ + return + TAO::Any_Dual_Impl_T<IOTest::Port>::extract ( + _tao_any, + IOTest::Port::_tao_any_destructor, + IOTest::_tc_Port, + _tao_elem + ); +} +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_cs.cpp:61 + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +::CORBA::Boolean operator<< ( + TAO_OutputCDR &strm, + const IOTest::Port &_tao_aggregate + ) +{ + return + (strm << _tao_aggregate.no) && + (strm << _tao_aggregate.value); +} + +::CORBA::Boolean operator>> ( + TAO_InputCDR &strm, + IOTest::Port &_tao_aggregate + ) +{ + return + (strm >> _tao_aggregate.no) && + (strm >> _tao_aggregate.value); +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_structure/serializer_op_cs.cpp:61 + +::CORBA::Boolean _dcps_has_key (const IOTest::Port& ) { + return true; +} +size_t _dcps_max_marshaled_size (const IOTest::Port& _tao_aggregate) +{ + ACE_UNUSED_ARG (_tao_aggregate); // sometimes not used - avoid warning + return + _dcps_max_marshaled_size (_tao_aggregate.no) + + _dcps_max_marshaled_size (_tao_aggregate.value); +} + +::CORBA::Boolean _tao_is_bounded_size (const IOTest::Port& _tao_aggregate) +{ + ACE_UNUSED_ARG (_tao_aggregate); // often not used - avoid warning + return + true && + true ; +} + +size_t _dcps_find_size(const IOTest::Port& _tao_aggregate) +{ + ACE_UNUSED_ARG(_tao_aggregate); // sometimes not used - avoid warning + return + _dcps_max_marshaled_size (_tao_aggregate.no) + + _dcps_max_marshaled_size (_tao_aggregate.value); +} + +::CORBA::Boolean operator<< ( + TAO::DCPS::Serializer &strm, + const IOTest::Port &_tao_aggregate + ) +{ + return + (strm << _tao_aggregate.no) && + (strm << _tao_aggregate.value); +} + +::CORBA::Boolean operator>> ( + TAO::DCPS::Serializer &strm, + IOTest::Port &_tao_aggregate + ) +{ + return + (strm >> _tao_aggregate.no) && + (strm >> _tao_aggregate.value); +} + diff --git a/dds_io_sub/IOTestC.h b/dds_io_sub/IOTestC.h new file mode 100644 index 0000000..3803d83 --- /dev/null +++ b/dds_io_sub/IOTestC.h @@ -0,0 +1,168 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:135 + +#ifndef _TAO_IDL_IOTESTC_H_ +#define _TAO_IDL_IOTESTC_H_ + + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +#include "tao/AnyTypeCode/AnyTypeCode_methods.h" +#include "tao/ORB.h" +#include "tao/Basic_Types.h" +#include "dds/DCPS/Serializer.h" +#include "tao/VarOut_T.h" +#include /**/ "tao/Versioned_Namespace.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:49 + +namespace IOTest +{ + + // TAO_IDL - Generated from + // be/be_type.cpp:269 + + struct Port; + + typedef + TAO_Fixed_Var_T< + Port + > + Port_var; + + typedef + Port & + Port_out; + + // TAO_IDL - Generated from + // be/be_visitor_structure/structure_ch.cpp:57 + + struct Port + { + typedef Port_var _var_type; + typedef Port_out _out_type; + + static void _tao_any_destructor (void *); + ::CORBA::Long no; + ::CORBA::Long value; + }; + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern ::CORBA::TypeCode_ptr const _tc_Port; + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:78 + +} // module IOTest + +// TAO_IDL - Generated from +// be/be_visitor_traits.cpp:64 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +// Traits specializations. +namespace TAO +{ +} +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_ch.cpp:53 + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + void operator<<= (::CORBA::Any &, const IOTest::Port &); // copying version + void operator<<= (::CORBA::Any &, IOTest::Port*); // noncopying version + ::CORBA::Boolean operator>>= (const ::CORBA::Any &, IOTest::Port *&); // deprecated + ::CORBA::Boolean operator>>= (const ::CORBA::Any &, const IOTest::Port *&); +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_ch.cpp:54 + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + ::CORBA::Boolean operator<< (TAO_OutputCDR &, const IOTest::Port &); + ::CORBA::Boolean operator>> (TAO_InputCDR &, IOTest::Port &); + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_structure/serializer_op_ch.cpp:56 + + ::CORBA::Boolean _dcps_has_key(const IOTest::Port& val); +// This structure supports use of std::map with a key +// defined by one or more #pragma DCPS_DATA_KEY lines. +struct PortKeyLessThan +{ + bool operator() ( + const IOTest::Port& v1, + const IOTest::Port& v2) const + { + return (v1.no < v2.no); + } +}; + + size_t _dcps_max_marshaled_size (const IOTest::Port& _tao_aggregate); + ::CORBA::Boolean _tao_is_bounded_size (const IOTest::Port& _tao_aggregate); + size_t _dcps_find_size (const IOTest::Port& _tao_aggregate); + ::CORBA::Boolean operator<< (TAO::DCPS::Serializer &, const IOTest::Port &); + ::CORBA::Boolean operator>> (TAO::DCPS::Serializer &, IOTest::Port &); + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1219 +#if defined (__ACE_INLINE__) +#include "IOTestC.inl" +#endif /* defined INLINE */ + +#endif /* ifndef */ + + diff --git a/dds_io_sub/IOTestC.inl b/dds_io_sub/IOTestC.inl new file mode 100644 index 0000000..38aa325 --- /dev/null +++ b/dds_io_sub/IOTestC.inl @@ -0,0 +1,28 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + diff --git a/dds_io_sub/IOTestS.cpp b/dds_io_sub/IOTestS.cpp new file mode 100644 index 0000000..f1c0a06 --- /dev/null +++ b/dds_io_sub/IOTestS.cpp @@ -0,0 +1,73 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + +// TAO_IDL - Generated from +// be/be_codegen.cpp:703 + +#ifndef _TAO_IDL_IOTESTS_CPP_ +#define _TAO_IDL_IOTESTS_CPP_ + + +#include "IOTestS.h" + +#if !defined (__ACE_INLINE__) +#include "IOTestS.inl" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:72 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:72 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#endif /* ifndef */ + diff --git a/dds_io_sub/IOTestS.h b/dds_io_sub/IOTestS.h new file mode 100644 index 0000000..44fb047 --- /dev/null +++ b/dds_io_sub/IOTestS.h @@ -0,0 +1,63 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:487 + +#ifndef _TAO_IDL_IOTESTS_H_ +#define _TAO_IDL_IOTESTS_H_ + + +#include "IOTestC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +// TAO_IDL - Generated from +// be/be_visitor_module/module_sh.cpp:49 + +namespace POA_IOTest +{ + + +// TAO_IDL - Generated from +// be/be_visitor_module/module_sh.cpp:80 + +} // module IOTest + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1281 + + +#if defined (__ACE_INLINE__) +#include "IOTestS.inl" +#endif /* defined INLINE */ + +#endif /* ifndef */ + diff --git a/dds_io_sub/IOTestS.inl b/dds_io_sub/IOTestS.inl new file mode 100644 index 0000000..38aa325 --- /dev/null +++ b/dds_io_sub/IOTestS.inl @@ -0,0 +1,28 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + diff --git a/dds_io_sub/PortTypeSupport.idl b/dds_io_sub/PortTypeSupport.idl new file mode 100644 index 0000000..dd4f75d --- /dev/null +++ b/dds_io_sub/PortTypeSupport.idl @@ -0,0 +1,162 @@ + +// $Id: IDLTemplate.pm 899 2007-07-05 16:36:52Z mitza $ + +// Generated by dcps_ts.pl + +#include "dds/DdsDcpsInfrastructure.idl" +#include "dds/DdsDcpsTopic.idl" +#include "dds/DdsDcpsPublication.idl" +#include "dds/DdsDcpsSubscription.idl" +#include "dds/DdsDcpsTypeSupportExt.idl" + +#include "IOTest.idl" + +module IOTest { + + +#pragma DCPS_SUPPORT_ZERO_COPY_READ +#pragma DCPS_GEN_ZERO_COPY_READ +//typedef sequence<IOTest::Port> PortSeq; +native PortSeq; + +/** Support topic registartion for Port data type. + * + * See the DDS specification, OMG formal/04-12-02, for a description of + * this interface. + */ +local interface PortTypeSupport : OpenDDS::DCPS::TypeSupport { + DDS::ReturnCode_t register_type( + in DDS::DomainParticipant participant, + in string type_name); +}; + +/** DataWriter interface for Port data type. + * + * See the DDS specification, OMG formal/04-12-02, for a description of + * this interface. + */ +local interface PortDataWriter : DDS::DataWriter { + DDS::InstanceHandle_t register( + in IOTest::Port instance_data); + + DDS::InstanceHandle_t register_w_timestamp( + in IOTest::Port instance_data, + in DDS::InstanceHandle_t handle, + in DDS::Time_t source_timestamp); + + DDS::ReturnCode_t unregister( + in IOTest::Port instance_data, + in DDS::InstanceHandle_t handle); + + DDS::ReturnCode_t unregister_w_timestamp( + in IOTest::Port instance_data, + in DDS::InstanceHandle_t handle, + in DDS::Time_t source_timestamp); + + //WARNING: If the handle is non-nil and the instance is not registered + // then this operation may cause an access violation. + // This lack of safety helps performance. + DDS::ReturnCode_t write( + in IOTest::Port instance_data, + in DDS::InstanceHandle_t handle); + + //WARNING: If the handle is non-nil and the instance is not registered + // then this operation may cause an access violation. + // This lack of safety helps performance. + DDS::ReturnCode_t write_w_timestamp( + in IOTest::Port instance_data, + in DDS::InstanceHandle_t handle, + in DDS::Time_t source_timestamp); + + DDS::ReturnCode_t dispose( + in IOTest::Port instance_data, + in DDS::InstanceHandle_t instance_handle); + + DDS::ReturnCode_t dispose_w_timestamp( + in IOTest::Port instance_data, + in DDS::InstanceHandle_t instance_handle, + in DDS::Time_t source_timestamp); + + DDS::ReturnCode_t get_key_value( + inout IOTest::Port key_holder, + in DDS::InstanceHandle_t handle); +}; + +/** DataReader interface for Port data type. + * + * See the DDS specification, OMG formal/04-12-02, for a description of + * this interface. + */ +local interface PortDataReader : DDS::DataReader { + DDS::ReturnCode_t read( + inout PortSeq received_data, + inout DDS::SampleInfoSeq info_seq, + in long max_samples, + in DDS::SampleStateMask sample_states, + in DDS::ViewStateMask view_states, + in DDS::InstanceStateMask instance_states); + + DDS::ReturnCode_t take( + inout PortSeq received_data, + inout DDS::SampleInfoSeq info_seq, + in long max_samples, + in DDS::SampleStateMask sample_states, + in DDS::ViewStateMask view_states, + in DDS::InstanceStateMask instance_states); + + DDS::ReturnCode_t read_next_sample( + inout IOTest::Port received_data, + inout DDS::SampleInfo sample_info); + + DDS::ReturnCode_t take_next_sample( + inout IOTest::Port received_data, + inout DDS::SampleInfo sample_info); + + DDS::ReturnCode_t read_instance( + inout PortSeq received_data, + inout DDS::SampleInfoSeq info_seq, + in long max_samples, + in DDS::InstanceHandle_t a_handle, + in DDS::SampleStateMask sample_states, + in DDS::ViewStateMask view_states, + in DDS::InstanceStateMask instance_states); + + DDS::ReturnCode_t take_instance( + inout PortSeq received_data, + inout DDS::SampleInfoSeq info_seq, + in long max_samples, + in DDS::InstanceHandle_t a_handle, + in DDS::SampleStateMask sample_states, + in DDS::ViewStateMask view_states, + in DDS::InstanceStateMask instance_states); + + DDS::ReturnCode_t read_next_instance( + inout PortSeq received_data, + inout DDS::SampleInfoSeq info_seq, + in long max_samples, + in DDS::InstanceHandle_t a_handle, + in DDS::SampleStateMask sample_states, + in DDS::ViewStateMask view_states, + in DDS::InstanceStateMask instance_states); + + DDS::ReturnCode_t take_next_instance( + inout PortSeq received_data, + inout DDS::SampleInfoSeq info_seq, + in long max_samples, + in DDS::InstanceHandle_t a_handle, + in DDS::SampleStateMask sample_states, + in DDS::ViewStateMask view_states, + in DDS::InstanceStateMask instance_states); + + DDS::ReturnCode_t return_loan( + inout PortSeq received_data, + inout DDS::SampleInfoSeq info_seq); + + DDS::ReturnCode_t get_key_value( + inout IOTest::Port key_holder, + in DDS::InstanceHandle_t handle); +}; + +}; + + diff --git a/dds_io_sub/PortTypeSupportC.cpp b/dds_io_sub/PortTypeSupportC.cpp new file mode 100644 index 0000000..c20cc82 --- /dev/null +++ b/dds_io_sub/PortTypeSupportC.cpp @@ -0,0 +1,902 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:381 + + +#include "PortTypeSupportC.h" +#include "tao/AnyTypeCode/Null_RefCount_Policy.h" +#include "tao/AnyTypeCode/TypeCode_Constants.h" +#include "tao/AnyTypeCode/Alias_TypeCode_Static.h" +#include "tao/AnyTypeCode/Objref_TypeCode_Static.h" +#include "tao/AnyTypeCode/String_TypeCode_Static.h" +#include "tao/AnyTypeCode/Struct_TypeCode_Static.h" +#include "tao/AnyTypeCode/TypeCode_Struct_Field.h" +#include "tao/CDR.h" +#include "tao/CDR.h" +#include "tao/AnyTypeCode/Any.h" +#include "tao/AnyTypeCode/Any_Impl_T.h" +#include "tao/AnyTypeCode/Any_Dual_Impl_T.h" +#include "ace/OS_NS_string.h" + +#if !defined (__ACE_INLINE__) +#include "PortTypeSupportC.inl" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:72 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:60 + +// Traits specializations for IOTest::PortTypeSupport. + +IOTest::PortTypeSupport_ptr +TAO::Objref_Traits<IOTest::PortTypeSupport>::duplicate ( + IOTest::PortTypeSupport_ptr p) +{ + return IOTest::PortTypeSupport::_duplicate (p); +} + +void +TAO::Objref_Traits<IOTest::PortTypeSupport>::release ( + IOTest::PortTypeSupport_ptr p) +{ + ::CORBA::release (p); +} + +IOTest::PortTypeSupport_ptr +TAO::Objref_Traits<IOTest::PortTypeSupport>::nil (void) +{ + return IOTest::PortTypeSupport::_nil (); +} + +::CORBA::Boolean +TAO::Objref_Traits<IOTest::PortTypeSupport>::marshal ( + const IOTest::PortTypeSupport_ptr p, + TAO_OutputCDR & cdr) +{ + return ::CORBA::Object::marshal (p, cdr); +} + +IOTest::PortTypeSupport::PortTypeSupport (void) +{} + +IOTest::PortTypeSupport::~PortTypeSupport (void) +{} + +void +IOTest::PortTypeSupport::_tao_any_destructor (void *_tao_void_pointer) +{ + PortTypeSupport *_tao_tmp_pointer = + static_cast<PortTypeSupport *> (_tao_void_pointer); + ::CORBA::release (_tao_tmp_pointer); +} + +IOTest::PortTypeSupport_ptr +IOTest::PortTypeSupport::_narrow ( + ::CORBA::Object_ptr _tao_objref + ) +{ + return PortTypeSupport::_duplicate ( + dynamic_cast<PortTypeSupport_ptr> (_tao_objref) + ); +} + +IOTest::PortTypeSupport_ptr +IOTest::PortTypeSupport::_unchecked_narrow ( + ::CORBA::Object_ptr _tao_objref + ) +{ + return PortTypeSupport::_duplicate ( + dynamic_cast<PortTypeSupport_ptr> (_tao_objref) + ); +} + +IOTest::PortTypeSupport_ptr +IOTest::PortTypeSupport::_duplicate (PortTypeSupport_ptr obj) +{ + if (! ::CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void +IOTest::PortTypeSupport::_tao_release (PortTypeSupport_ptr obj) +{ + ::CORBA::release (obj); +} + +::CORBA::Boolean +IOTest::PortTypeSupport::_is_a (const char *value) +{ + if ( + !ACE_OS::strcmp ( + value, + "IDL:DDS/TypeSupport:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:OpenDDS/DCPS/TypeSupport:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:IOTest/PortTypeSupport:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/LocalObject:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/Object:1.0" + ) + ) + { + return true; // success using local knowledge + } + else + { + return false; + } +} + +const char* IOTest::PortTypeSupport::_interface_repository_id (void) const +{ + return "IDL:IOTest/PortTypeSupport:1.0"; +} + +::CORBA::Boolean +IOTest::PortTypeSupport::marshal (TAO_OutputCDR &) +{ + return false; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/objref_typecode.cpp:76 + +static TAO::TypeCode::Objref<char const *, + TAO::Null_RefCount_Policy> + _tao_tc_IOTest_PortTypeSupport ( + ::CORBA::tk_local_interface, + "IDL:IOTest/PortTypeSupport:1.0", + "PortTypeSupport"); + +namespace IOTest +{ + ::CORBA::TypeCode_ptr const _tc_PortTypeSupport = + &_tao_tc_IOTest_PortTypeSupport; +} + + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:60 + +// Traits specializations for IOTest::PortDataWriter. + +IOTest::PortDataWriter_ptr +TAO::Objref_Traits<IOTest::PortDataWriter>::duplicate ( + IOTest::PortDataWriter_ptr p) +{ + return IOTest::PortDataWriter::_duplicate (p); +} + +void +TAO::Objref_Traits<IOTest::PortDataWriter>::release ( + IOTest::PortDataWriter_ptr p) +{ + ::CORBA::release (p); +} + +IOTest::PortDataWriter_ptr +TAO::Objref_Traits<IOTest::PortDataWriter>::nil (void) +{ + return IOTest::PortDataWriter::_nil (); +} + +::CORBA::Boolean +TAO::Objref_Traits<IOTest::PortDataWriter>::marshal ( + const IOTest::PortDataWriter_ptr p, + TAO_OutputCDR & cdr) +{ + return ::CORBA::Object::marshal (p, cdr); +} + +IOTest::PortDataWriter::PortDataWriter (void) +{} + +IOTest::PortDataWriter::~PortDataWriter (void) +{} + +void +IOTest::PortDataWriter::_tao_any_destructor (void *_tao_void_pointer) +{ + PortDataWriter *_tao_tmp_pointer = + static_cast<PortDataWriter *> (_tao_void_pointer); + ::CORBA::release (_tao_tmp_pointer); +} + +IOTest::PortDataWriter_ptr +IOTest::PortDataWriter::_narrow ( + ::CORBA::Object_ptr _tao_objref + ) +{ + return PortDataWriter::_duplicate ( + dynamic_cast<PortDataWriter_ptr> (_tao_objref) + ); +} + +IOTest::PortDataWriter_ptr +IOTest::PortDataWriter::_unchecked_narrow ( + ::CORBA::Object_ptr _tao_objref + ) +{ + return PortDataWriter::_duplicate ( + dynamic_cast<PortDataWriter_ptr> (_tao_objref) + ); +} + +IOTest::PortDataWriter_ptr +IOTest::PortDataWriter::_duplicate (PortDataWriter_ptr obj) +{ + if (! ::CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void +IOTest::PortDataWriter::_tao_release (PortDataWriter_ptr obj) +{ + ::CORBA::release (obj); +} + +::CORBA::Boolean +IOTest::PortDataWriter::_is_a (const char *value) +{ + if ( + !ACE_OS::strcmp ( + value, + "IDL:DDS/Entity:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:DDS/DataWriter:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:IOTest/PortDataWriter:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/LocalObject:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/Object:1.0" + ) + ) + { + return true; // success using local knowledge + } + else + { + return false; + } +} + +const char* IOTest::PortDataWriter::_interface_repository_id (void) const +{ + return "IDL:IOTest/PortDataWriter:1.0"; +} + +::CORBA::Boolean +IOTest::PortDataWriter::marshal (TAO_OutputCDR &) +{ + return false; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/objref_typecode.cpp:76 + +static TAO::TypeCode::Objref<char const *, + TAO::Null_RefCount_Policy> + _tao_tc_IOTest_PortDataWriter ( + ::CORBA::tk_local_interface, + "IDL:IOTest/PortDataWriter:1.0", + "PortDataWriter"); + +namespace IOTest +{ + ::CORBA::TypeCode_ptr const _tc_PortDataWriter = + &_tao_tc_IOTest_PortDataWriter; +} + + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:60 + +// Traits specializations for IOTest::PortDataReader. + +IOTest::PortDataReader_ptr +TAO::Objref_Traits<IOTest::PortDataReader>::duplicate ( + IOTest::PortDataReader_ptr p) +{ + return IOTest::PortDataReader::_duplicate (p); +} + +void +TAO::Objref_Traits<IOTest::PortDataReader>::release ( + IOTest::PortDataReader_ptr p) +{ + ::CORBA::release (p); +} + +IOTest::PortDataReader_ptr +TAO::Objref_Traits<IOTest::PortDataReader>::nil (void) +{ + return IOTest::PortDataReader::_nil (); +} + +::CORBA::Boolean +TAO::Objref_Traits<IOTest::PortDataReader>::marshal ( + const IOTest::PortDataReader_ptr p, + TAO_OutputCDR & cdr) +{ + return ::CORBA::Object::marshal (p, cdr); +} + +IOTest::PortDataReader::PortDataReader (void) +{} + +IOTest::PortDataReader::~PortDataReader (void) +{} + +void +IOTest::PortDataReader::_tao_any_destructor (void *_tao_void_pointer) +{ + PortDataReader *_tao_tmp_pointer = + static_cast<PortDataReader *> (_tao_void_pointer); + ::CORBA::release (_tao_tmp_pointer); +} + +IOTest::PortDataReader_ptr +IOTest::PortDataReader::_narrow ( + ::CORBA::Object_ptr _tao_objref + ) +{ + return PortDataReader::_duplicate ( + dynamic_cast<PortDataReader_ptr> (_tao_objref) + ); +} + +IOTest::PortDataReader_ptr +IOTest::PortDataReader::_unchecked_narrow ( + ::CORBA::Object_ptr _tao_objref + ) +{ + return PortDataReader::_duplicate ( + dynamic_cast<PortDataReader_ptr> (_tao_objref) + ); +} + +IOTest::PortDataReader_ptr +IOTest::PortDataReader::_duplicate (PortDataReader_ptr obj) +{ + if (! ::CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void +IOTest::PortDataReader::_tao_release (PortDataReader_ptr obj) +{ + ::CORBA::release (obj); +} + +::CORBA::Boolean +IOTest::PortDataReader::_is_a (const char *value) +{ + if ( + !ACE_OS::strcmp ( + value, + "IDL:DDS/Entity:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:DDS/DataReader:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:IOTest/PortDataReader:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/LocalObject:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/Object:1.0" + ) + ) + { + return true; // success using local knowledge + } + else + { + return false; + } +} + +const char* IOTest::PortDataReader::_interface_repository_id (void) const +{ + return "IDL:IOTest/PortDataReader:1.0"; +} + +::CORBA::Boolean +IOTest::PortDataReader::marshal (TAO_OutputCDR &) +{ + return false; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/objref_typecode.cpp:76 + +static TAO::TypeCode::Objref<char const *, + TAO::Null_RefCount_Policy> + _tao_tc_IOTest_PortDataReader ( + ::CORBA::tk_local_interface, + "IDL:IOTest/PortDataReader:1.0", + "PortDataReader"); + +namespace IOTest +{ + ::CORBA::TypeCode_ptr const _tc_PortDataReader = + &_tao_tc_IOTest_PortDataReader; +} + + + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:51 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +namespace TAO +{ + template<> + ::CORBA::Boolean + Any_Impl_T<IOTest::PortTypeSupport>::to_object ( + ::CORBA::Object_ptr &_tao_elem + ) const + { + _tao_elem = ::CORBA::Object::_duplicate (this->value_); + return true; + } +} + +namespace TAO +{ + template<> + ::CORBA::Boolean + Any_Impl_T<IOTest::PortTypeSupport>::marshal_value (TAO_OutputCDR &) + { + return false; + } + + template<> + ::CORBA::Boolean + Any_Impl_T<IOTest::PortTypeSupport>::demarshal_value (TAO_InputCDR &) + { + return false; + } +} +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#if defined (ACE_ANY_OPS_USE_NAMESPACE) + +namespace IOTest +{ + + + /// Copying insertion. + void + operator<<= ( + ::CORBA::Any &_tao_any, + PortTypeSupport_ptr _tao_elem) + { + PortTypeSupport_ptr _tao_objptr = + PortTypeSupport::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; + } + + /// Non-copying insertion. + void + operator<<= ( + ::CORBA::Any &_tao_any, + PortTypeSupport_ptr *_tao_elem) + { + TAO::Any_Impl_T<PortTypeSupport>::insert ( + _tao_any, + PortTypeSupport::_tao_any_destructor, + _tc_PortTypeSupport, + *_tao_elem) + } + + ::CORBA::Boolean + operator>>= ( + const ::CORBA::Any &_tao_any, + PortTypeSupport_ptr &_tao_elem) + { + return + TAO::Any_Impl_T<PortTypeSupport>::extract ( + _tao_any, + PortTypeSupport::_tao_any_destructor, + _tc_PortTypeSupport, + _tao_elem) + } +} + +#else + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +/// Copying insertion. +void +operator<<= ( + ::CORBA::Any &_tao_any, + IOTest::PortTypeSupport_ptr _tao_elem) +{ + IOTest::PortTypeSupport_ptr _tao_objptr = + IOTest::PortTypeSupport::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +/// Non-copying insertion. +void +operator<<= ( + ::CORBA::Any &_tao_any, + IOTest::PortTypeSupport_ptr *_tao_elem) +{ + TAO::Any_Impl_T<IOTest::PortTypeSupport>::insert ( + _tao_any, + IOTest::PortTypeSupport::_tao_any_destructor, + IOTest::_tc_PortTypeSupport, + *_tao_elem); +} + +::CORBA::Boolean +operator>>= ( + const ::CORBA::Any &_tao_any, + IOTest::PortTypeSupport_ptr &_tao_elem) +{ + return + TAO::Any_Impl_T<IOTest::PortTypeSupport>::extract ( + _tao_any, + IOTest::PortTypeSupport::_tao_any_destructor, + IOTest::_tc_PortTypeSupport, + _tao_elem); +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#endif + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:51 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +namespace TAO +{ + template<> + ::CORBA::Boolean + Any_Impl_T<IOTest::PortDataWriter>::to_object ( + ::CORBA::Object_ptr &_tao_elem + ) const + { + _tao_elem = ::CORBA::Object::_duplicate (this->value_); + return true; + } +} + +namespace TAO +{ + template<> + ::CORBA::Boolean + Any_Impl_T<IOTest::PortDataWriter>::marshal_value (TAO_OutputCDR &) + { + return false; + } + + template<> + ::CORBA::Boolean + Any_Impl_T<IOTest::PortDataWriter>::demarshal_value (TAO_InputCDR &) + { + return false; + } +} +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#if defined (ACE_ANY_OPS_USE_NAMESPACE) + +namespace IOTest +{ + + + /// Copying insertion. + void + operator<<= ( + ::CORBA::Any &_tao_any, + PortDataWriter_ptr _tao_elem) + { + PortDataWriter_ptr _tao_objptr = + PortDataWriter::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; + } + + /// Non-copying insertion. + void + operator<<= ( + ::CORBA::Any &_tao_any, + PortDataWriter_ptr *_tao_elem) + { + TAO::Any_Impl_T<PortDataWriter>::insert ( + _tao_any, + PortDataWriter::_tao_any_destructor, + _tc_PortDataWriter, + *_tao_elem) + } + + ::CORBA::Boolean + operator>>= ( + const ::CORBA::Any &_tao_any, + PortDataWriter_ptr &_tao_elem) + { + return + TAO::Any_Impl_T<PortDataWriter>::extract ( + _tao_any, + PortDataWriter::_tao_any_destructor, + _tc_PortDataWriter, + _tao_elem) + } +} + +#else + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +/// Copying insertion. +void +operator<<= ( + ::CORBA::Any &_tao_any, + IOTest::PortDataWriter_ptr _tao_elem) +{ + IOTest::PortDataWriter_ptr _tao_objptr = + IOTest::PortDataWriter::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +/// Non-copying insertion. +void +operator<<= ( + ::CORBA::Any &_tao_any, + IOTest::PortDataWriter_ptr *_tao_elem) +{ + TAO::Any_Impl_T<IOTest::PortDataWriter>::insert ( + _tao_any, + IOTest::PortDataWriter::_tao_any_destructor, + IOTest::_tc_PortDataWriter, + *_tao_elem); +} + +::CORBA::Boolean +operator>>= ( + const ::CORBA::Any &_tao_any, + IOTest::PortDataWriter_ptr &_tao_elem) +{ + return + TAO::Any_Impl_T<IOTest::PortDataWriter>::extract ( + _tao_any, + IOTest::PortDataWriter::_tao_any_destructor, + IOTest::_tc_PortDataWriter, + _tao_elem); +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#endif + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:51 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +namespace TAO +{ + template<> + ::CORBA::Boolean + Any_Impl_T<IOTest::PortDataReader>::to_object ( + ::CORBA::Object_ptr &_tao_elem + ) const + { + _tao_elem = ::CORBA::Object::_duplicate (this->value_); + return true; + } +} + +namespace TAO +{ + template<> + ::CORBA::Boolean + Any_Impl_T<IOTest::PortDataReader>::marshal_value (TAO_OutputCDR &) + { + return false; + } + + template<> + ::CORBA::Boolean + Any_Impl_T<IOTest::PortDataReader>::demarshal_value (TAO_InputCDR &) + { + return false; + } +} +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#if defined (ACE_ANY_OPS_USE_NAMESPACE) + +namespace IOTest +{ + + + /// Copying insertion. + void + operator<<= ( + ::CORBA::Any &_tao_any, + PortDataReader_ptr _tao_elem) + { + PortDataReader_ptr _tao_objptr = + PortDataReader::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; + } + + /// Non-copying insertion. + void + operator<<= ( + ::CORBA::Any &_tao_any, + PortDataReader_ptr *_tao_elem) + { + TAO::Any_Impl_T<PortDataReader>::insert ( + _tao_any, + PortDataReader::_tao_any_destructor, + _tc_PortDataReader, + *_tao_elem) + } + + ::CORBA::Boolean + operator>>= ( + const ::CORBA::Any &_tao_any, + PortDataReader_ptr &_tao_elem) + { + return + TAO::Any_Impl_T<PortDataReader>::extract ( + _tao_any, + PortDataReader::_tao_any_destructor, + _tc_PortDataReader, + _tao_elem) + } +} + +#else + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +/// Copying insertion. +void +operator<<= ( + ::CORBA::Any &_tao_any, + IOTest::PortDataReader_ptr _tao_elem) +{ + IOTest::PortDataReader_ptr _tao_objptr = + IOTest::PortDataReader::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +/// Non-copying insertion. +void +operator<<= ( + ::CORBA::Any &_tao_any, + IOTest::PortDataReader_ptr *_tao_elem) +{ + TAO::Any_Impl_T<IOTest::PortDataReader>::insert ( + _tao_any, + IOTest::PortDataReader::_tao_any_destructor, + IOTest::_tc_PortDataReader, + *_tao_elem); +} + +::CORBA::Boolean +operator>>= ( + const ::CORBA::Any &_tao_any, + IOTest::PortDataReader_ptr &_tao_elem) +{ + return + TAO::Any_Impl_T<IOTest::PortDataReader>::extract ( + _tao_any, + IOTest::PortDataReader::_tao_any_destructor, + IOTest::_tc_PortDataReader, + _tao_elem); +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#endif + diff --git a/dds_io_sub/PortTypeSupportC.h b/dds_io_sub/PortTypeSupportC.h new file mode 100644 index 0000000..bed0641 --- /dev/null +++ b/dds_io_sub/PortTypeSupportC.h @@ -0,0 +1,656 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:135 + +#ifndef _TAO_IDL_PORTTYPESUPPORTC_H_ +#define _TAO_IDL_PORTTYPESUPPORTC_H_ + + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// added by manut +#include "dds/DdsDcpsTypeSupportExtC.h" + +#include "tao/AnyTypeCode/AnyTypeCode_methods.h" +#include "tao/ORB.h" +#include "tao/SystemException.h" +#include "tao/UserException.h" +#include "tao/Basic_Types.h" +#include "tao/ORB_Constants.h" +#include "dds/DCPS/ZeroCopyInfoSeq_T.h" +#include "dds/DCPS/ZeroCopySeq_T.h" +#include "tao/Object.h" +#include "tao/String_Manager_T.h" +#include "tao/Objref_VarOut_T.h" +#include /**/ "tao/Versioned_Namespace.h" + +#include "IOTestC.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:49 + +namespace IOTest +{ + + // TAO_IDL - Generated from + // be/be_visitor_native/native_ch.cpp:55 + + + + typedef ::TAO::DCPS::ZeroCopyDataSeq< IOTest::Port, DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE> PortSeq; + + + // TAO_IDL - Generated from + // be/be_interface.cpp:638 + +#if !defined (_IOTEST_PORTTYPESUPPORT__VAR_OUT_CH_) +#define _IOTEST_PORTTYPESUPPORT__VAR_OUT_CH_ + + class PortTypeSupport; + typedef PortTypeSupport *PortTypeSupport_ptr; + + typedef + TAO_Objref_Var_T< + PortTypeSupport + > + PortTypeSupport_var; + + typedef + TAO_Objref_Out_T< + PortTypeSupport + > + PortTypeSupport_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:54 + +#if !defined (_IOTEST_PORTTYPESUPPORT_CH_) +#define _IOTEST_PORTTYPESUPPORT_CH_ + + class PortTypeSupport + : public virtual ::OpenDDS::DCPS::TypeSupport + { + public: + typedef PortTypeSupport_ptr _ptr_type; + typedef PortTypeSupport_var _var_type; + typedef PortTypeSupport_out _out_type; + + // The static operations. + static PortTypeSupport_ptr _duplicate (PortTypeSupport_ptr obj); + + static void _tao_release (PortTypeSupport_ptr obj); + + static PortTypeSupport_ptr _narrow (::CORBA::Object_ptr obj); + static PortTypeSupport_ptr _unchecked_narrow (::CORBA::Object_ptr obj); + static PortTypeSupport_ptr _nil (void) + { + return static_cast<PortTypeSupport_ptr> (0); + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t register_type ( + ::DDS::DomainParticipant_ptr participant, + const char * type_name) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:216 + + virtual ::CORBA::Boolean _is_a (const char *type_id); + virtual const char* _interface_repository_id (void) const; + virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + // Abstract or local interface only. + PortTypeSupport (void); + + virtual ~PortTypeSupport (void); + + private: + // Private and unimplemented for concrete interfaces. + PortTypeSupport (const PortTypeSupport &); + + void operator= (const PortTypeSupport &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern ::CORBA::TypeCode_ptr const _tc_PortTypeSupport; + + // TAO_IDL - Generated from + // be/be_interface.cpp:638 + +#if !defined (_IOTEST_PORTDATAWRITER__VAR_OUT_CH_) +#define _IOTEST_PORTDATAWRITER__VAR_OUT_CH_ + + class PortDataWriter; + typedef PortDataWriter *PortDataWriter_ptr; + + typedef + TAO_Objref_Var_T< + PortDataWriter + > + PortDataWriter_var; + + typedef + TAO_Objref_Out_T< + PortDataWriter + > + PortDataWriter_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:54 + +#if !defined (_IOTEST_PORTDATAWRITER_CH_) +#define _IOTEST_PORTDATAWRITER_CH_ + + class PortDataWriter + : public virtual ::DDS::DataWriter + { + public: + typedef PortDataWriter_ptr _ptr_type; + typedef PortDataWriter_var _var_type; + typedef PortDataWriter_out _out_type; + + // The static operations. + static PortDataWriter_ptr _duplicate (PortDataWriter_ptr obj); + + static void _tao_release (PortDataWriter_ptr obj); + + static PortDataWriter_ptr _narrow (::CORBA::Object_ptr obj); + static PortDataWriter_ptr _unchecked_narrow (::CORBA::Object_ptr obj); + static PortDataWriter_ptr _nil (void) + { + return static_cast<PortDataWriter_ptr> (0); + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::InstanceHandle_t _cxx_register ( + const ::IOTest::Port & instance_data) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::InstanceHandle_t register_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t unregister ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t unregister_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t write ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t write_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t dispose ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t dispose_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle, + const ::DDS::Time_t & source_timestamp) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:216 + + virtual ::CORBA::Boolean _is_a (const char *type_id); + virtual const char* _interface_repository_id (void) const; + virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + // Abstract or local interface only. + PortDataWriter (void); + + virtual ~PortDataWriter (void); + + private: + // Private and unimplemented for concrete interfaces. + PortDataWriter (const PortDataWriter &); + + void operator= (const PortDataWriter &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern ::CORBA::TypeCode_ptr const _tc_PortDataWriter; + + // TAO_IDL - Generated from + // be/be_interface.cpp:638 + +#if !defined (_IOTEST_PORTDATAREADER__VAR_OUT_CH_) +#define _IOTEST_PORTDATAREADER__VAR_OUT_CH_ + + class PortDataReader; + typedef PortDataReader *PortDataReader_ptr; + + typedef + TAO_Objref_Var_T< + PortDataReader + > + PortDataReader_var; + + typedef + TAO_Objref_Out_T< + PortDataReader + > + PortDataReader_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:54 + +#if !defined (_IOTEST_PORTDATAREADER_CH_) +#define _IOTEST_PORTDATAREADER_CH_ + + class PortDataReader + : public virtual ::DDS::DataReader + { + public: + typedef PortDataReader_ptr _ptr_type; + typedef PortDataReader_var _var_type; + typedef PortDataReader_out _out_type; + + // The static operations. + static PortDataReader_ptr _duplicate (PortDataReader_ptr obj); + + static void _tao_release (PortDataReader_ptr obj); + + static PortDataReader_ptr _narrow (::CORBA::Object_ptr obj); + static PortDataReader_ptr _unchecked_narrow (::CORBA::Object_ptr obj); + static PortDataReader_ptr _nil (void) + { + return static_cast<PortDataReader_ptr> (0); + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t read ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t take ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t read_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t take_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t read_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t take_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t read_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t take_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t return_loan ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::DDS::ReturnCode_t get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:216 + + virtual ::CORBA::Boolean _is_a (const char *type_id); + virtual const char* _interface_repository_id (void) const; + virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + // Abstract or local interface only. + PortDataReader (void); + + virtual ~PortDataReader (void); + + private: + // Private and unimplemented for concrete interfaces. + PortDataReader (const PortDataReader &); + + void operator= (const PortDataReader &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern ::CORBA::TypeCode_ptr const _tc_PortDataReader; + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:78 + +} // module IOTest + +// TAO_IDL - Generated from +// be/be_visitor_traits.cpp:64 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +// Traits specializations. +namespace TAO +{ + +#if !defined (_IOTEST_PORTTYPESUPPORT__TRAITS_) +#define _IOTEST_PORTTYPESUPPORT__TRAITS_ + + template<> + struct Objref_Traits< ::IOTest::PortTypeSupport> + { + static ::IOTest::PortTypeSupport_ptr duplicate ( + ::IOTest::PortTypeSupport_ptr + ); + static void release ( + ::IOTest::PortTypeSupport_ptr + ); + static ::IOTest::PortTypeSupport_ptr nil (void); + static ::CORBA::Boolean marshal ( + const ::IOTest::PortTypeSupport_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ + +#if !defined (_IOTEST_PORTDATAWRITER__TRAITS_) +#define _IOTEST_PORTDATAWRITER__TRAITS_ + + template<> + struct Objref_Traits< ::IOTest::PortDataWriter> + { + static ::IOTest::PortDataWriter_ptr duplicate ( + ::IOTest::PortDataWriter_ptr + ); + static void release ( + ::IOTest::PortDataWriter_ptr + ); + static ::IOTest::PortDataWriter_ptr nil (void); + static ::CORBA::Boolean marshal ( + const ::IOTest::PortDataWriter_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ + +#if !defined (_IOTEST_PORTDATAREADER__TRAITS_) +#define _IOTEST_PORTDATAREADER__TRAITS_ + + template<> + struct Objref_Traits< ::IOTest::PortDataReader> + { + static ::IOTest::PortDataReader_ptr duplicate ( + ::IOTest::PortDataReader_ptr + ); + static void release ( + ::IOTest::PortDataReader_ptr + ); + static ::IOTest::PortDataReader_ptr nil (void); + static ::CORBA::Boolean marshal ( + const ::IOTest::PortDataReader_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ +} +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_ch.cpp:54 + + + +#if defined (ACE_ANY_OPS_USE_NAMESPACE) + +namespace IOTest +{ + void operator<<= ( ::CORBA::Any &, PortTypeSupport_ptr); // copying + void operator<<= ( ::CORBA::Any &, PortTypeSupport_ptr *); // non-copying + ::CORBA::Boolean operator>>= (const ::CORBA::Any &, PortTypeSupport_ptr &); +} + +#else + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + void operator<<= (::CORBA::Any &, IOTest::PortTypeSupport_ptr); // copying + void operator<<= (::CORBA::Any &, IOTest::PortTypeSupport_ptr *); // non-copying + ::CORBA::Boolean operator>>= (const ::CORBA::Any &, IOTest::PortTypeSupport_ptr &); +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#endif + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_ch.cpp:54 + + + +#if defined (ACE_ANY_OPS_USE_NAMESPACE) + +namespace IOTest +{ + void operator<<= ( ::CORBA::Any &, PortDataWriter_ptr); // copying + void operator<<= ( ::CORBA::Any &, PortDataWriter_ptr *); // non-copying + ::CORBA::Boolean operator>>= (const ::CORBA::Any &, PortDataWriter_ptr &); +} + +#else + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + void operator<<= (::CORBA::Any &, IOTest::PortDataWriter_ptr); // copying + void operator<<= (::CORBA::Any &, IOTest::PortDataWriter_ptr *); // non-copying + ::CORBA::Boolean operator>>= (const ::CORBA::Any &, IOTest::PortDataWriter_ptr &); +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#endif + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_ch.cpp:54 + + + +#if defined (ACE_ANY_OPS_USE_NAMESPACE) + +namespace IOTest +{ + void operator<<= ( ::CORBA::Any &, PortDataReader_ptr); // copying + void operator<<= ( ::CORBA::Any &, PortDataReader_ptr *); // non-copying + ::CORBA::Boolean operator>>= (const ::CORBA::Any &, PortDataReader_ptr &); +} + +#else + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + void operator<<= (::CORBA::Any &, IOTest::PortDataReader_ptr); // copying + void operator<<= (::CORBA::Any &, IOTest::PortDataReader_ptr *); // non-copying + ::CORBA::Boolean operator>>= (const ::CORBA::Any &, IOTest::PortDataReader_ptr &); +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#endif + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1219 +#if defined (__ACE_INLINE__) +#include "PortTypeSupportC.inl" +#endif /* defined INLINE */ + +#endif /* ifndef */ + + diff --git a/dds_io_sub/PortTypeSupportC.inl b/dds_io_sub/PortTypeSupportC.inl new file mode 100644 index 0000000..38aa325 --- /dev/null +++ b/dds_io_sub/PortTypeSupportC.inl @@ -0,0 +1,28 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + diff --git a/dds_io_sub/PortTypeSupportI.cpp b/dds_io_sub/PortTypeSupportI.cpp new file mode 100644 index 0000000..be0f12b --- /dev/null +++ b/dds_io_sub/PortTypeSupportI.cpp @@ -0,0 +1,454 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1189 + +#include "PortTypeSupportI.h" + +// Implementation skeleton constructor +IOTest_PortTypeSupport_i::IOTest_PortTypeSupport_i (void) +{ +} + +// Implementation skeleton destructor +IOTest_PortTypeSupport_i::~IOTest_PortTypeSupport_i (void) +{ +} + +::DDS::ReturnCode_t IOTest_PortTypeSupport_i::register_type ( + ::DDS::DomainParticipant_ptr participant, + const char * type_name) +{ + // Add your implementation here +} + +char * IOTest_PortTypeSupport_i::get_type_name ( + void) +{ + // Add your implementation here +} + +::DDS::DataWriter_ptr IOTest_PortTypeSupport_i::create_datawriter ( + void) +{ + // Add your implementation here +} + +::DDS::DataReader_ptr IOTest_PortTypeSupport_i::create_datareader ( + void) +{ + // Add your implementation here +} + +// Implementation skeleton constructor +IOTest_PortDataWriter_i::IOTest_PortDataWriter_i (void) +{ +} + +// Implementation skeleton destructor +IOTest_PortDataWriter_i::~IOTest_PortDataWriter_i (void) +{ +} + +::DDS::InstanceHandle_t IOTest_PortDataWriter_i::_cxx_register ( + const ::IOTest::Port & instance_data) +{ + // Add your implementation here +} + +::DDS::InstanceHandle_t IOTest_PortDataWriter_i::register_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::unregister ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::unregister_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::write ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::write_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::dispose ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::dispose_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle, + const ::DDS::Time_t & source_timestamp) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::enable ( + void) +{ + // Add your implementation here +} + +::DDS::StatusKindMask IOTest_PortDataWriter_i::get_status_changes ( + void) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::set_qos ( + const ::DDS::DataWriterQos & qos) +{ + // Add your implementation here +} + +void IOTest_PortDataWriter_i::get_qos ( + ::DDS::DataWriterQos & qos) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::set_listener ( + ::DDS::DataWriterListener_ptr a_listener, + ::DDS::StatusKindMask mask) +{ + // Add your implementation here +} + +::DDS::DataWriterListener_ptr IOTest_PortDataWriter_i::get_listener ( + void) +{ + // Add your implementation here +} + +::DDS::Topic_ptr IOTest_PortDataWriter_i::get_topic ( + void) +{ + // Add your implementation here +} + +::DDS::Publisher_ptr IOTest_PortDataWriter_i::get_publisher ( + void) +{ + // Add your implementation here +} + +::DDS::LivelinessLostStatus IOTest_PortDataWriter_i::get_liveliness_lost_status ( + void) +{ + // Add your implementation here +} + +::DDS::OfferedDeadlineMissedStatus IOTest_PortDataWriter_i::get_offered_deadline_missed_status ( + void) +{ + // Add your implementation here +} + +::DDS::OfferedIncompatibleQosStatus * IOTest_PortDataWriter_i::get_offered_incompatible_qos_status ( + void) +{ + // Add your implementation here +} + +::DDS::PublicationMatchStatus IOTest_PortDataWriter_i::get_publication_match_status ( + void) +{ + // Add your implementation here +} + +void IOTest_PortDataWriter_i::assert_liveliness ( + void) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::get_matched_subscriptions ( + ::DDS::InstanceHandleSeq & subscription_handles) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataWriter_i::get_matched_subscription_data ( + ::DDS::SubscriptionBuiltinTopicData & subscription_data, + ::DDS::InstanceHandle_t subscription_handle) +{ + // Add your implementation here +} + +// Implementation skeleton constructor +IOTest_PortDataReader_i::IOTest_PortDataReader_i (void) +{ +} + +// Implementation skeleton destructor +IOTest_PortDataReader_i::~IOTest_PortDataReader_i (void) +{ +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::read ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::take ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::read_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::take_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::read_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::take_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::read_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::take_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::return_loan ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::enable ( + void) +{ + // Add your implementation here +} + +::DDS::StatusKindMask IOTest_PortDataReader_i::get_status_changes ( + void) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::delete_contained_entities ( + void) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::set_qos ( + const ::DDS::DataReaderQos & qos) +{ + // Add your implementation here +} + +void IOTest_PortDataReader_i::get_qos ( + ::DDS::DataReaderQos & qos) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::set_listener ( + ::DDS::DataReaderListener_ptr a_listener, + ::DDS::StatusKindMask mask) +{ + // Add your implementation here +} + +::DDS::DataReaderListener_ptr IOTest_PortDataReader_i::get_listener ( + void) +{ + // Add your implementation here +} + +::DDS::TopicDescription_ptr IOTest_PortDataReader_i::get_topicdescription ( + void) +{ + // Add your implementation here +} + +::DDS::Subscriber_ptr IOTest_PortDataReader_i::get_subscriber ( + void) +{ + // Add your implementation here +} + +::DDS::SampleRejectedStatus IOTest_PortDataReader_i::get_sample_rejected_status ( + void) +{ + // Add your implementation here +} + +::DDS::LivelinessChangedStatus IOTest_PortDataReader_i::get_liveliness_changed_status ( + void) +{ + // Add your implementation here +} + +::DDS::RequestedDeadlineMissedStatus IOTest_PortDataReader_i::get_requested_deadline_missed_status ( + void) +{ + // Add your implementation here +} + +::DDS::RequestedIncompatibleQosStatus * IOTest_PortDataReader_i::get_requested_incompatible_qos_status ( + void) +{ + // Add your implementation here +} + +::DDS::SubscriptionMatchStatus IOTest_PortDataReader_i::get_subscription_match_status ( + void) +{ + // Add your implementation here +} + +::DDS::SampleLostStatus IOTest_PortDataReader_i::get_sample_lost_status ( + void) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::wait_for_historical_data ( + const ::DDS::Duration_t & max_wait) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::get_matched_publications ( + ::DDS::InstanceHandleSeq & publication_handles) +{ + // Add your implementation here +} + +::DDS::ReturnCode_t IOTest_PortDataReader_i::get_matched_publication_data ( + ::DDS::PublicationBuiltinTopicData & publication_data, + ::DDS::InstanceHandle_t publication_handle) +{ + // Add your implementation here +} + + diff --git a/dds_io_sub/PortTypeSupportI.h b/dds_io_sub/PortTypeSupportI.h new file mode 100644 index 0000000..ddd7c4f --- /dev/null +++ b/dds_io_sub/PortTypeSupportI.h @@ -0,0 +1,359 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1126 + +#ifndef PORTTYPESUPPORTI_H_ +#define PORTTYPESUPPORTI_H_ + +#include "PortTypeSupportS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" + +class IOTest_PortTypeSupport_i + : public virtual IOTest::PortTypeSupport, + public virtual TAO_Local_RefCounted_Object +{ +public: + // Constructor + IOTest_PortTypeSupport_i (void); + + // Destructor + virtual ~IOTest_PortTypeSupport_i (void); + + virtual + ::DDS::ReturnCode_t register_type ( + ::DDS::DomainParticipant_ptr participant, + const char * type_name) = 0; + + virtual + char * get_type_name ( + void) = 0; + + virtual + ::DDS::DataWriter_ptr create_datawriter ( + void) = 0; + + virtual + ::DDS::DataReader_ptr create_datareader ( + void) = 0; +}; + +class IOTest_PortDataWriter_i + : public virtual IOTest::PortDataWriter, + public virtual TAO_Local_RefCounted_Object +{ +public: + // Constructor + IOTest_PortDataWriter_i (void); + + // Destructor + virtual ~IOTest_PortDataWriter_i (void); + + virtual + ::DDS::InstanceHandle_t _cxx_register ( + const ::IOTest::Port & instance_data) = 0; + + virtual + ::DDS::InstanceHandle_t register_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp) = 0; + + virtual + ::DDS::ReturnCode_t unregister ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle) = 0; + + virtual + ::DDS::ReturnCode_t unregister_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp) = 0; + + virtual + ::DDS::ReturnCode_t write ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle) = 0; + + virtual + ::DDS::ReturnCode_t write_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp) = 0; + + virtual + ::DDS::ReturnCode_t dispose ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle) = 0; + + virtual + ::DDS::ReturnCode_t dispose_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle, + const ::DDS::Time_t & source_timestamp) = 0; + + virtual + ::DDS::ReturnCode_t get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle) = 0; + + virtual + ::DDS::ReturnCode_t enable ( + void) = 0; + + virtual + ::DDS::StatusKindMask get_status_changes ( + void) = 0; + + virtual + ::DDS::ReturnCode_t set_qos ( + const ::DDS::DataWriterQos & qos) = 0; + + virtual + void get_qos ( + ::DDS::DataWriterQos & qos) = 0; + + virtual + ::DDS::ReturnCode_t set_listener ( + ::DDS::DataWriterListener_ptr a_listener, + ::DDS::StatusKindMask mask) = 0; + + virtual + ::DDS::DataWriterListener_ptr get_listener ( + void) = 0; + + virtual + ::DDS::Topic_ptr get_topic ( + void) = 0; + + virtual + ::DDS::Publisher_ptr get_publisher ( + void) = 0; + + virtual + ::DDS::LivelinessLostStatus get_liveliness_lost_status ( + void) = 0; + + virtual + ::DDS::OfferedDeadlineMissedStatus get_offered_deadline_missed_status ( + void) = 0; + + virtual + ::DDS::OfferedIncompatibleQosStatus * get_offered_incompatible_qos_status ( + void) = 0; + + virtual + ::DDS::PublicationMatchStatus get_publication_match_status ( + void) = 0; + + virtual + void assert_liveliness ( + void) = 0; + + virtual + ::DDS::ReturnCode_t get_matched_subscriptions ( + ::DDS::InstanceHandleSeq & subscription_handles) = 0; + + virtual + ::DDS::ReturnCode_t get_matched_subscription_data ( + ::DDS::SubscriptionBuiltinTopicData & subscription_data, + ::DDS::InstanceHandle_t subscription_handle) = 0; +}; + +class IOTest_PortDataReader_i + : public virtual IOTest::PortDataReader, + public virtual TAO_Local_RefCounted_Object +{ +public: + // Constructor + IOTest_PortDataReader_i (void); + + // Destructor + virtual ~IOTest_PortDataReader_i (void); + + virtual + ::DDS::ReturnCode_t read ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + virtual + ::DDS::ReturnCode_t take ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + virtual + ::DDS::ReturnCode_t read_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info) = 0; + + virtual + ::DDS::ReturnCode_t take_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info) = 0; + + virtual + ::DDS::ReturnCode_t read_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + virtual + ::DDS::ReturnCode_t take_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + virtual + ::DDS::ReturnCode_t read_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + virtual + ::DDS::ReturnCode_t take_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states) = 0; + + virtual + ::DDS::ReturnCode_t return_loan ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq) = 0; + + virtual + ::DDS::ReturnCode_t get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle) = 0; + + virtual + ::DDS::ReturnCode_t enable ( + void) = 0; + + virtual + ::DDS::StatusKindMask get_status_changes ( + void) = 0; + + virtual + ::DDS::ReturnCode_t delete_contained_entities ( + void) = 0; + + virtual + ::DDS::ReturnCode_t set_qos ( + const ::DDS::DataReaderQos & qos) = 0; + + virtual + void get_qos ( + ::DDS::DataReaderQos & qos) = 0; + + virtual + ::DDS::ReturnCode_t set_listener ( + ::DDS::DataReaderListener_ptr a_listener, + ::DDS::StatusKindMask mask) = 0; + + virtual + ::DDS::DataReaderListener_ptr get_listener ( + void) = 0; + + virtual + ::DDS::TopicDescription_ptr get_topicdescription ( + void) = 0; + + virtual + ::DDS::Subscriber_ptr get_subscriber ( + void) = 0; + + virtual + ::DDS::SampleRejectedStatus get_sample_rejected_status ( + void) = 0; + + virtual + ::DDS::LivelinessChangedStatus get_liveliness_changed_status ( + void) = 0; + + virtual + ::DDS::RequestedDeadlineMissedStatus get_requested_deadline_missed_status ( + void) = 0; + + virtual + ::DDS::RequestedIncompatibleQosStatus * get_requested_incompatible_qos_status ( + void) = 0; + + virtual + ::DDS::SubscriptionMatchStatus get_subscription_match_status ( + void) = 0; + + virtual + ::DDS::SampleLostStatus get_sample_lost_status ( + void) = 0; + + virtual + ::DDS::ReturnCode_t wait_for_historical_data ( + const ::DDS::Duration_t & max_wait) = 0; + + virtual + ::DDS::ReturnCode_t get_matched_publications ( + ::DDS::InstanceHandleSeq & publication_handles) = 0; + + virtual + ::DDS::ReturnCode_t get_matched_publication_data ( + ::DDS::PublicationBuiltinTopicData & publication_data, + ::DDS::InstanceHandle_t publication_handle) = 0; +}; + + +#endif /* PORTTYPESUPPORTI_H_ */ + diff --git a/dds_io_sub/PortTypeSupportImpl.cpp b/dds_io_sub/PortTypeSupportImpl.cpp new file mode 100644 index 0000000..bcd2891 --- /dev/null +++ b/dds_io_sub/PortTypeSupportImpl.cpp @@ -0,0 +1,1939 @@ +// -*- C++ -*- +// +// $Id: CPPTemplate.pm 899 2007-07-05 16:36:52Z mitza $ + +// Generated by dcsp_ts.pl + + +#include "dds/DCPS/debug.h" +#include "dds/DCPS/Registered_Data_Types.h" +#include "dds/DdsDcpsDomainC.h" +#include "dds/DCPS/Service_Participant.h" +#include "dds/DCPS/Qos_Helper.h" +#include "dds/DCPS/PublicationInstance.h" +#include "dds/DCPS/PublisherImpl.h" +#include "dds/DCPS/SubscriberImpl.h" +#include "dds/DCPS/ReceivedDataElementList.h" +#include "dds/DCPS/transport/framework/TransportInterface.h" +#include "dds/DCPS/Util.h" +#include "PortTypeSupportImpl.h" + + +namespace +{ + using ::OpenDDS::DCPS::DataReaderImpl; + + typedef ::IOTest::PortSeq::PrivateMemberAccess SequenceType; + + struct LoanerGuard + { + LoanerGuard(SequenceType& seq, DataReaderImpl* dataReader) + : seq_(seq) + , dataReader_(dataReader) + , set_(false) + {} + + void set() { set_ = true; } + + ~LoanerGuard() + { + if(set_) seq_.set_loaner(dataReader_); + } + + SequenceType& seq_; + DataReaderImpl* dataReader_; + bool set_; + }; +} + + +namespace IOTest { + + +// VC6 can not understand the baseclass calling syntax +typedef OpenDDS::DCPS::DataWriterImpl OPENDDS_DCPS_DataWriterImpl; +typedef OpenDDS::DCPS::DataReaderImpl OPENDDS_DCPS_DataReaderImpl; + +// Implementation skeleton constructor +PortTypeSupportImpl::PortTypeSupportImpl (void) +{ +} + +// Implementation skeleton destructor +PortTypeSupportImpl::~PortTypeSupportImpl (void) +{ +} + +DDS::ReturnCode_t +PortTypeSupportImpl::register_type ( + ::DDS::DomainParticipant_ptr participant, + const char * type_name + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + if (type_name == 0 || type_name[0] == '\0') + this->type_name_ = this->get_type_name(); + else + this->type_name_ = CORBA::string_dup (type_name); + + return ::OpenDDS::DCPS::Registered_Data_Types->register_type(participant, + this->type_name_.in (), + this); +} + + +char * +PortTypeSupportImpl::get_type_name ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + if (this->type_name_ == NULL) + return CORBA::string_dup (this->_interface_repository_id()); + else + return CORBA::string_dup (this->type_name_.in ()); +} + + +::DDS::DataWriter_ptr +PortTypeSupportImpl::create_datawriter ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + PortDataWriterImpl* writer_impl; + ACE_NEW_RETURN(writer_impl, + PortDataWriterImpl(), + ::DDS::DataWriter::_nil()); + + + ::DDS::DataWriter_ptr writer_obj + = ::OpenDDS::DCPS::servant_to_reference (writer_impl); + + return writer_obj; +} + +::DDS::DataReader_ptr +PortTypeSupportImpl::create_datareader ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + PortDataReaderImpl* reader_impl = 0; + ACE_NEW_RETURN(reader_impl, + PortDataReaderImpl(), + ::DDS::DataReader::_nil()); + + + ::DDS::DataReader_ptr reader_obj + = ::OpenDDS::DCPS::servant_to_reference (reader_impl); + + return reader_obj; +} + +}; // IOTest + + +namespace IOTest { + + +// Implementation skeleton constructor +PortDataWriterImpl::PortDataWriterImpl (void) +: marshaled_size_ (0), + db_lock_pool_(0), + data_allocator_ (0), + mb_allocator_ (0), + db_allocator_ (0) +{ +} + +// Implementation skeleton destructor +PortDataWriterImpl::~PortDataWriterImpl (void) +{ + delete data_allocator_; + delete mb_allocator_; + delete db_allocator_; + delete db_lock_pool_; +} + +DDS::InstanceHandle_t +PortDataWriterImpl::_cxx_register ( + const ::IOTest::Port & instance_data + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ::DDS::Time_t source_timestamp + = ::OpenDDS::DCPS::time_value_to_time (ACE_OS::gettimeofday ()); + return register_w_timestamp (instance_data, + ::OpenDDS::DCPS::HANDLE_NIL, + source_timestamp); +} + +DDS::InstanceHandle_t +PortDataWriterImpl::register_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ACE_UNUSED_ARG (handle); + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + get_lock (), + ::DDS::RETCODE_ERROR); + ::DDS::InstanceHandle_t registered_handle; + ::DDS::ReturnCode_t ret + = this->get_or_create_instance_handle(registered_handle, + instance_data, + source_timestamp); + if (ret != ::DDS::RETCODE_OK) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT("(%P|%t) ") + ACE_TEXT("PortDataWriterImpl::register_w_timestamp, ") + ACE_TEXT("register failed error=%d.\n"), + ret)); + } + + return registered_handle; +} + + +DDS::ReturnCode_t +PortDataWriterImpl::unregister ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ::DDS::Time_t source_timestamp + = ::OpenDDS::DCPS::time_value_to_time (ACE_OS::gettimeofday ()); + return unregister_w_timestamp (instance_data, + handle, + source_timestamp); +} + +DDS::ReturnCode_t +PortDataWriterImpl::unregister_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + get_lock (), + ::DDS::RETCODE_ERROR); + ::DDS::InstanceHandle_t registered_handle + = this->get_instance_handle(instance_data); + + if(registered_handle == ::OpenDDS::DCPS::HANDLE_NIL) + { + // This case could be the instance is not registered yet or + // already unregistered. + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) ") + ACE_TEXT("PortDataWriterImpl::unregister, ") + ACE_TEXT("The instance is not registered.\n")), + ::DDS::RETCODE_ERROR); + } + else if (handle != ::OpenDDS::DCPS::HANDLE_NIL && handle != registered_handle) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) ") + ACE_TEXT("PortDataWriterImpl::unregister, ") + ACE_TEXT("The given handle=%X is different from " + "registered handle=%X.\n"), + handle, registered_handle), + ::DDS::RETCODE_ERROR); + } + + // DataWriterImpl::unregister will call back to inform the PortDataWriter + // that the instance handle is removed from there and hence PortDataWriter + // can remove the instance here. + return this->OPENDDS_DCPS_DataWriterImpl::unregister(handle, source_timestamp); +} + +DDS::ReturnCode_t +PortDataWriterImpl::write ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ::DDS::Time_t source_timestamp + = ::OpenDDS::DCPS::time_value_to_time (ACE_OS::gettimeofday ()); + return write_w_timestamp (instance_data, + handle, + source_timestamp); +} + +DDS::ReturnCode_t +PortDataWriterImpl::write_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + // A lock is obtained on entering this method to serialize access to + // the contained data storage and interfaces. This lock protects the + // marshaled data buffers as well as the instance data containers. + + // This operation assumes the provided handle is valid. The handle + // provided will not be verified. + + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + get_lock (), + ::DDS::RETCODE_ERROR); + + ACE_Message_Block* marshalled = 0; + + if (handle == ::DDS::HANDLE_NIL) + { + ::DDS::InstanceHandle_t registered_handle = ::DDS::HANDLE_NIL; + ::DDS::ReturnCode_t ret + = this->get_or_create_instance_handle(registered_handle, + instance_data, + source_timestamp); + if (ret != ::DDS::RETCODE_OK) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) ") + ACE_TEXT("PortDataWriterImpl::write, ") + ACE_TEXT("register failed err=%d.\n"), + ret), ret); + } + + handle = registered_handle; + } + + marshalled = dds_marshal (instance_data); // FOR_WRITE - using cached allocators + return this->OPENDDS_DCPS_DataWriterImpl::write(marshalled, handle, source_timestamp); +} + +DDS::ReturnCode_t +PortDataWriterImpl::dispose ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ::DDS::Time_t source_timestamp + = ::OpenDDS::DCPS::time_value_to_time (ACE_OS::gettimeofday ()); + return dispose_w_timestamp (instance_data, + instance_handle, + source_timestamp); +} + +DDS::ReturnCode_t +PortDataWriterImpl::dispose_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle, + const ::DDS::Time_t & source_timestamp + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + get_lock (), + ::DDS::RETCODE_ERROR); + + if(instance_handle == ::OpenDDS::DCPS::HANDLE_NIL) + { + instance_handle = this->get_instance_handle(instance_data); + if (instance_handle == ::OpenDDS::DCPS::HANDLE_NIL) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) ") + ACE_TEXT("PortDataWriterImpl::dispose, ") + ACE_TEXT("The instance sample is not registered.\n")), + ::DDS::RETCODE_ERROR); + } + } + + return this->OPENDDS_DCPS_DataWriterImpl::dispose(instance_handle, source_timestamp); +} + +DDS::ReturnCode_t +PortDataWriterImpl::get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + get_lock (), + ::DDS::RETCODE_ERROR); + InstanceMap::iterator it; + for (it = instance_map_.begin (); + it != instance_map_.end (); + it ++) + { + if (it->second == handle) + { + key_holder = it->first; + return ::DDS::RETCODE_OK; + } + } + + return ::DDS::RETCODE_ERROR; +} + + +void +PortDataWriterImpl::init ( + ::DDS::Topic_ptr topic, + OpenDDS::DCPS::TopicImpl *topic_servant, + const ::DDS::DataWriterQos & qos, + ::DDS::DataWriterListener_ptr a_listener, + OpenDDS::DCPS::DomainParticipantImpl* participant_servant, + ::DDS::Publisher_ptr publisher, + OpenDDS::DCPS::PublisherImpl* publisher_servant, + ::DDS::DataWriter_ptr dw_objref, + ::OpenDDS::DCPS::DataWriterRemote_ptr dw_remote_objref + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + this->OPENDDS_DCPS_DataWriterImpl::init (topic, + topic_servant, + qos, + a_listener, + participant_servant, + publisher, + publisher_servant, + dw_objref, + dw_remote_objref); + + ::IOTest::Port data; + if (_tao_is_bounded_size (data)) + { + marshaled_size_ = _dcps_max_marshaled_size (data); + } + else + { + marshaled_size_ = 0;// should use _dcps_find_size when marshaling + } +} + + +::DDS::ReturnCode_t +PortDataWriterImpl::enable_specific ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ::IOTest::Port data; + if (_tao_is_bounded_size (data)) + { + data_allocator_ = new DataAllocator (n_chunks_, marshaled_size_); + if (::OpenDDS::DCPS::DCPS_debug_level >= 2) + ACE_DEBUG((LM_DEBUG,"(%P|%t) PortDataWriterImpl::enable_specific-data" + " Dynamic_Cached_Allocator_With_Overflow %x with %d chunks\n", + data_allocator_, n_chunks_)); + } + else + { + if (::OpenDDS::DCPS::DCPS_debug_level >= 2) + ACE_DEBUG((LM_DEBUG,"(%P|%t) PortDataWriterImpl::enable_specific" + " is unbounded data - allocate from heap\n")); + } + + mb_allocator_ = + new ::OpenDDS::DCPS::MessageBlockAllocator (n_chunks_ * association_chunk_multiplier_); + db_allocator_ = new ::OpenDDS::DCPS::DataBlockAllocator (n_chunks_); + + if (::OpenDDS::DCPS::DCPS_debug_level >= 2) + { + ACE_DEBUG((LM_DEBUG,"(%P|%t) PortDataWriterImpl::enable_specific-mb" + " Cached_Allocator_With_Overflow %x with %d chunks\n", + mb_allocator_, n_chunks_ * association_chunk_multiplier_)); + ACE_DEBUG((LM_DEBUG,"(%P|%t) PortDataWriterImpl::enable_specific-db" + " Cached_Allocator_With_Overflow %x with %d chunks\n", + db_allocator_, n_chunks_)); + } + + + db_lock_pool_ = new DataBlockLockPool(n_chunks_); + + return ::DDS::RETCODE_OK; +} + +// Note: The PortDataWriter gives ownership of the marshalled data +// to the WriteDataContainer. +ACE_Message_Block* + PortDataWriterImpl::dds_marshal( + const ::IOTest::Port& instance_data, + int for_write) +{ + ACE_Message_Block* mb; + if (for_write) + { + ACE_NEW_MALLOC_RETURN (mb, + static_cast<ACE_Message_Block*> ( + mb_allocator_->malloc ( + sizeof (ACE_Message_Block))), + ACE_Message_Block( + marshaled_size_ ? marshaled_size_ : + _dcps_find_size(instance_data), + ACE_Message_Block::MB_DATA, + 0, //cont + 0, //data + data_allocator_, //allocator_strategy + db_lock_pool_->get_lock(), //data block locking_strategy + ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY, + ACE_Time_Value::zero, + ACE_Time_Value::max_time, + db_allocator_, + mb_allocator_), + 0); + } + else + { // Don't use the cached allocator for the registered sample message + // block. + + ACE_NEW_RETURN (mb, + ACE_Message_Block( + marshaled_size_ ? marshaled_size_ : + _dcps_find_size(instance_data) ), + 0); + } + + ::TAO::DCPS::Serializer serializer (mb, + this->get_publisher_servant()->swap_bytes()); + serializer << instance_data; + + return mb; +} + +::DDS::ReturnCode_t + PortDataWriterImpl::get_or_create_instance_handle( + DDS::InstanceHandle_t& handle, + const ::IOTest::Port& instance_data, + const ::DDS::Time_t & source_timestamp) +{ + handle = ::OpenDDS::DCPS::HANDLE_NIL; + InstanceMap::const_iterator it = instance_map_.find(instance_data); + + int needs_creation = 1; + int needs_registration = 1; + + if (it != instance_map_.end()) + { + needs_creation = 0; + + handle = it->second; + OpenDDS::DCPS::PublicationInstance* instance = + this->OPENDDS_DCPS_DataWriterImpl::get_handle_instance(handle); + + if (instance->unregistered_ == false) + { + needs_registration = 0; + } + // else: The instance is unregistered and now register again. + } + + if (needs_registration) + { + // don't use fast allocator for registration. + ACE_Message_Block* marshalled = this->dds_marshal(instance_data, 0); //NOT_FOR_WRITE + + // tell DataWriterLocal and Publisher about the instance. + ::DDS::ReturnCode_t ret = register_instance(handle, marshalled, source_timestamp); + // note: the WriteDataContainer/PublicationInstance maintains ownership + // of the marshalled sample. + + if (ret != ::DDS::RETCODE_OK) + { + marshalled->release (); + return ret; + } + + if (needs_creation) + { + std::pair<InstanceMap::iterator, bool> pair + = instance_map_.insert(InstanceMap::value_type(instance_data, handle)); + if (pair.second == false) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) " + "PortDataWriterImpl::get_or_create_instance_handle, ") + ACE_TEXT("insert IOTest::Port failed. \n")), + ::DDS::RETCODE_ERROR); + } + } // end of if (needs_creation) + } // end of if (needs_registration) + + return ::DDS::RETCODE_OK; +} + +::DDS::InstanceHandle_t + PortDataWriterImpl::get_instance_handle( + ::IOTest::Port instance_data) +{ + InstanceMap::const_iterator it = instance_map_.find(instance_data); + + if (it == instance_map_.end()) + { + return ::OpenDDS::DCPS::HANDLE_NIL; + } + else + { + return it->second; + } +} + + +void +PortDataWriterImpl::unregistered(::DDS::InstanceHandle_t instance_handle) +{ + // Previously this method removed the instance from the instance_map_. + // The instance handle will not be removed from the + // map so the instance for re-registration after unregistered + // will use the old handle. + ACE_UNUSED_ARG (instance_handle); +} + +}; // IOTest + + +namespace IOTest { + + +// Implementation skeleton constructor +PortDataReaderImpl::PortDataReaderImpl (void) +{ + +} + +void +PortDataReaderImpl::init ( + OpenDDS::DCPS::TopicImpl* a_topic, + const ::DDS::DataReaderQos & qos, + ::DDS::DataReaderListener_ptr a_listener, + OpenDDS::DCPS::DomainParticipantImpl* participant, + OpenDDS::DCPS::SubscriberImpl* subscriber, + ::DDS::Subscriber_ptr subscriber_objref, + ::DDS::DataReader_ptr dr_objerf, + OpenDDS::DCPS::DataReaderRemote_ptr dr_remote_objref + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + this->OPENDDS_DCPS_DataReaderImpl::init(a_topic, + qos, + a_listener, + participant, + subscriber, + subscriber_objref, + dr_objerf, + dr_remote_objref) ; + +} + +::DDS::ReturnCode_t +PortDataReaderImpl::enable_specific ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + data_allocator_ = new DataAllocator(get_n_chunks ()) ; + if (::OpenDDS::DCPS::DCPS_debug_level >= 2) + ACE_DEBUG((LM_DEBUG,"PortDataReaderImpl::enable_specific-data" + " Cached_Allocator_With_Overflow %x with %d chunks\n", + data_allocator_, this->get_n_chunks () )); + + return ::DDS::RETCODE_OK; +} + +// Implementation skeleton destructor +PortDataReaderImpl::~PortDataReaderImpl (void) +{ + InstanceMap::iterator it; + for (it = instance_map_.begin (); + it != instance_map_.end (); + it ++) + { + ::DDS::InstanceHandle_t handle = it->second; + OpenDDS::DCPS::SubscriptionInstance *ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (handle) ; + + while (ptr->rcvd_sample_.size_) + { + OpenDDS::DCPS::ReceivedDataElement *head_ptr = ptr->rcvd_sample_.head_ ; + ptr->rcvd_sample_.remove(head_ptr) ; + dec_ref_data_element(head_ptr); + } + + delete ptr ; + } + + delete data_allocator_ ; + //X SHH release the data samples in the instance_map_. +} + + +DDS::ReturnCode_t +PortDataReaderImpl::delete_contained_entities ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + return this->delete_contained_entities() ; +} + + +// ::IOTest:: IOTest:: +DDS::ReturnCode_t +PortDataReaderImpl::read ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + DDS::ReturnCode_t precond = check_inputs("read", received_data, info_seq, max_samples); + if (::DDS::RETCODE_OK != precond) + { + return precond; + } + + ::IOTest::PortSeq::PrivateMemberAccess received_data_p (received_data); + + ::CORBA::Long count(0); + + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + this->sample_lock_, + ::DDS::RETCODE_ERROR); + + LoanerGuard loanerGuard(received_data_p, this); + + InstanceMap::iterator it; + for (it = instance_map_.begin (); + it != instance_map_.end (); + it ++) + { + ::CORBA::Long start_samples_in_instance(count) ; + ::CORBA::Long samples_in_instance_count(0) ; + ::DDS::InstanceHandle_t handle = it->second; + + OpenDDS::DCPS::SubscriptionInstance *ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (handle) ; + + bool mrg = false; //most_recent_generation + + if ((ptr->instance_state_.view_state() & view_states) && + (ptr->instance_state_.instance_state() & instance_states)) + { + + for (OpenDDS::DCPS::ReceivedDataElement *item = ptr->rcvd_sample_.head_ ; + item != 0 ; item = item->next_data_sample_) + { + if (item->sample_state_ & sample_states) + { + // Increase sequence length before adding new element to sequence. + received_data_p.internal_set_length (count + 1); + if (received_data.maximum() != 0) + { + received_data_p.assign_sample(count, + *(::IOTest::Port *)item->registered_data_) ; + } + else + { + received_data_p.assign_ptr(count, item); + loanerGuard.set(); + } + // Increase sequence length before adding new element to sequence. + info_seq.length (count + 1); + ptr->instance_state_.sample_info(info_seq[count], item) ; + + item->sample_state_ = ::DDS::READ_SAMPLE_STATE ; + + if (! mrg) + mrg = ptr->instance_state_.most_recent_generation(item); + + count++ ; + samples_in_instance_count++ ; + } + if (count == max_samples) + { + break ; + } + } // end matches sample state + } // end matches view and instance state + + + if (samples_in_instance_count) + { + if (mrg) + ptr->instance_state_.accessed() ; + + // + // Get the sample_ranks, generation_ranks, and + // absolute_generation_ranks for this info_seq + // + sample_info(info_seq, start_samples_in_instance, + samples_in_instance_count, + ptr->rcvd_sample_.tail_) ; + } + + if (count == max_samples) + { + break ; + } + } + + if (count) + { + return ::DDS::RETCODE_OK; + } + else + { + return ::DDS::RETCODE_NO_DATA ; + } +} + +DDS::ReturnCode_t +PortDataReaderImpl::take ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + DDS::ReturnCode_t precond = check_inputs("take", received_data, info_seq, max_samples); + if (::DDS::RETCODE_OK != precond) + { + return precond; + } + + ::IOTest::PortSeq::PrivateMemberAccess received_data_p (received_data); + + ::CORBA::Long count(0) ; + + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + this->sample_lock_, + ::DDS::RETCODE_ERROR); + + LoanerGuard loanerGuard(received_data_p, this); + + InstanceMap::iterator it; + for (it = instance_map_.begin (); + it != instance_map_.end (); + it ++) + { + ::CORBA::Long start_samples_in_instance(count) ; + ::CORBA::Long samples_in_instance_count(0) ; + ::DDS::InstanceHandle_t handle = it->second; + OpenDDS::DCPS::SubscriptionInstance *ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (handle) ; + + bool mrg = false; //most_recent_generation + + OpenDDS::DCPS::ReceivedDataElement *tail = 0 ; + if ((ptr->instance_state_.view_state() & view_states) && + (ptr->instance_state_.instance_state() & instance_states)) + { + + OpenDDS::DCPS::ReceivedDataElement *next ; + tail = 0 ; + OpenDDS::DCPS::ReceivedDataElement *item = ptr->rcvd_sample_.head_ ; + while (item) + { + if (item->sample_state_ & sample_states) + { + // Increase sequence length before adding new element to sequence. + received_data_p.internal_set_length (count + 1); + if (received_data.maximum() != 0) + { + received_data_p.assign_sample(count, + *(::IOTest::Port *)item->registered_data_) ; + } + else + { + received_data_p.assign_ptr(count, item); + loanerGuard.set(); + } + // Increase sequence length before adding new element to sequence. + info_seq.length (count + 1); + ptr->instance_state_.sample_info(info_seq[count], item) ; + + item->sample_state_ = ::DDS::READ_SAMPLE_STATE ; + + if (! mrg) + mrg = ptr->instance_state_.most_recent_generation(item); + if (item == ptr->rcvd_sample_.tail_) + { + tail = ptr->rcvd_sample_.tail_ ; + item = item->next_data_sample_ ; + } + else + { + next = item->next_data_sample_ ; + + ptr->rcvd_sample_.remove(item) ; + dec_ref_data_element(item); + + item = next ; + } + + samples_in_instance_count++ ; + count++ ; + } + if (count == max_samples) + { + break ; + } + } + } + + if (samples_in_instance_count) + { + if (mrg) + ptr->instance_state_.accessed() ; + + // + // Get the sample_ranks, generation_ranks, and + // absolute_generation_ranks for this info_seq + // + if (tail) + { + sample_info(info_seq, start_samples_in_instance, + samples_in_instance_count, + tail) ; + + ptr->rcvd_sample_.remove(tail) ; + dec_ref_data_element(tail); + + } + else + { + sample_info(info_seq, start_samples_in_instance, + samples_in_instance_count, + ptr->rcvd_sample_.tail_) ; + } + } + if (count == max_samples) + { + break ; + } + } + + if (count) + { + return ::DDS::RETCODE_OK; + } + else + { + return ::DDS::RETCODE_NO_DATA ; + } +} + +DDS::ReturnCode_t +PortDataReaderImpl::read_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + + bool found_data = false; + + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + this->sample_lock_, + ::DDS::RETCODE_ERROR); + + InstanceMap::iterator it; + for (it = instance_map_.begin (); + it != instance_map_.end (); + it ++) + { + ::DDS::InstanceHandle_t handle = it->second; + OpenDDS::DCPS::SubscriptionInstance *ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (handle) ; + + bool mrg = false; //most_recent_generation + + if ((ptr->instance_state_.view_state() & ::DDS::ANY_VIEW_STATE) && + (ptr->instance_state_.instance_state() & ::DDS::ANY_INSTANCE_STATE)) + { + for (OpenDDS::DCPS::ReceivedDataElement *item = ptr->rcvd_sample_.head_ ; + item != 0 ; item = item->next_data_sample_) + { + if (item->sample_state_ & ::DDS::NOT_READ_SAMPLE_STATE) + { + received_data = + *((::IOTest::Port *)item->registered_data_) ; + ptr->instance_state_.sample_info(sample_info, item) ; + + item->sample_state_ = ::DDS::READ_SAMPLE_STATE ; + + + if (! mrg) + mrg = ptr->instance_state_.most_recent_generation(item); + + found_data = true ; + } + if (found_data) + { + break ; + } + } + } + + if (found_data) + { + if (mrg) + ptr->instance_state_.accessed() ; + + // + // Get the sample_ranks, generation_ranks, and + // absolute_generation_ranks for this info_seq + // + this->sample_info(sample_info, ptr->rcvd_sample_.tail_) ; + + break ; + } + } + + if (found_data) + { + return ::DDS::RETCODE_OK; + } + + return ::DDS::RETCODE_NO_DATA ; +} + +DDS::ReturnCode_t +PortDataReaderImpl::take_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + bool found_data = false; + + + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + this->sample_lock_, + ::DDS::RETCODE_ERROR); + + InstanceMap::iterator it; + for (it = instance_map_.begin (); + it != instance_map_.end (); + it ++) + { + ::DDS::InstanceHandle_t handle = it->second; + OpenDDS::DCPS::SubscriptionInstance *ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (handle) ; + + bool mrg = false; //most_recent_generation + + OpenDDS::DCPS::ReceivedDataElement *tail = 0 ; + if ((ptr->instance_state_.view_state() & ::DDS::ANY_VIEW_STATE) && + (ptr->instance_state_.instance_state() & ::DDS::ANY_INSTANCE_STATE)) + { + + OpenDDS::DCPS::ReceivedDataElement *next ; + tail = 0 ; + OpenDDS::DCPS::ReceivedDataElement *item = ptr->rcvd_sample_.head_ ; + while (item) + { + if (item->sample_state_ & ::DDS::NOT_READ_SAMPLE_STATE) + { + received_data = + *((::IOTest::Port *)item->registered_data_) ; + ptr->instance_state_.sample_info(sample_info, item) ; + + item->sample_state_ = ::DDS::READ_SAMPLE_STATE ; + + if (! mrg) + mrg = ptr->instance_state_.most_recent_generation(item); + + if (item == ptr->rcvd_sample_.tail_) + { + tail = ptr->rcvd_sample_.tail_ ; + item = item->next_data_sample_ ; + } + else + { + next = item->next_data_sample_ ; + + ptr->rcvd_sample_.remove(item) ; + dec_ref_data_element(item); + + item = next ; + } + + found_data = true; + } + if (found_data) + { + break ; + } + } + } + + if (found_data) + { + if (mrg) + ptr->instance_state_.accessed() ; + + // + // Get the sample_ranks, generation_ranks, and + // absolute_generation_ranks for this info_seq + // + if (tail) + { + this->sample_info(sample_info, tail) ; + + ptr->rcvd_sample_.remove(tail) ; + dec_ref_data_element(tail); + } + else + { + this->sample_info(sample_info, ptr->rcvd_sample_.tail_) ; + } + + break ; + } + } + + + + if (found_data) + { + return ::DDS::RETCODE_OK; + } + else + { + return ::DDS::RETCODE_NO_DATA ; + } +} + +DDS::ReturnCode_t +PortDataReaderImpl::read_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + DDS::ReturnCode_t precond = check_inputs("read_instance", received_data, info_seq, max_samples); + if (::DDS::RETCODE_OK != precond) + { + return precond; + } + + ::IOTest::PortSeq::PrivateMemberAccess received_data_p (received_data); + + ::CORBA::Long count(0) ; + + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + this->sample_lock_, + ::DDS::RETCODE_ERROR); + + LoanerGuard loanerGuard(received_data_p, this); + + OpenDDS::DCPS::SubscriptionInstance * ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (a_handle) ; + + bool mrg = false; //most_recent_generation + + if ((ptr->instance_state_.view_state() & view_states) && + (ptr->instance_state_.instance_state() & instance_states)) + { + for (OpenDDS::DCPS::ReceivedDataElement *item = ptr->rcvd_sample_.head_ ; + item != 0 ; item = item->next_data_sample_) + { + if (item->sample_state_ & sample_states) + { + // Increase sequence length before adding new element to sequence. + received_data_p.internal_set_length (count + 1); + if (received_data.maximum() != 0) + { + received_data_p.assign_sample(count, + *(::IOTest::Port *)item->registered_data_) ; + } + else + { + received_data_p.assign_ptr(count, item); + loanerGuard.set(); + } + // Increase sequence length before adding new element to sequence. + info_seq.length (count + 1); + ptr->instance_state_.sample_info(info_seq[count], item) ; + + item->sample_state_ = ::DDS::READ_SAMPLE_STATE ; + + if (! mrg) + mrg = ptr->instance_state_.most_recent_generation(item); + + count++ ; + } + + if (count == max_samples) + { + break ; + } + } + } + + if (count) + { + if (mrg) + ptr->instance_state_.accessed() ; + + // + // Get the sample_ranks, generation_ranks, and + // absolute_generation_ranks for this info_seq + // + sample_info(info_seq, 0, count, ptr->rcvd_sample_.tail_) ; + + return ::DDS::RETCODE_OK; + } + else + { + return ::DDS::RETCODE_NO_DATA ; + } +} + +DDS::ReturnCode_t +PortDataReaderImpl::take_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + DDS::ReturnCode_t precond = check_inputs("take_instance", received_data, info_seq, max_samples); + if (::DDS::RETCODE_OK != precond) + { + return precond; + } + + ::IOTest::PortSeq::PrivateMemberAccess received_data_p (received_data); + + ::CORBA::Long count(0) ; + + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + this->sample_lock_, + ::DDS::RETCODE_ERROR); + + LoanerGuard loanerGuard(received_data_p, this); + + OpenDDS::DCPS::SubscriptionInstance * ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (a_handle) ; + + OpenDDS::DCPS::ReceivedDataElement *tail = 0 ; + + bool mrg = false; //most_recent_generation + + if ((ptr->instance_state_.view_state() & view_states) && + (ptr->instance_state_.instance_state() & instance_states)) + { + OpenDDS::DCPS::ReceivedDataElement *next ; + tail = 0 ; + OpenDDS::DCPS::ReceivedDataElement *item = ptr->rcvd_sample_.head_ ; + while (item) + { + if (item->sample_state_ & sample_states) + { + // Increase sequence length before adding new element to sequence. + received_data_p.internal_set_length (count + 1); + if (received_data.maximum() != 0) + { + received_data_p.assign_sample(count, + *(::IOTest::Port *)item->registered_data_) ; + } + else + { + received_data_p.assign_ptr(count, item); + loanerGuard.set(); + } + + // Increase sequence length before adding new element to sequence. + info_seq.length (count + 1); + ptr->instance_state_.sample_info(info_seq[count], item) ; + + item->sample_state_ = ::DDS::READ_SAMPLE_STATE ; + + if (! mrg) + mrg = ptr->instance_state_.most_recent_generation(item); + if (item == ptr->rcvd_sample_.tail_) + { + tail = ptr->rcvd_sample_.tail_ ; + item = item->next_data_sample_ ; + } + else + { + next = item->next_data_sample_ ; + + ptr->rcvd_sample_.remove(item) ; + dec_ref_data_element(item); + + item = next ; + } + + count++ ; + } + if (count == max_samples) + { + break ; + } + } // while sample + } // if view/instance state + + if (count) + { + if (mrg) + ptr->instance_state_.accessed() ; + + // + // Get the sample_ranks, generation_ranks, and + // absolute_generation_ranks for this info_seq + // + if (tail) + { + sample_info(info_seq, 0, + count, + tail) ; + + ptr->rcvd_sample_.remove(tail) ; + dec_ref_data_element(tail); + } + else + { + sample_info(info_seq, 0, + count, + ptr->rcvd_sample_.tail_) ; + } + } + + if (count) + { + return ::DDS::RETCODE_OK; + } + else + { + return ::DDS::RETCODE_NO_DATA ; + } +} + +DDS::ReturnCode_t +PortDataReaderImpl::read_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ::DDS::InstanceHandle_t handle(::OpenDDS::DCPS::HANDLE_NIL) ; + + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + this->sample_lock_, + ::DDS::RETCODE_ERROR); + + InstanceMap::iterator it; + if (a_handle == ::OpenDDS::DCPS::HANDLE_NIL) + { + it = instance_map_.begin () ; + } + else + { + for (it = instance_map_.begin () ; it != instance_map_.end (); + it ++) + { + if (a_handle == it->second) + { + it++ ; + break ; + } + } + } + + DDS::ReturnCode_t status ; + + for (; it != instance_map_.end () ; it++) + { + handle = it->second ; + status = read_instance(received_data, info_seq, max_samples, + handle, sample_states, view_states, + instance_states) ; + if (status != ::DDS::RETCODE_NO_DATA) + { + return status ; + } + } + + return ::DDS::RETCODE_NO_DATA ; +} + +DDS::ReturnCode_t +PortDataReaderImpl::take_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ::DDS::InstanceHandle_t handle(::OpenDDS::DCPS::HANDLE_NIL) ; + + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + this->sample_lock_, + ::DDS::RETCODE_ERROR); + + InstanceMap::iterator it; + if (a_handle == ::OpenDDS::DCPS::HANDLE_NIL) + { + it = instance_map_.begin () ; + } + else + { + for (it = instance_map_.begin () ; it != instance_map_.end (); + it ++) + { + if (a_handle == it->second) + { + it++ ; + break ; + } + } + } + + DDS::ReturnCode_t status ; + + for (; it != instance_map_.end () ; it++) + { + handle = it->second ; + status = take_instance(received_data, info_seq, max_samples, + handle, sample_states, view_states, + instance_states) ; + if (status != ::DDS::RETCODE_NO_DATA) + { + total_samples() ; // see if we are empty + return status ; + } + } + + return ::DDS::RETCODE_NO_DATA ; +} + + +void +PortDataReaderImpl::release_loan ( + ::IOTest::PortSeq & received_data + ) +{ + received_data.length(0); +} + + +void +PortDataReaderImpl::dec_ref_data_element( + ::OpenDDS::DCPS::ReceivedDataElement* item + ) +{ + if (0 == item->dec_ref()) + { + ::IOTest::Port* ptr = static_cast< ::IOTest::Port* >(item->registered_data_); + ACE_DES_FREE (ptr, + data_allocator_->free, + Port ); + + ACE_DES_FREE (item, + rd_allocator_->free, + ReceivedDataElement); + } +} + + +DDS::ReturnCode_t +PortDataReaderImpl::return_loan ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + // some incomplete tests to see that the data and info are from the same read. + if (received_data.length() != info_seq.length()) + { + return ::DDS::RETCODE_PRECONDITION_NOT_MET; + } + + if (received_data.release()) + { + // nothing to do because this is not zero-copy data + return ::DDS::RETCODE_OK; + } + else + { + info_seq.length(0); + received_data.length(0); + } + return ::DDS::RETCODE_OK; +} + +DDS::ReturnCode_t +PortDataReaderImpl::get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + guard, + this->sample_lock_, + ::DDS::RETCODE_ERROR); + + InstanceMap::iterator it; + for (it = instance_map_.begin (); + it != instance_map_.end (); + it ++) + { + if (it->second == handle) + { + key_holder = it->first; + return ::DDS::RETCODE_OK; + } + } + + return ::DDS::RETCODE_ERROR; +} + +void +PortDataReaderImpl::dds_demarshal(const OpenDDS::DCPS::ReceivedDataSample& sample) +{ + ::IOTest::Port *data /* = new ::IOTest::Port(instance_data) */ ; + + ACE_NEW_MALLOC_NORETURN (data, + static_cast< ::IOTest::Port *> ( + data_allocator_->malloc ( + sizeof (::IOTest::Port))), + ::IOTest::Port) ; + + TAO::DCPS::Serializer ser(sample.sample_, sample.header_.byte_order_ != TAO_ENCAP_BYTE_ORDER) ; + ser >> *data ; + + store_instance_data(data, sample.header_) ; +} + +::DDS::ReturnCode_t +PortDataReaderImpl::store_instance_data( + ::IOTest::Port *instance_data, + const OpenDDS::DCPS::DataSampleHeader& header ) +{ + DDS::InstanceHandle_t handle(::OpenDDS::DCPS::HANDLE_NIL) ; + + //!!! caller should already have the sample_lock_ + + InstanceMap::const_iterator it = instance_map_.find(*instance_data); + + if (it == instance_map_.end()) + { + OpenDDS::DCPS::SubscriptionInstance* instance = 0; + handle = this->OPENDDS_DCPS_DataReaderImpl::get_next_handle (); + ACE_NEW_RETURN (instance, + OpenDDS::DCPS::SubscriptionInstance(this, handle), + ::DDS::RETCODE_ERROR); + + instance->instance_handle_ = handle; + int ret = bind(instances_, handle, instance); + + if (ret != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) " + "PortDataReaderImpl::store_instance_data, ") + ACE_TEXT("insert handle failed. \n")), + ::DDS::RETCODE_ERROR); + return ::DDS::RETCODE_ERROR; + } + + std::pair<InstanceMap::iterator, bool> bpair + = instance_map_.insert(InstanceMap::value_type(*instance_data, + handle)); + if (bpair.second == false) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) " + "PortDataReaderImpl::store_instance_data, ") + ACE_TEXT("insert ::IOTest::Port failed. \n")), + ::DDS::RETCODE_ERROR); + } + } + else + { + handle = it->second; + } + + if (header.message_id_ != OpenDDS::DCPS::INSTANCE_REGISTRATION) + { + OpenDDS::DCPS::SubscriptionInstance* instance_ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (handle) ; + + // TBD - we also need to reject for > RESOURCE_LIMITS.max_samples + // and RESOURCE_LIMITS.max_instances. + if ((this->qos_.resource_limits.max_samples_per_instance != + ::DDS::LENGTH_UNLIMITED) && + (instance_ptr->rcvd_sample_.size_ >= + this->qos_.resource_limits.max_samples_per_instance)) + { + if (instance_ptr->rcvd_sample_.head_->sample_state_ + == ::DDS::NOT_READ_SAMPLE_STATE) + { + // for now the implemented QoS means that if the head sample + // is NOT_READ then none are read. + // TBD - in future we will reads may not read in order so + // just looking at the head will not be enough. + ::DDS::DataReaderListener* listener + = listener_for (::DDS::SAMPLE_REJECTED_STATUS); + + sample_rejected_status_.last_reason = + ::DDS::REJECTED_BY_INSTANCE_LIMIT ; + sample_rejected_status_.total_count++ ; + sample_rejected_status_.total_count_change++ ; + sample_rejected_status_.last_instance_handle = handle ; + + if (listener != 0) + { + ::DDS::DataReader_var dr = get_dr_obj_ref(); + listener->on_sample_rejected(dr.in (), + sample_rejected_status_); + } // do we want to do something if listener is nil??? + + ACE_DES_FREE (instance_data, + data_allocator_->free, + Port ); + + return ::DDS::RETCODE_OK ; //OK? + } + else + { + // Discard the oldest previously-read sample + OpenDDS::DCPS::ReceivedDataElement *item = instance_ptr->rcvd_sample_.head_; + instance_ptr->rcvd_sample_.remove(item) ; + dec_ref_data_element(item); + } + } + + OpenDDS::DCPS::ReceivedDataElement *ptr /* = new OpenDDS::DCPS::ReceivedDataElement(data) */ ; + ACE_NEW_MALLOC_RETURN (ptr, + static_cast<OpenDDS::DCPS::ReceivedDataElement *> ( + rd_allocator_->malloc ( + sizeof (OpenDDS::DCPS::ReceivedDataElement))), + OpenDDS::DCPS::ReceivedDataElement(instance_data), + ::DDS::RETCODE_ERROR); + + instance_ptr->instance_state_.data_was_received() ; + + ptr->source_timestamp_.sec = header.source_timestamp_sec_ ; + ptr->source_timestamp_.nanosec = header.source_timestamp_nanosec_ ; + ptr->disposed_generation_count_ = + instance_ptr->instance_state_.disposed_generation_count() ; + ptr->no_writers_generation_count_ = + instance_ptr->instance_state_.no_writers_generation_count() ; + + ptr->sequence_ = header.sequence_ ; + instance_ptr->last_sequence_ = header.sequence_ ; + + instance_ptr->rcvd_sample_.add(ptr) ; + ptr->inc_ref() ; + + if (instance_ptr->rcvd_sample_.size_ > get_depth()) + { + OpenDDS::DCPS::ReceivedDataElement *head_ptr = + instance_ptr->rcvd_sample_.head_ ; + + instance_ptr->rcvd_sample_.remove(head_ptr) ; + + if (head_ptr->sample_state_ == ::DDS::NOT_READ_SAMPLE_STATE) + { + ::DDS::DataReaderListener* listener + = listener_for (::DDS::SAMPLE_LOST_STATUS); + + sample_lost_status_.total_count++ ; + sample_lost_status_.total_count_change++ ; + + if (listener) + { + ::DDS::DataReader_var dr = get_dr_obj_ref(); + listener->on_sample_lost(dr.in (), sample_lost_status_); + } + } + + dec_ref_data_element(head_ptr); + } + + OpenDDS::DCPS::SubscriberImpl* sub = get_subscriber_servant () ; + ::DDS::SubscriberListener* sub_listener = + sub->listener_for(::DDS::DATA_ON_READERS_STATUS) ; + if (sub_listener != 0) + { + sub_listener->on_data_on_readers(get_subscriber()) ; + } + else + { + ::DDS::DataReaderListener* listener + = listener_for (::DDS::DATA_AVAILABLE_STATUS); + + if (listener != 0) + { + ::DDS::DataReader_var dr = get_dr_obj_ref(); + listener->on_data_available(dr.in ()); + } + } + } + else + { + OpenDDS::DCPS::SubscriptionInstance *instance_ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (handle) ; + instance_ptr->instance_state_.lively(header.publication_id_) ; + ACE_DES_FREE (instance_data, + data_allocator_->free, + Port ); + } + + return ::DDS::RETCODE_OK; +} + +void +PortDataReaderImpl::dispose(const OpenDDS::DCPS::ReceivedDataSample& sample) +{ + //!!! caller should already have the sample_lock_ + + ::IOTest::Port *data /* = new ::IOTest::Port(instance_data) */ ; + ACE_NEW_MALLOC_NORETURN (data, + static_cast< ::IOTest::Port *> ( + data_allocator_->malloc ( + sizeof (::IOTest::Port))), + ::IOTest::Port) ; + + TAO::DCPS::Serializer ser(sample.sample_, sample.header_.byte_order_ != TAO_ENCAP_BYTE_ORDER) ; + ser >> *data ; + + DDS::InstanceHandle_t handle(::OpenDDS::DCPS::HANDLE_NIL) ; + + InstanceMap::const_iterator it = instance_map_.find(*data); + + if (it != instance_map_.end()) + { + handle = it->second; + OpenDDS::DCPS::SubscriptionInstance* instance_ptr = + this->OPENDDS_DCPS_DataReaderImpl::get_handle_instance (handle) ; + instance_ptr->instance_state_.dispose_was_received() ; + } + else if (! this->is_bit ()) + { + ACE_ERROR((LM_ERROR, + ACE_TEXT("(%P|%t) ") + ACE_TEXT("PortDataReaderImpl::disposed, ") + ACE_TEXT("The instance is not registered.\n"))); + } + + ACE_DES_FREE (data, + data_allocator_->free, + Port ); +} + +DDS::ReturnCode_t +PortDataReaderImpl::auto_return_loan(void* seq) +{ + ::IOTest::PortSeq& received_data = *(::IOTest::PortSeq*)seq; + + if (!received_data.release()) + { + // this->release_loan(received_data); + received_data.length(0); + } + return ::DDS::RETCODE_OK; +} + +DDS::ReturnCode_t +PortDataReaderImpl::check_inputs ( + const char* method_name, + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long& max_samples + ) +{ + ::IOTest::PortSeq::PrivateMemberAccess received_data_p (received_data); + + //---- start of preconditions common to read and take ----- + //SPEC ref v1.2 7.1.2.5.3.8 #1 + //NOTE: we can't check maximum() or release() here since those are + //implementation details of the sequences. In general, the info_seq will + //have release() == true and maximum() == 0. If we're in zero-copy mode, the + //received_data will have release() == false and maximum() == 0. If it's not + //zero-copy then received_data will have release == true() and maximum() == + //anything. + if (received_data.length() != info_seq.length()) + { + ACE_DEBUG((LM_DEBUG,"PortDataReaderImpl::%s PRECONDITION_NOT_MET sample and info input sequences do not match.\n", + method_name )); + return ::DDS::RETCODE_PRECONDITION_NOT_MET; + } + + //SPEC ref v1.2 7.1.2.5.3.8 #4 + if ((received_data.maximum() > 0) && (received_data.release() == false)) + { + ACE_DEBUG((LM_DEBUG,"PortDataReaderImpl::%s PRECONDITION_NOT_MET mismatch of maximum %d and owns %d\n", + method_name, received_data.maximum(), received_data.release() )); + return ::DDS::RETCODE_PRECONDITION_NOT_MET; + } + + if (received_data.maximum() == 0) + { + // not in SPEC but needed. + if (max_samples == ::DDS::LENGTH_UNLIMITED) + { + max_samples = (::CORBA::Long)received_data_p.max_slots(); + } + } + else + { + if (max_samples == ::DDS::LENGTH_UNLIMITED) + { + //SPEC ref v1.2 7.1.2.5.3.8 #5a + max_samples = received_data.maximum(); + } + else if (max_samples > (::CORBA::Long)received_data.maximum()) + { + //SPEC ref v1.2 7.1.2.5.3.8 #5c + ACE_DEBUG((LM_DEBUG,"PortDataReaderImpl::read PRECONDITION_NOT_MET max_samples %d > maximum %d\n", + method_name, max_samples, received_data.maximum() )); + return ::DDS::RETCODE_PRECONDITION_NOT_MET; + + } + //else + //SPEC ref v1.2 7.1.2.5.3.8 #5b - is true by impl below. + } + + // The spec does not say what to do in this case but it appears to be a good thing. + // Note: max_slots is the greater of the sequence's maximum and init_size. + if ((::CORBA::Long)received_data_p.max_slots() < max_samples) + { + max_samples = (::CORBA::Long)received_data_p.max_slots(); + } + //---- end of preconditions common to read and take ----- + + return ::DDS::RETCODE_OK; +} + +void +PortDataReaderImpl::release_instance_i (::DDS::InstanceHandle_t handle) +{ + InstanceMap::iterator it; + for (it = instance_map_.begin (); + it != instance_map_.end (); + it ++) + { + if (it->second == handle) + break; + } + + if (it != instance_map_.end ()) + { + instance_map_.erase (it); + } +} + + +//OpenDDS::DCPS::DataReaderRemote_ptr +//PortDataReaderImpl::get_datareaderremote_obj_ref () +//{ +// ::OpenDDS::DCPS::DataReaderRemote_ptr reader_obj +// = ::OpenDDS::DCPS::servant_to_reference +// (this); +// ACE_CHECK_RETURN (::OpenDDS::DCPS::DataReaderRemote::_nil()); +// +// // servant_to_reference does not duplicate when the object is already active +// return OpenDDS::DCPS::DataReaderRemote::_duplicate(reader_obj); +//} +}; // IOTest + + + diff --git a/dds_io_sub/PortTypeSupportImpl.h b/dds_io_sub/PortTypeSupportImpl.h new file mode 100644 index 0000000..70c72c3 --- /dev/null +++ b/dds_io_sub/PortTypeSupportImpl.h @@ -0,0 +1,493 @@ +// -*- C++ -*- +// +// $Id: HTemplate.pm 899 2007-07-05 16:36:52Z mitza $ + +// Generated by dcps_ts.pl + +#ifndef PORTTYPESUPPORTI_H_ +#define PORTTYPESUPPORTI_H_ + +#include "PortTypeSupportS.h" +#include "dds/DCPS/DataWriterImpl.h" +#include "dds/DCPS/DataReaderImpl.h" +#include "dds/DCPS/Dynamic_Cached_Allocator_With_Overflow_T.h" +#include "dds/DCPS/DataBlockLockPool.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace IOTest { + +/** Servant for TypeSuport interface of Port data type. + * + * See the DDS specification, OMG formal/04-12-02, for a description of + * this interface. + * + */ +class PortTypeSupportImpl + : public virtual OpenDDS::DCPS::LocalObject<PortTypeSupport> +{ +public: + + //Constructor + PortTypeSupportImpl (void); + + //Destructor + virtual ~PortTypeSupportImpl (void); + + virtual + DDS::ReturnCode_t register_type ( + ::DDS::DomainParticipant_ptr participant, + const char * type_name + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + char * get_type_name ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + ::DDS::DataWriter_ptr create_datawriter ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + ::DDS::DataReader_ptr create_datareader ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + private: + CORBA::String_var type_name_; +}; +}; // IOTest + + +namespace IOTest { + + +/** Servant for DataWriter interface of the Port data type. + * + * See the DDS specification, OMG formal/04-12-02, for a description of + * this interface. + */ +class PortDataWriterImpl + : public virtual OpenDDS::DCPS::LocalObject<PortDataWriter>, + public virtual OpenDDS::DCPS::DataWriterImpl +{ +public: + + typedef std::map<IOTest::Port, DDS::InstanceHandle_t, + PortKeyLessThan> InstanceMap; + typedef ::OpenDDS::DCPS::Dynamic_Cached_Allocator_With_Overflow<ACE_Null_Mutex> DataAllocator; + + //Constructor + PortDataWriterImpl (void); + + //Destructor + virtual ~PortDataWriterImpl (void); + + virtual + DDS::InstanceHandle_t _cxx_register ( + const ::IOTest::Port & instance_data + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::InstanceHandle_t register_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t unregister ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t unregister_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + //WARNING: If the handle is non-nil and the instance is not registered + // then this operation may cause an access violation. + // This lack of safety helps performance. + virtual + DDS::ReturnCode_t write ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + //WARNING: If the handle is non-nil and the instance is not registered + // then this operation may cause an access violation. + // This lack of safety helps performance. + virtual + DDS::ReturnCode_t write_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t handle, + const ::DDS::Time_t & source_timestamp + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t dispose ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t dispose_w_timestamp ( + const ::IOTest::Port & instance_data, + ::DDS::InstanceHandle_t instance_handle, + const ::DDS::Time_t & source_timestamp + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + + /** + * Initialize the DataWriter object. + * Called as part of create_datawriter. + */ + virtual void init ( + ::DDS::Topic_ptr topic, + OpenDDS::DCPS::TopicImpl *topic_servant, + const ::DDS::DataWriterQos & qos, + ::DDS::DataWriterListener_ptr a_listener, + OpenDDS::DCPS::DomainParticipantImpl* participant_servant, + ::DDS::Publisher_ptr publisher, + OpenDDS::DCPS::PublisherImpl* publisher_servant, + ::DDS::DataWriter_ptr dw_objref, + ::OpenDDS::DCPS::DataWriterRemote_ptr dw_remote_objref + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + /** + * Do parts of enable specific to the datatype. + * Called by DataWriterImpl::enable(). + */ + virtual ::DDS::ReturnCode_t enable_specific ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + /** + * The framework has completed its part of unregistering the + * given instance. + */ + virtual void unregistered(::DDS::InstanceHandle_t instance_handle); + + /** + * Accessor to the marshalled data sample allocator. + */ + ACE_INLINE + DataAllocator* data_allocator () const { + return data_allocator_; + } + +private: + + /** + * Serialize the instance data. + * + * @param instance_data The data to serialize. + * @param for_write If 1 use the fast allocator; otherwise use the heap. + * @return returns the serialized data. + */ + ACE_Message_Block* dds_marshal( + const ::IOTest::Port& instance_data, + int for_write = 1); + + /** + * Find the instance handle for the given instance_data using + * the data type's key(s). If the instance does not already exist + * create a new instance handle for it. + */ + ::DDS::ReturnCode_t get_or_create_instance_handle( + DDS::InstanceHandle_t& handle, + const ::IOTest::Port& instance_data, + const ::DDS::Time_t & source_timestamp); + + /** + * Get the InstanceHanle for the given data. + */ + ::DDS::InstanceHandle_t get_instance_handle( + ::IOTest::Port instance_data); + + InstanceMap instance_map_; + size_t marshaled_size_; + // The lock pool will be thread safe because + // only one write call is allowed at a time. + DataBlockLockPool* db_lock_pool_; + DataAllocator* data_allocator_; + ::OpenDDS::DCPS::MessageBlockAllocator* mb_allocator_; + ::OpenDDS::DCPS::DataBlockAllocator* db_allocator_; +}; +}; // IOTest + + +namespace IOTest { + +/** Servant for DataReader interface of Port data type. + * + * See the DDS specification, OMG formal/04-12-02, for a description of + * this interface. + * + */ +class PortDataReaderImpl + : public virtual OpenDDS::DCPS::LocalObject<PortDataReader>, + public virtual OpenDDS::DCPS::DataReaderImpl +{ +public: + + typedef std::map<IOTest::Port, DDS::InstanceHandle_t, + PortKeyLessThan> InstanceMap; + typedef ::OpenDDS::DCPS::Cached_Allocator_With_Overflow<IOTest::Port, ACE_Null_Mutex> DataAllocator; + + //Constructor + PortDataReaderImpl (void); + + //Destructor + virtual ~PortDataReaderImpl (void); + + virtual + DDS::ReturnCode_t delete_contained_entities ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + /** + * Initialize the DataReader object. + * Called as part of create_datareader. + */ + virtual + void init ( + OpenDDS::DCPS::TopicImpl* a_topic, + const ::DDS::DataReaderQos & qos, + ::DDS::DataReaderListener_ptr a_listener, + OpenDDS::DCPS::DomainParticipantImpl* participant, + OpenDDS::DCPS::SubscriberImpl* subscriber, + ::DDS::Subscriber_ptr subscriber_objref, + ::DDS::DataReader_ptr dr_objerf, + OpenDDS::DCPS::DataReaderRemote_ptr dr_remote_objref + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + /** + * Do parts of enable specific to the datatype. + * Called by DataReaderImpl::enable(). + */ + virtual ::DDS::ReturnCode_t enable_specific ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t read ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t take ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t read_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t take_next_sample ( + ::IOTest::Port & received_data, + ::DDS::SampleInfo & sample_info + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t read_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t take_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t read_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t take_next_instance ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long max_samples, + ::DDS::InstanceHandle_t a_handle, + ::DDS::SampleStateMask sample_states, + ::DDS::ViewStateMask view_states, + ::DDS::InstanceStateMask instance_states + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t return_loan ( + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t get_key_value ( + ::IOTest::Port & key_holder, + ::DDS::InstanceHandle_t handle + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual + DDS::ReturnCode_t auto_return_loan(void* seq); + + void release_loan (::IOTest::PortSeq & received_data); + + void dec_ref_data_element(::OpenDDS::DCPS::ReceivedDataElement* r); + + protected: + + virtual void dds_demarshal(const OpenDDS::DCPS::ReceivedDataSample& sample) ; + + virtual void dispose(const OpenDDS::DCPS::ReceivedDataSample& sample) ; + + //virtual OpenDDS::DCPS::DataReaderRemote_ptr get_datareaderremote_obj_ref (); + + virtual void release_instance_i (::DDS::InstanceHandle_t handle); + + + private: + ::DDS::ReturnCode_t store_instance_data( + ::IOTest::Port *instance_data, + const OpenDDS::DCPS::DataSampleHeader& header + ) ; + + /// common input read* & take* input processing and precondition checks + ::DDS::ReturnCode_t check_inputs ( + const char* method_name, + ::IOTest::PortSeq & received_data, + ::DDS::SampleInfoSeq & info_seq, + ::CORBA::Long& max_samples + ) ; + + InstanceMap instance_map_; + DataAllocator* data_allocator_; +}; + +}; // IOTest + + +#endif /* PORTTYPESUPPORTI_H_ */ + + diff --git a/dds_io_sub/PortTypeSupportS.cpp b/dds_io_sub/PortTypeSupportS.cpp new file mode 100644 index 0000000..239b5bb --- /dev/null +++ b/dds_io_sub/PortTypeSupportS.cpp @@ -0,0 +1,73 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + +// TAO_IDL - Generated from +// be/be_codegen.cpp:703 + +#ifndef _TAO_IDL_PORTTYPESUPPORTS_CPP_ +#define _TAO_IDL_PORTTYPESUPPORTS_CPP_ + + +#include "PortTypeSupportS.h" + +#if !defined (__ACE_INLINE__) +#include "PortTypeSupportS.inl" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:72 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:72 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#endif /* ifndef */ + diff --git a/dds_io_sub/PortTypeSupportS.h b/dds_io_sub/PortTypeSupportS.h new file mode 100644 index 0000000..5c70e37 --- /dev/null +++ b/dds_io_sub/PortTypeSupportS.h @@ -0,0 +1,64 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:487 + +#ifndef _TAO_IDL_PORTTYPESUPPORTS_H_ +#define _TAO_IDL_PORTTYPESUPPORTS_H_ + + +#include "PortTypeSupportC.h" +#include "IOTestS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +// TAO_IDL - Generated from +// be/be_visitor_module/module_sh.cpp:49 + +namespace POA_IOTest +{ + + +// TAO_IDL - Generated from +// be/be_visitor_module/module_sh.cpp:80 + +} // module IOTest + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1281 + + +#if defined (__ACE_INLINE__) +#include "PortTypeSupportS.inl" +#endif /* defined INLINE */ + +#endif /* ifndef */ + diff --git a/dds_io_sub/PortTypeSupportS.inl b/dds_io_sub/PortTypeSupportS.inl new file mode 100644 index 0000000..38aa325 --- /dev/null +++ b/dds_io_sub/PortTypeSupportS.inl @@ -0,0 +1,28 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + diff --git a/dds_io_sub/dds_io_sub.cpp b/dds_io_sub/dds_io_sub.cpp new file mode 100644 index 0000000..6cdaabd --- /dev/null +++ b/dds_io_sub/dds_io_sub.cpp @@ -0,0 +1,215 @@ +// -*- C++ -*- +// ============================================================================ +/** + * @file subscriber.cpp + * + * $Id: subscriber.cpp 899 2007-07-05 16:36:52Z mitza $ + * + * + */ +// ============================================================================ + + +#include "DataReaderListener.h" +#include "PortTypeSupportImpl.h" +#include <dds/DCPS/Service_Participant.h> +#include <dds/DCPS/Marked_Default_Qos.h> +#include <dds/DCPS/SubscriberImpl.h> +#include <dds/DCPS/transport/framework/TheTransportFactory.h> +#include <dds/DCPS/transport/simpleTCP/SimpleTcpConfiguration.h> +#ifdef ACE_AS_STATIC_LIBS +#include <dds/DCPS/transport/simpleTCP/SimpleTcp.h> +#include <dds/DCPS/transport/simpleUnreliableDgram/SimpleUnreliableDgram.h> +#include <dds/DCPS/transport/ReliableMulticast/ReliableMulticast.h> +#endif + +#include <ace/streams.h> +#include "ace/Get_Opt.h" + +using namespace IOTest; + +OpenDDS::DCPS::TransportIdType transport_impl_id = 1; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "t:"); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 't': + if (ACE_OS::strcmp (get_opts.opt_arg (), "udp") == 0) { + transport_impl_id = 2; + } + else if (ACE_OS::strcmp (get_opts.opt_arg (), "mcast") == 0) { + transport_impl_id = 3; + } + else if (ACE_OS::strcmp (get_opts.opt_arg (), "reliable_mcast") == 0) { + transport_impl_id = 4; + } + // test with DEFAULT_SIMPLE_TCP_ID. + else if (ACE_OS::strcmp (get_opts.opt_arg (), "default_tcp") == 0) { + transport_impl_id = OpenDDS::DCPS::DEFAULT_SIMPLE_TCP_ID; + } + // test with DEFAULT_SIMPLE_UDP_ID. + else if (ACE_OS::strcmp (get_opts.opt_arg (), "default_udp") == 0) { + transport_impl_id = OpenDDS::DCPS::DEFAULT_SIMPLE_UDP_ID; + } + else if (ACE_OS::strcmp (get_opts.opt_arg (), "default_mcast_sub") == 0) { + transport_impl_id = OpenDDS::DCPS::DEFAULT_SIMPLE_MCAST_SUB_ID; + } + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-t <tcp/udp/default> " + "\n", + argv [0]), + -1); + } + } + // Indicates sucessful parsing of the command line + return 0; +} + + +int main (int argc, char *argv[]) +{ + try + { + DDS::DomainParticipantFactory_var dpf; + DDS::DomainParticipant_var participant; + + dpf = TheParticipantFactoryWithArgs(argc, argv); + if (CORBA::is_nil (dpf.in ())){ + cerr << "get ParticipantFactory failed." << endl; + return 1; + } + + participant = dpf->create_participant(411, + PARTICIPANT_QOS_DEFAULT, + DDS::DomainParticipantListener::_nil()); + if (CORBA::is_nil (participant.in ())) { + cerr << "create_participant failed." << endl; + return 1 ; + } + + if (parse_args (argc, argv) == -1) { + return -1; + } + + PortTypeSupport_var port = new PortTypeSupportImpl(); + + if (DDS::RETCODE_OK != port->register_type(participant.in (), "")) { + cerr << "Failed to register the PortTypeTypeSupport." << endl; + exit(1); + } + + CORBA::String_var type_name = port->get_type_name (); + + DDS::TopicQos topic_qos; + participant->get_default_topic_qos(topic_qos); + DDS::Topic_var topic = participant->create_topic("IOTest", + type_name.in (), + topic_qos, + DDS::TopicListener::_nil()); + if (CORBA::is_nil (topic.in ())) { + cerr << "Failed to create_topic." << endl; + exit(1); + } + + // Initialize the transport + OpenDDS::DCPS::TransportImpl_rch transport_impl = + TheTransportFactory->create_transport_impl (transport_impl_id, + ::OpenDDS::DCPS::AUTO_CONFIG); + + // Create the subscriber and attach to the corresponding + // transport. + DDS::Subscriber_var sub = + participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT, + DDS::SubscriberListener::_nil()); + if (CORBA::is_nil (sub.in ())) { + cerr << "Failed to create_subscriber." << endl; + exit(1); + } + + // Attach the subscriber to the transport. + 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\n" << endl; + exit(1); + } + + OpenDDS::DCPS::AttachStatus status = sub_impl->attach_transport(transport_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; + exit(1); + } + + // activate the listener + DataReaderListenerImpl listener_servant; + DDS::DataReaderListener_var listener = ::OpenDDS::DCPS::servant_to_reference(&listener_servant); + + if (CORBA::is_nil (listener.in ())) { + cerr << "listener is nil." << endl; + exit(1); + } + + // Create the Datareaders + DDS::DataReaderQos dr_qos; + sub->get_default_datareader_qos (dr_qos); + DDS::DataReader_var dr = sub->create_datareader(topic.in (), + dr_qos, + listener.in ()); + if (CORBA::is_nil (dr.in ())) { + cerr << "create_datareader failed." << endl; + exit(1); + } + + + int expected = 10; + while ( listener_servant.num_reads() < expected) { + ACE_OS::sleep (1); + } + + if (!CORBA::is_nil (participant.in ())) { + participant->delete_contained_entities(); + } + if (!CORBA::is_nil (dpf.in ())) { + dpf->delete_participant(participant.in ()); + } + ACE_OS::sleep(2); + + TheTransportFactory->release(); + TheServiceParticipant->shutdown (); + + } + catch (CORBA::Exception& e) + { + cerr << "SUB: Exception caught in main ():" << endl << e << endl; + return 1; + } + + return 0; +} diff --git a/dds_io_sub/diasio.cpp b/dds_io_sub/diasio.cpp new file mode 100644 index 0000000..9209fcb --- /dev/null +++ b/dds_io_sub/diasio.cpp @@ -0,0 +1,122 @@ +/* + ============================================================================ + Name : diasio.cpp + Author : Manuel Traut + Version : + Copyright : Your copyright notice + Description : DAIS IO Class + ============================================================================ + */ + +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#include <sys/io.h> +#include <sys/ioctl.h> +#include <unistd.h> +#include <pthread.h> +#include <time.h> + +#include "diasio.h" + +unsigned int DIASIO::instance = 0; +bool DIASIO::stop_wd = false; +int DIASIO::m_Bereich1; +int DIASIO::m_Bereich2; +int DIASIO::m_Bereich3; + +static void* watchDogTriggern(void* arg) +{ + struct timespec req; + unsigned int out = 0; + + req.tv_sec = 0; + req.tv_nsec = 300000; + while(!DIASIO::stop_wd){ + outw( out, DIASIO::m_Bereich2 + 0x0c ); + nanosleep(&req, NULL); + } + return NULL; +} + + +DIASIO::DIASIO(){ + if(instance == 0){ + init(); + } + instance++; +} + +DIASIO::~DIASIO(){ + instance--; + if(instance == 0){ + stop_wd = true; + pthread_join(watchdog, NULL); + S_AdresseOut -= m_Bereich2; + } +} + +void DIASIO::set(TyuInt16 value){ + outw( value, S_AdresseOut ); +} + +TyuInt16 DIASIO::get(){ + return inw( S_AdresseOut ); +} + +void DIASIO::init(){ + S_AdresseOut += m_Bereich2; + + char a_buffer[17]; + + pthread_attr_t watchdog_attr; + + iopl( 3 ); + + sprintf( a_buffer, "/dev/diasio_card%i", 0 ); + m_Deviceio = open( a_buffer, O_RDWR ); + + if( -1 == m_Deviceio ) { + fprintf(stderr, "Kein Zugriff auf IO-Karte %s", a_buffer); + fflush(stderr); + exit(0); + } + + //PCI-Kartenadressen holen + m_Bereich1 = 0; + if( 0 != ioctl( m_Deviceio, D_TCDIASIOC_IOADRESSELESEN, &m_Bereich1 ) ) + { + fprintf(stderr, "couldn't get bereich1\n"); + fflush(stderr); + close( m_Deviceio ); + m_Deviceio = -1; + exit(0); + } + + m_Bereich2 = 1; + if( 0 != ioctl( m_Deviceio, D_TCDIASIOC_IOADRESSELESEN, &m_Bereich2 ) ) + { + fprintf(stderr, "couldn't get bereich2\n"); + fflush(stderr); + close( m_Deviceio ); + m_Deviceio = -1; + exit(0); + } + + m_Bereich3 = 2; + if( 0 != ioctl( m_Deviceio, D_TCDIASIOC_IOADRESSELESEN, &m_Bereich3 ) ) + { + fprintf(stderr, "couldn't get bereich3\n"); + fflush(stderr); + close( m_Deviceio ); + m_Deviceio = -1; + exit(0); + } + + fprintf(stderr, "1: 0x%x, 2: 0x%x, 3: 0x%x\n", m_Bereich1, m_Bereich2, m_Bereich3); + fflush(stderr); + + pthread_attr_init(&watchdog_attr); + if ( pthread_create(&watchdog, &watchdog_attr, watchDogTriggern, NULL) ) + perror("watchdog thread creation failed"); +} diff --git a/dds_io_sub/diasio.h b/dds_io_sub/diasio.h new file mode 100644 index 0000000..ae27b50 --- /dev/null +++ b/dds_io_sub/diasio.h @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// All rights reserved to Trumpf GmbH + Co., Germany +//------------------------------------------------------------------------------ + +#ifndef TCDIASUSER_H +#define TCDIASUSER_H + +// -- required headers --------------------------------------------------------- +#include <linux/ioctl.h> +#include "tctypdef.h" + +/* + * Ioctl definitions + */ + +/* Use 'j' as magic number */ +#define D_TCDIAS_IOC_MAGIC 'j' + +#define D_TCDIASIOC_IOADRESSELESEN _IOWR( D_TCDIAS_IOC_MAGIC, 0, TyuInt32 ) +#define D_TCDIASIOC_MEMLAENGE _IOR( D_TCDIAS_IOC_MAGIC, 1, TysInt32 ) +#define D_TCDIASIOC_MEMOFFSET _IOR( D_TCDIAS_IOC_MAGIC, 2, TyuInt32 ) +#define D_TCDIASIOC_AUTOSTART _IOWR( D_TCDIAS_IOC_MAGIC, 3, TyuInt32 ) +#define D_TCDIASIOC_INTERRUPTBETRIEB _IOWR( D_TCDIAS_IOC_MAGIC, 4, TyuInt32 ) +#define D_TCDIASIOC_BEENDEN _IO( D_TCDIAS_IOC_MAGIC, 5 ) +#define D_TCDIASIOC_BEENDENAUFHEBEN _IO( D_TCDIAS_IOC_MAGIC, 6 ) +#define D_TCDIAS_IOC_MAXNR 7 + +/* +static TyuInt32 S_AdresseLS7166 = 0; +static TyuInt32 S_AdresseLS7166Status = 1; +static TyuInt32 S_Adresse7Seg1 = 2; +static TyuInt32 S_Adresse7Seg2 = 3; +*/ +static TyuInt32 S_AdresseOut = 4; +/* +static TyuInt32 S_AdresseIn = 5; +static TyuInt32 S_AdresseWatchdog = 0x0c; +static TyuInt32 S_AdresseStatus = 6; +static TyuInt32 S_AdresseADStart = 7; +static TyuInt32 S_AdresseMultiplexer = 8; +static TyuInt32 S_AdresseFreigabe = 9; +static TyuInt32 S_AdresseRevisionLogik = 0x0e; +static TyuInt32 S_AdresseRevisionKarte = 0x0f; +*/ +//zweiter Adressblock +/* +static TyuInt32 S_AdresseFrequenzzaehlerLW = 0; +static TyuInt32 S_AdresseFrequenzzaehlerHW = 2; +static TyuInt32 S_AdresseIndexRevisionZaehler = 4; +static TyuInt32 S_AdresseAD = 6; +static TyuInt32 S_AdresseDA0 = 8; +static TyuInt32 S_AdresseDA1 = 0x0a; +static TyuInt32 S_AdresseDA2 = 0x0c; +static TyuInt32 S_AdresseDA3 = 0x0e; +*/ +// -- exported global variables - declarations (should be empty)---------------- + +class DIASIO{ + +public: + DIASIO(); + ~DIASIO(); + void set(TyuInt16 value); + TyuInt16 get(); + static int m_Bereich1; + static int m_Bereich2; + static int m_Bereich3; + static bool stop_wd; + +private: + int m_Deviceio; + static unsigned int instance; + pthread_t watchdog; + + void init(); +}; + +#endif diff --git a/dds_io_sub/sub.ini b/dds_io_sub/sub.ini new file mode 100644 index 0000000..9dcfe13 --- /dev/null +++ b/dds_io_sub/sub.ini @@ -0,0 +1,93 @@ +# Note: +# 1) The configuration defaults to not configure via file. The configuration file name +# should be specified via command line option -DCPSConfigFile. +# 2) Use # or ; for comments +# 3) The command line option can overwrite the configuration value specified in this +# file. +# 4) Run application with -DCPSDebugLevel [>0] to help debugging dds configuration. + +# This "common" section configures the data in Service_Participant. +[common] +# DCPS specific debug level. +DCPSDebugLevel=0 +# DCPS repository ior file name. +DCPSInfoRepo=file:///home/manut/repo.ior +# Number of chunks that the DataWriter's cached allocator can allocate when the resource +# limits are infinite. +DCPSChunks=20 +# maximum number of expected associations for publishers and subscribers. This is used +# to pre allocate enough memory and reduce heap allocations. +DCPSChunkAssociationMutltiplier=10 +# The propagation delay factor. +DCPSLivelinessFactor=80 +# The port number for the builtin topic. +#DCPSBitTransportPort= +# The timeout for lookup data from the builtin topic datareader (in milliseconds). +#DCPSBitLookupDurationMsec= + + +# Configuration for a specific TransportImpl object. The section name has the "transport_impl_" +# as prefix and appeneds with the transport id which is an integer. +[transport_impl_1] +# This transport_type should match the "type" argument in the svc.conf or be the +# SimpleTcp which is part of the DDSdcps lib. +transport_type=SimpleTcp +# The local endpoint. +local_address=localhost:2222 +#transport configuration +swap_bytes= +# Number of pre-created link (list) objects per pool for the +# "send queue" of each DataLink. Each link references a sample +# or framework control message. +queue_messages_per_pool= +# Initial number of pre-allocated pools of link (list) objects +# for the "send queue" of each DataLink. +queue_initial_pools= +#Max size (in bytes) of a packet (packet header + sample(s)) +max_packet_size= +# Max number of samples that should ever be in a single packet. +max_samples_per_packet= +# Optimum size (in bytes) of a packet (packet header + sample(s)). +optimum_packet_size= +# This is just for SimpleTcp transport. +enable_nagle_algorithm= + +###=== Configurations for connector side during reconnecting=== + +# The initial retry delay in milliseconds. +# The first connection retry will be when the loss of connection +# is detected. The second try will be after this delay. +# The default is 500 miliseconds. +conn_retry_initial_delay= + +# The backoff multiplier for reconnection strategy. +# The third and so on reconnect will be this value * the previous delay. +# Hence with conn_retry_initial_delay=500 and conn_retry_backoff_multiplier=1.5 +# the second reconnect attempt will be at 0.5 seconds after first retry connect +# fails; the third attempt will be 0.75 seconds after the second retry connect +# fails; the fourth attempt will be 1.125 seconds after the third retry connect +# fails. +# The default value is 2.0. +conn_retry_backoff_multiplier= + +# Number of attemps to reconnect before giving up and calling +# on_publication_lost() and on_subscription_lost() callbacks. +# The default is 3. +conn_retry_attempts= + +# Maximum period (in milliseconds) of not being able to send queued +# messages. If there are samples queued and no output for longer +# than this period then the connection will be closed and on_*_lost() +# callbacks will be called. If the value is zero, the default, then +# this check will not be made. +max_output_pause_period= + +###=== Configurations for acceptor side during reconnecting=== + +# The time period in milliseconds for the acceptor side +# of a connection to wait for the connection to be reconnected. +# If not reconnected within this period then +# on_publication_lost() and on_subscription_lost() callbacks +# will be called. +# The default is 2 seconds (2000 millseconds). +passive_reconnect_duration=
\ No newline at end of file diff --git a/dds_io_sub/sub_start.sh b/dds_io_sub/sub_start.sh new file mode 100644 index 0000000..1f4bc35 --- /dev/null +++ b/dds_io_sub/sub_start.sh @@ -0,0 +1 @@ +./dds_io_sub -ORBSvcConf tcp.conf -DCPSInfoRepo corbaloc:iiop:192.168.0.98:4456/DCPSInfoRepo -DCPSConfigFile sub.ini diff --git a/dds_io_sub/tcp.conf b/dds_io_sub/tcp.conf new file mode 100644 index 0000000..7084cc8 --- /dev/null +++ b/dds_io_sub/tcp.conf @@ -0,0 +1 @@ +dynamic DCPS_SimpleTcpLoader Service_Object * SimpleTcp:_make_DCPS_SimpleTcpLoader() "-type SimpleTcp" diff --git a/dds_io_sub/tctypdef.h b/dds_io_sub/tctypdef.h new file mode 100644 index 0000000..614771d --- /dev/null +++ b/dds_io_sub/tctypdef.h @@ -0,0 +1,75 @@ +// \HEADER\-------------------------------------------------------------------- +// +// $Archive: //pvcs_tw/data/archives/SensorSystems/Linuxprojekte/DIAS-Linux/rtsystem/src/rtsystem/lrt/treiber/dias4io/tctypdef.h-arc $ +// +// $Revision: 1.0 $ +// +// $Date: Mar 05 2007 12:07:38 $ +// +// $Author: kraussjo $ +// +// CONTENTS : +// +// DESCRIPTION : +// +// RESTRICTIONS : +// +// REQUIRES : +// +//------------------------------------------------------------------------------ +// All rights reserved to Trumpf GmbH + Co., Germany +//------------------------------------------------------------------------------ + +#ifndef tctypdef_H +#define tctypdef_H + + +// -- required headers --------------------------------------------------------- + +// -- forward declarations ----------------------------------------------------- + +// -- exported constants, types, classes --------------------------------------- + +// -- exported functions - declarations ---------------------------------------- + +/** +* Description of +* +* Design Pattern: +* +* @author krauss +* @version $Revision: 1.0 $ +*/ +#if defined DIASLINUX || WIN32 +typedef char TysChar; +typedef unsigned char TyuChar; +typedef signed short TysInt16; +typedef unsigned short TyuInt16; +typedef signed int TysInt32; +typedef unsigned int TyuInt32; +typedef signed long TysInt64; +typedef unsigned long TyuInt64; +typedef float TyReal32; +typedef double TyReal64; +#else +typedef char TysChar; +typedef unsigned char TyuChar; +typedef signed int TysInt16; +typedef unsigned int TyuInt16; +typedef signed long TysInt32; +typedef unsigned long TyuInt32; +typedef float TyReal32; +typedef double TyReal64; +/* +#define TysChar char +#define TyuChar unsigned char +#define TysInt16 int +#define TyuInt16 unsigned int +#define TysInt32 long +#define TyuInt32 unsigned long +#define TyReal32 float +#define TyReal64 double*/ +#endif +// -- exported global variables - declarations (should be empty)---------------- + +#endif |
