Skip to content

Commit

Permalink
Merge pull request #307 from mcorino/mco-fix-sw306
Browse files Browse the repository at this point in the history
Fix issues reported in sw306
  • Loading branch information
mcorino authored Nov 2, 2021
2 parents 67cdb54 + 99326b2 commit 1ecaadd
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ module Example {
typedef sequence<boolean> B17;
typedef sequence<boolean, 15> B18;

typedef sequence<unsigned long long> B19_1;
typedef sequence<unsigned long long, 10> B19_2;
typedef unsigned long long ULL_T;

typedef sequence<ULL_T> B19_1;
typedef sequence<ULL_T, 10> B19_2;
typedef sequence<long long> B19_3;
typedef sequence<long long, 10> B19_4;

Expand Down
24 changes: 12 additions & 12 deletions ddsx11/vendors/ndds/dds/ndds_base_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@ namespace DDSX11
return to;
}

template <typename DDS_SEQ = typename std::conditional<sizeof(DDS_LongLong)==sizeof(int64_t), int64_t, void>::type>
inline DDS_LongLongSeq&
fixedsize_sequence_to_dds (DDS_LongLongSeq& to, const DDS_SEQ& from)
template <typename DDS_NATIVE_SEQ, typename DDS_SEQ>
inline DDS_NATIVE_SEQ&
int64_sequence_to_dds (DDS_NATIVE_SEQ& to, const DDS_SEQ& from)
{
if (!to.from_array(reinterpret_cast<const DDS_LongLong*> (from.data ()), ACE_Utils::truncate_cast<DDS_Native::DDS::sequence_size_type> (from.size ())))
{
Expand All @@ -380,9 +380,9 @@ namespace DDSX11
return to;
}

template <typename DDS_SEQ = typename std::conditional<sizeof(DDS_UnsignedLongLong)==sizeof(int64_t), int64_t, void>::type>
inline DDS_UnsignedLongLongSeq&
fixedsize_sequence_to_dds (DDS_UnsignedLongLongSeq& to, const DDS_SEQ& from)
template <typename DDS_NATIVE_SEQ, typename DDS_SEQ>
inline DDS_NATIVE_SEQ&
uint64_sequence_to_dds (DDS_NATIVE_SEQ& to, const DDS_SEQ& from)
{
if (!to.from_array(reinterpret_cast<const DDS_UnsignedLongLong*> (from.data ()), ACE_Utils::truncate_cast<DDS_Native::DDS::sequence_size_type> (from.size ())))
{
Expand Down Expand Up @@ -427,21 +427,21 @@ namespace DDSX11
return to;
}

template <typename DDS_SEQ = typename std::conditional<sizeof(DDS_LongLong)==sizeof(int64_t), int64_t, void>::type>
template <typename DDS_SEQ, typename DDS_NATIVE_SEQ>
inline DDS_SEQ&
fixedsize_sequence_from_dds (DDS_SEQ& to, const DDS_LongLongSeq& from)
int64_sequence_from_dds (DDS_SEQ& to, const DDS_NATIVE_SEQ& from)
{
to.resize (from.length ());
const_cast<DDS_LongLongSeq&> (from).to_array (reinterpret_cast<DDS_LongLong*> (to.data ()), ACE_Utils::truncate_cast<DDS_Native::DDS::sequence_size_type> (to.size ()));
const_cast<DDS_NATIVE_SEQ&> (from).to_array (reinterpret_cast<DDS_LongLong*> (to.data ()), ACE_Utils::truncate_cast<DDS_Native::DDS::sequence_size_type> (to.size ()));
return to;
}

template <typename DDS_SEQ = typename std::conditional<sizeof(DDS_UnsignedLongLong)==sizeof(int64_t), int64_t, void>::type>
template <typename DDS_SEQ, typename DDS_NATIVE_SEQ>
inline DDS_SEQ&
fixedsize_sequence_from_dds (DDS_SEQ& to, const DDS_UnsignedLongLongSeq& from)
uint64_sequence_from_dds (DDS_SEQ& to, const DDS_NATIVE_SEQ& from)
{
to.resize (from.length ());
const_cast<DDS_UnsignedLongLongSeq&> (from).to_array (reinterpret_cast<DDS_UnsignedLongLong*> (to.data ()), ACE_Utils::truncate_cast<DDS_Native::DDS::sequence_size_type> (to.size ()));
const_cast<DDS_NATIVE_SEQ&> (from).to_array (reinterpret_cast<DDS_UnsignedLongLong*> (to.data ()), ACE_Utils::truncate_cast<DDS_Native::DDS::sequence_size_type> (to.size ()));
return to;
}

Expand Down
28 changes: 28 additions & 0 deletions ddsx11/vendors/opendds/dds/base_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,20 @@ namespace DDSX11
return sequence_to_dds (to, from);
}

template <typename DDS_NATIVE_SEQ, typename DDS_SEQ>
inline DDS_NATIVE_SEQ&
int64_sequence_to_dds (DDS_NATIVE_SEQ& to, const DDS_SEQ& from)
{
return sequence_to_dds (to, from);
}

template <typename DDS_NATIVE_SEQ, typename DDS_SEQ>
inline DDS_NATIVE_SEQ&
uint64_sequence_to_dds (DDS_NATIVE_SEQ& to, const DDS_SEQ& from)
{
return sequence_to_dds (to, from);
}

template <typename DDS_NATIVE_SEQ, typename DDS_SEQ>
inline DDS_NATIVE_SEQ&
string_sequence_to_dds (DDS_NATIVE_SEQ& to, const DDS_SEQ& from)
Expand Down Expand Up @@ -381,6 +395,20 @@ namespace DDSX11
return sequence_from_dds (to, from);
}

template <typename DDS_SEQ, typename DDS_NATIVE_SEQ>
inline DDS_SEQ&
int64_sequence_from_dds (DDS_SEQ& to, const DDS_NATIVE_SEQ& from)
{
return sequence_from_dds (to, from);
}

template <typename DDS_SEQ, typename DDS_NATIVE_SEQ>
inline DDS_SEQ&
uint64_sequence_from_dds (DDS_SEQ& to, const DDS_NATIVE_SEQ& from)
{
return sequence_from_dds (to, from);
}

template <typename DDS_SEQ, typename DDS_NATIVE_SEQ>
inline DDS_SEQ&
boolean_sequence_from_dds (DDS_SEQ& to, const DDS_NATIVE_SEQ& from)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ namespace DDSX11
return DDSX11::bounded_string_sequence_to_dds(to, from);
%elsif is_string_type?
return DDSX11::string_sequence_to_dds(to, from);
%elsif is_ulonglong_type?
return DDSX11::uint64_sequence_to_dds(to, from);
%elsif is_longlong_type?
return DDSX11::int64_sequence_to_dds(to, from);
%elsif is_integer_type? || is_char_type? || is_float_type?
return DDSX11::fixedsize_sequence_to_dds(to, from);
%else
Expand All @@ -27,6 +31,10 @@ namespace DDSX11
return DDSX11::bounded_string_sequence_from_dds(to, from);
%elsif is_boolean_type?
return DDSX11::boolean_sequence_from_dds(to, from);
%elsif is_ulonglong_type?
return DDSX11::uint64_sequence_from_dds(to, from);
%elsif is_longlong_type?
return DDSX11::int64_sequence_from_dds(to, from);
%elsif is_integer_type? || is_char_type? || is_float_type?
return DDSX11::fixedsize_sequence_from_dds(to, from);
%else
Expand Down
8 changes: 8 additions & 0 deletions ridlbe/ccmx11/facets/dds/visitors/sequence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ def is_integer_type?
::IDL::Type::Integer === self._resolved_idltype.basetype.resolved_type
end

def is_longlong_type?
::IDL::Type::LongLong === self._resolved_idltype.basetype.resolved_type
end

def is_ulonglong_type?
::IDL::Type::ULongLong === self._resolved_idltype.basetype.resolved_type
end

def is_float_type?
::IDL::Type::Float === self._resolved_idltype.basetype.resolved_type
end
Expand Down

0 comments on commit 1ecaadd

Please sign in to comment.