Skip to content

Commit

Permalink
Merge pull request #443 from jwillemsen/jwi-nddsconstructor
Browse files Browse the repository at this point in the history
Removed special dds_init/dds_finalize calls, use `-constructor` argument for rtiddsgen
  • Loading branch information
jwillemsen authored Sep 5, 2024
2 parents 43b49a2 + e398893 commit f9fa8df
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 128 deletions.
32 changes: 7 additions & 25 deletions ddsx11/dds/dds_conversion_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@ namespace DDSX11
{ __from_dds (to, from, std::is_enum<DATA_TYPE>()); return to; }
//@}

/**
* Default DDS_DATA_TYPE life cycle methods.
*/
//@{
template <typename DDS_DATA_TYPE>
void dds_init (DDS_DATA_TYPE&)
{ }
template <typename DDS_DATA_TYPE>
void dds_finalize (DDS_DATA_TYPE&)
{ }
//@}

/**
* Converting DDS argument traits
*/
Expand All @@ -91,9 +79,9 @@ namespace DDSX11
typedef DDS_DATA_TYPE dds_in_type;
dds_in_type value_;

in () { ::DDSX11::dds_init (value_); }
in (const in_type& v) { ::DDSX11::dds_init (value_); ::DDSX11::to_dds (this->value_, v); }
~in () { ::DDSX11::dds_finalize (value_); }
in () = default;
in (const in_type& v) { ::DDSX11::to_dds (this->value_, v); }
~in () = default;
in& operator =(const in_type& v) { ::DDSX11::to_dds (this->value_, v); return *this; }
operator const dds_in_type& () const { return this->value_; }
};
Expand Down Expand Up @@ -140,11 +128,8 @@ namespace DDSX11
out_type& value_;
dds_out_type dds_value_;

out (out_type& v) : value_ (v) { ::DDSX11::dds_init (this->dds_value_); }
~out () {
::DDSX11::from_dds (this->value_, this->dds_value_);
::DDSX11::dds_finalize (this->dds_value_);
}
out (out_type& v) : value_ (v) {}
~out () { ::DDSX11::from_dds (this->value_, this->dds_value_); }
operator dds_out_type& () { return this->dds_value_; }
};

Expand All @@ -165,11 +150,8 @@ namespace DDSX11
out_type* value_;
dds_out_type dds_value_;

out (out_type* v) : value_ (v) { ::DDSX11::dds_init (this->dds_value_); }
~out () {
::DDSX11::from_dds (*this->value_, this->dds_value_);
::DDSX11::dds_finalize (this->dds_value_);
}
out (out_type* v) : value_ (v) {}
~out () { ::DDSX11::from_dds (*this->value_, this->dds_value_); }
operator dds_out_type* () { return &this->dds_value_; }
};

Expand Down
3 changes: 0 additions & 3 deletions ddsx11/docs/src/ridlc.asc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,4 @@ Generate all DDSX11 related files
|-Gddsx11,traits | |
Generate user defined conversion traits for DDSX11

|-Sddsx11,nddslfc | |
Do not generate life cycle traits for DDSX11 NDDS support(generated by default). *DDSX11 core use only.*

|=======================================================================
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// --------------------------------------------------------------------

feature(ddsx11, ndds) : ndds_ts_defaults {
ndds_ts_flags += -update typefiles -enableEscapeChar -typeSequenceSuffix RTISeq -language C++98 -namespace
ndds_ts_flags += -update typefiles -enableEscapeChar -typeSequenceSuffix RTISeq -language C++98 -namespace -constructor
Define_Custom(TypeSupport) {
}
Define_Custom(DummyTypeSupport) {
Expand Down
4 changes: 0 additions & 4 deletions ddsx11/vendors/ndds/dds/ndds_base_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@ namespace DDSX11
inline std::string& from_dds<char*, std::string> (std::string& to, char* const & from)
{ if (from) to = from; else to.clear (); return to; }

template <>
inline void dds_init (char*& sample)
{ sample = nullptr; }

template <>
struct traits<std::string>
: public common_traits<std::string, char*>,
Expand Down
3 changes: 1 addition & 2 deletions ddsx11/vendors/ndds/idl/ddsx11_ndds_stub.mpc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ project (ddsx11_ndds_dcps_all_idl_gen) : install, \
ddsx11_ndds_conversion_traits {
after += ddsx11_ndds_types_idl_gen
custom_only = 1
idlflags += -Sddsx11,nddslfc \
-Wb,stub_export_macro=DDSX11_NDDS_STUB_Export \
idlflags += -Wb,stub_export_macro=DDSX11_NDDS_STUB_Export \
-Wb,stub_export_include=ddsx11_ndds_stub_export.h -Scph

IDL_Files {
Expand Down
24 changes: 0 additions & 24 deletions ddsx11/vendors/ndds/ridlbe/ccmx11/facets/dds4ndds/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,6 @@ module NDDS
fctcfg.depends_on :dds
fctcfg.setup_after :dds

# setup facet option handling
#
fctcfg.on_setup do |optlist, ridl_params|
# extend DDS facet options
optlist.for_switch '-S{suppression options}', type: String, separator: true do |swcfg|
swcfg.for_group :ddsx11_group do |grpcfg|
grpcfg.on_prepare do |arg, params|
if /^ddsx11\,(.*)/ =~ arg
return [$1]
end

nil
end
grpcfg.modify_params :strings,
params: {
'nddslfc' => {
option_name: :nogen_life_cycle_traits_for_ndds,
description: "-Sddsx11,nddslfc\t\tSuppress generation of life cycle traits for DDSX11 NDDS support (generated by default)"
}
}
end
end
end

# process input / generate code
# arguments:
# in parser - parser object with full AST from parsed source
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,6 @@ module CCMX11
module DDSX11
module NDDS
module UserDefinedTypeTraitsWriterExt
module WriterExtension
def self.included(base)
base.class_eval do
# add life cycle traits generation helper method

helper_method :generate_lifecycle_traits?

def generate_lifecycle_traits?
params[:nogen_life_cycle_traits_for_ndds] ? false : true
end
end
end
end

def self.configure_extension(writer)
IDL.log(3, 'Configuring DDS4NDDS UserDefinedTypeTraitsWriterExt extension')
# make writer look for templates in ndds folder first
Expand Down
2 changes: 1 addition & 1 deletion ddsx11/vendors/opendds/dds/base_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace DDSX11

in () {}
in (const in_type& v) { ::DDSX11::to_dds (this->value_, v); }
~in () { ::DDSX11::dds_finalize (value_); }
~in () {}
in& operator =(const in_type& v) { ::DDSX11::to_dds (this->value_, v); return *this; }
operator dds_in_type () const { return this->value_; }
};
Expand Down
2 changes: 0 additions & 2 deletions ridlbe/ccmx11/facets/dds/templates/udt_traits/array.erb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ namespace DDSX11
return to;
}

%visit_life_cycle_traits

template<>
struct traits<<%= scoped_cxxtype %>>
: public common_traits<<%= scoped_cxxtype %>, <%= dds_native_element_cxxtype %>>,
Expand Down
2 changes: 0 additions & 2 deletions ridlbe/ccmx11/facets/dds/templates/udt_traits/struct.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ namespace DDSX11
return to;
}

%visit_life_cycle_traits

/**
* DDSX11 traits for <%= scoped_cxxname %>
*/
Expand Down
2 changes: 0 additions & 2 deletions ridlbe/ccmx11/facets/dds/templates/udt_traits/union.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ namespace DDSX11
%nest(2) { visit_template('union_from') }
}

%visit_life_cycle_traits

template<>
struct traits<<%= scoped_cxxtype %>>
: public common_traits<<%= scoped_cxxtype %>, <%= native_scoped_cxxtype %>>
Expand Down

0 comments on commit f9fa8df

Please sign in to comment.