From dfb251098bb903406393086cd49c6c08f1adfed7 Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Tue, 6 Feb 2024 13:48:14 -0600 Subject: [PATCH] Use DdsDynamicData.idl in Java but hide most of it --- MPC/modules/IDLBase.pm | 6 +- dds/DdsDynamicData.idl | 15 ++-- dds/idl/ts_generator.cpp | 13 +--- java/dds/.gitignore | 114 ++++++++++++++++--------------- java/dds/dcps_java.mpc | 4 ++ java/idl2jni/codegen/be_init.cpp | 1 + 6 files changed, 79 insertions(+), 74 deletions(-) diff --git a/MPC/modules/IDLBase.pm b/MPC/modules/IDLBase.pm index 6fc35994de7..00b93eae56a 100644 --- a/MPC/modules/IDLBase.pm +++ b/MPC/modules/IDLBase.pm @@ -115,7 +115,11 @@ sub do_cached_parse { $self->{'default_nested'} = 1; ## Set up the macros and include paths supplied in the command flags - my %macros = ('__OPENDDS_IDL' => 1, '__OPENDDS_MPC' => 1); + my %macros = ( + __OPENDDS_IDL => 1, + __OPENDDS_MPC => 1, + OPENDDS_HIDE_DYNMIC_DATA => 1, + ); my %mparams; my @include; if (defined $flags) { diff --git a/dds/DdsDynamicData.idl b/dds/DdsDynamicData.idl index 2bfe82f28a3..f4035b93289 100644 --- a/dds/DdsDynamicData.idl +++ b/dds/DdsDynamicData.idl @@ -1,6 +1,4 @@ /* - * - * * Distributed under the OpenDDS License. * See: http://www.opendds.org/license.html */ @@ -9,13 +7,15 @@ #define OPENDDS_DDS_DYNAMIC_DATA_IDL #ifndef OPENDDS_SAFETY_PROFILE - -#include -#include -#include +# ifndef OPENDDS_HIDE_DYNMIC_DATA +# include +# include +# include +# endif // OPENDDS_HIDE_DYNMIC_DATA module DDS { local interface DynamicType; +# ifndef OPENDDS_HIDE_DYNMIC_DATA valuetype TypeDescriptor; typedef sequence IncludePathSeq; @@ -158,9 +158,11 @@ module DDS { void clear(); }; +# endif // OPENDDS_HIDE_DYNMIC_DATA local interface DynamicData; +# ifndef OPENDDS_HIDE_DYNMIC_DATA local interface DynamicDataFactoryInterf { // Implemented in C++ // static DynamicDataFactory get_instance(); @@ -401,6 +403,7 @@ module DDS { in MemberId id, in WstringSeq value); }; // local interface DynamicData +# endif // OPENDDS_HIDE_DYNMIC_DATA }; #endif // OPENDDS_SAFETY_PROFILE diff --git a/dds/idl/ts_generator.cpp b/dds/idl/ts_generator.cpp index 23387cf074f..48ccafc8151 100644 --- a/dds/idl/ts_generator.cpp +++ b/dds/idl/ts_generator.cpp @@ -161,7 +161,8 @@ bool ts_generator::generate_ts(AST_Type* node, UTL_ScopedName* name) "dds/DdsDcpsTopic.idl", "dds/DdsDcpsPublication.idl", "dds/DdsDcpsSubscriptionExt.idl", - "dds/DdsDcpsTypeSupportExt.idl" + "dds/DdsDcpsTypeSupportExt.idl", + "dds/DdsDynamicData.idl" }; add_includes(idl_includes, BE_GlobalData::STREAM_IDL); @@ -187,16 +188,6 @@ bool ts_generator::generate_ts(AST_Type* node, UTL_ScopedName* name) }; add_includes(cpp_includes, BE_GlobalData::STREAM_CPP); - // This is for Java because we can't include DynamicData.idl. In addition, MPC - // will make invalid rules in a Java build based on this forward declaration. - be_global->idl_ << - "#if !defined OPENDDS_SAFETY_PROFILE && !defined __OPENDDS_MPC\n" - "module DDS {\n" - " local interface DynamicData;\n" - "};\n" - "#endif\n" - "\n"; - std::map replacements; replacements["SCOPED"] = scoped(name, EscapeContext_ForGenIdl); // SCOPED_NOT_GLOBAL is EscapeContext_FromGenIdl, because diff --git a/java/dds/.gitignore b/java/dds/.gitignore index a8b75c343dc..7aaad3f6baa 100644 --- a/java/dds/.gitignore +++ b/java/dds/.gitignore @@ -3,14 +3,51 @@ /*.vcproj /BitsExtJC.cpp /BitsJC.cpp +/classes +/DDS__ConditionTAOPeer.h +/DDS__ContentFilteredTopicTAOPeer.h +/DDS__DataReaderListenerTAOPeer.h +/DDS__DataReaderTAOPeer.h +/DDS__DataWriterListenerTAOPeer.h +/DDS__DataWriterTAOPeer.h +/DDS__DomainParticipantFactoryTAOPeer.h +/DDS__DomainParticipantListenerTAOPeer.h +/DDS__DomainParticipantTAOPeer.h +/DDS__EntityTAOPeer.h +/DDS__GuardConditionInterfTAOPeer.h +/DDS__MultiTopicTAOPeer.h +/DDS__ParticipantBuiltinTopicDataDataReaderTAOPeer.h +/DDS__ParticipantBuiltinTopicDataDataWriterTAOPeer.h +/DDS__ParticipantBuiltinTopicDataTypeSupportTAOPeer.h +/DDS__PublicationBuiltinTopicDataDataReaderTAOPeer.h +/DDS__PublicationBuiltinTopicDataDataWriterTAOPeer.h +/DDS__PublicationBuiltinTopicDataTypeSupportTAOPeer.h +/DDS__PublisherListenerTAOPeer.h +/DDS__PublisherTAOPeer.h +/DDS__QueryConditionTAOPeer.h +/DDS__ReadConditionTAOPeer.h +/DDS__StatusConditionTAOPeer.h +/DDS__SubscriberListenerTAOPeer.h +/DDS__SubscriberTAOPeer.h +/DDS__SubscriptionBuiltinTopicDataDataReaderTAOPeer.h +/DDS__SubscriptionBuiltinTopicDataDataWriterTAOPeer.h +/DDS__SubscriptionBuiltinTopicDataTypeSupportTAOPeer.h +/DDS__TopicBuiltinTopicDataDataReaderTAOPeer.h +/DDS__TopicBuiltinTopicDataDataWriterTAOPeer.h +/DDS__TopicBuiltinTopicDataTypeSupportTAOPeer.h +/DDS__TopicDescriptionTAOPeer.h +/DDS__TopicListenerTAOPeer.h +/DDS__TopicTAOPeer.h +/DDS__TypeSupportTAOPeer.h +/DDS__WaitSetInterfTAOPeer.h /DDS_ConditionHelper.h /DDS_ContentFilteredTopicHelper.h /DDS_DATAREADER_QOS_DEFAULT.h /DDS_DATAREADER_QOS_USE_TOPIC_QOS.h -/DDS_DATAWRITER_QOS_DEFAULT.h -/DDS_DATAWRITER_QOS_USE_TOPIC_QOS.h /DDS_DataReaderHelper.h /DDS_DataReaderListenerHelper.h +/DDS_DATAWRITER_QOS_DEFAULT.h +/DDS_DATAWRITER_QOS_USE_TOPIC_QOS.h /DDS_DataWriterHelper.h /DDS_DataWriterListenerHelper.h /DDS_DomainParticipantFactoryHelper.h @@ -22,7 +59,6 @@ /DDS_ListenerHelper.h /DDS_MultiTopicHelper.h /DDS_PARTICIPANT_QOS_DEFAULT.h -/DDS_PUBLISHER_QOS_DEFAULT.h /DDS_ParticipantBuiltinTopicDataDataReaderHelper.h /DDS_ParticipantBuiltinTopicDataDataWriterHelper.h /DDS_ParticipantBuiltinTopicDataTypeSupportHelper.h @@ -31,12 +67,13 @@ /DDS_PublicationBuiltinTopicDataDataWriterHelper.h /DDS_PublicationBuiltinTopicDataTypeSupportHelper.h /DDS_PublicationBuiltinTopicDataTypeSupportImpl.h +/DDS_PUBLISHER_QOS_DEFAULT.h /DDS_PublisherHelper.h /DDS_PublisherListenerHelper.h /DDS_QueryConditionHelper.h /DDS_ReadConditionHelper.h -/DDS_SUBSCRIBER_QOS_DEFAULT.h /DDS_StatusConditionHelper.h +/DDS_SUBSCRIBER_QOS_DEFAULT.h /DDS_SubscriberHelper.h /DDS_SubscriberListenerHelper.h /DDS_SubscriptionBuiltinTopicDataDataReaderHelper.h @@ -54,42 +91,6 @@ /DDS_TypeSupportHelper.h /DDS_WaitSet.h /DDS_WaitSetInterfHelper.h -/DDS__ConditionTAOPeer.h -/DDS__ContentFilteredTopicTAOPeer.h -/DDS__DataReaderListenerTAOPeer.h -/DDS__DataReaderTAOPeer.h -/DDS__DataWriterListenerTAOPeer.h -/DDS__DataWriterTAOPeer.h -/DDS__DomainParticipantFactoryTAOPeer.h -/DDS__DomainParticipantListenerTAOPeer.h -/DDS__DomainParticipantTAOPeer.h -/DDS__EntityTAOPeer.h -/DDS__GuardConditionInterfTAOPeer.h -/DDS__MultiTopicTAOPeer.h -/DDS__ParticipantBuiltinTopicDataDataReaderTAOPeer.h -/DDS__ParticipantBuiltinTopicDataDataWriterTAOPeer.h -/DDS__ParticipantBuiltinTopicDataTypeSupportTAOPeer.h -/DDS__PublicationBuiltinTopicDataDataReaderTAOPeer.h -/DDS__PublicationBuiltinTopicDataDataWriterTAOPeer.h -/DDS__PublicationBuiltinTopicDataTypeSupportTAOPeer.h -/DDS__PublisherListenerTAOPeer.h -/DDS__PublisherTAOPeer.h -/DDS__QueryConditionTAOPeer.h -/DDS__ReadConditionTAOPeer.h -/DDS__StatusConditionTAOPeer.h -/DDS__SubscriberListenerTAOPeer.h -/DDS__SubscriberTAOPeer.h -/DDS__SubscriptionBuiltinTopicDataDataReaderTAOPeer.h -/DDS__SubscriptionBuiltinTopicDataDataWriterTAOPeer.h -/DDS__SubscriptionBuiltinTopicDataTypeSupportTAOPeer.h -/DDS__TopicBuiltinTopicDataDataReaderTAOPeer.h -/DDS__TopicBuiltinTopicDataDataWriterTAOPeer.h -/DDS__TopicBuiltinTopicDataTypeSupportTAOPeer.h -/DDS__TopicDescriptionTAOPeer.h -/DDS__TopicListenerTAOPeer.h -/DDS__TopicTAOPeer.h -/DDS__TypeSupportTAOPeer.h -/DDS__WaitSetInterfTAOPeer.h /DdsDcpsConditionSeqJC.cpp /DdsDcpsConditionSeqJC.h /DdsDcpsCoreJC.cpp @@ -118,6 +119,22 @@ /DdsDcpsTopicJC.h /DdsDcpsTypeSupportExtJC.cpp /DdsDcpsTypeSupportExtJC.h +/DdsDynamicDataJC.cpp +/DdsDynamicDataJC.h +/OpenDDS_DCPS__ConfigStoreTAOPeer.h +/OpenDDS_DCPS__ConnectionRecordDataReaderTAOPeer.h +/OpenDDS_DCPS__ConnectionRecordDataWriterTAOPeer.h +/OpenDDS_DCPS__ConnectionRecordTypeSupportTAOPeer.h +/OpenDDS_DCPS__DataReaderExTAOPeer.h +/OpenDDS_DCPS__DataReaderListenerTAOPeer.h +/OpenDDS_DCPS__DataWriterListenerTAOPeer.h +/OpenDDS_DCPS__InternalThreadBuiltinTopicDataDataReaderTAOPeer.h +/OpenDDS_DCPS__InternalThreadBuiltinTopicDataDataWriterTAOPeer.h +/OpenDDS_DCPS__InternalThreadBuiltinTopicDataTypeSupportTAOPeer.h +/OpenDDS_DCPS__ParticipantLocationBuiltinTopicDataDataReaderTAOPeer.h +/OpenDDS_DCPS__ParticipantLocationBuiltinTopicDataDataWriterTAOPeer.h +/OpenDDS_DCPS__ParticipantLocationBuiltinTopicDataTypeSupportTAOPeer.h +/OpenDDS_DCPS__TypeSupportTAOPeer.h /OpenDDS_DCPS_CdrRepresentationFormatHelper.h /OpenDDS_DCPS_ConfigStoreHelper.h /OpenDDS_DCPS_ConnectionRecordDataReaderHelper.h @@ -140,21 +157,6 @@ /OpenDDS_DCPS_RepresentationFormatHelper.h /OpenDDS_DCPS_TheParticipantFactory.h /OpenDDS_DCPS_TheServiceParticipant.h -/OpenDDS_DCPS_TypeSupportHelper.h -/OpenDDS_DCPS__ConfigStoreTAOPeer.h -/OpenDDS_DCPS__ConnectionRecordDataReaderTAOPeer.h -/OpenDDS_DCPS__ConnectionRecordDataWriterTAOPeer.h -/OpenDDS_DCPS__ConnectionRecordTypeSupportTAOPeer.h -/OpenDDS_DCPS__DataReaderExTAOPeer.h -/OpenDDS_DCPS__DataReaderListenerTAOPeer.h -/OpenDDS_DCPS__DataWriterListenerTAOPeer.h -/OpenDDS_DCPS__InternalThreadBuiltinTopicDataDataReaderTAOPeer.h -/OpenDDS_DCPS__InternalThreadBuiltinTopicDataDataWriterTAOPeer.h -/OpenDDS_DCPS__InternalThreadBuiltinTopicDataTypeSupportTAOPeer.h -/OpenDDS_DCPS__ParticipantLocationBuiltinTopicDataDataReaderTAOPeer.h -/OpenDDS_DCPS__ParticipantLocationBuiltinTopicDataDataWriterTAOPeer.h -/OpenDDS_DCPS__ParticipantLocationBuiltinTopicDataTypeSupportTAOPeer.h -/OpenDDS_DCPS__TypeSupportTAOPeer.h /OpenDDS_DCPS_transport_MulticastInst.h /OpenDDS_DCPS_transport_RtpsUdpInst.h /OpenDDS_DCPS_transport_TcpInst.h @@ -162,8 +164,8 @@ /OpenDDS_DCPS_transport_TransportConfig.h /OpenDDS_DCPS_transport_TransportInst.h /OpenDDS_DCPS_transport_UdpInst.h +/OpenDDS_DCPS_TypeSupportHelper.h /OpenddsDcpsExtJC.cpp /OpenddsDcpsExtJC.h /OpenddsDcpsExtTypeSupportJC.cpp /OpenddsDcpsExtTypeSupportJC.h -/classes diff --git a/java/dds/dcps_java.mpc b/java/dds/dcps_java.mpc index 8bed02fdf28..1f0acd3570c 100644 --- a/java/dds/dcps_java.mpc +++ b/java/dds/dcps_java.mpc @@ -53,6 +53,10 @@ project: idl2jni, javah, dcpslib, optional_jni_check, dcps_java_optional, dcps_m $(DDS_ROOT)/dds/DdsDcpsSubscriptionExt.idl << DdsDcpsSubscriptionJC.h } + Idl2Jni_Files { + $(DDS_ROOT)/dds/DdsDynamicData.idl + } + // The following .java files are not generated by idl2jni Java_Files { OpenDDS/DCPS/NetworkConfigModifier.java diff --git a/java/idl2jni/codegen/be_init.cpp b/java/idl2jni/codegen/be_init.cpp index 2bce953c818..194d6ad0b44 100644 --- a/java/idl2jni/codegen/be_init.cpp +++ b/java/idl2jni/codegen/be_init.cpp @@ -39,6 +39,7 @@ BE_post_init(char *[], long) idl_global->unknown_annotations_ = IDL_GlobalData::UNKNOWN_ANNOTATIONS_IGNORE; DRV_cpp_putarg("-D__OPENDDS_IDL_HAS_ANNOTATIONS"); + DRV_cpp_putarg("-DOPENDDS_HIDE_DYNMIC_DATA"); idl_global->eval( "module OpenDDS {module internal {@annotation hidden_op_in_java {string impl;};};};\n");