diff options
author | Fred Hornsey <hornseyf@objectcomputing.com> | 2021-06-21 20:22:55 -0500 |
---|---|---|
committer | Fred Hornsey <hornseyf@objectcomputing.com> | 2021-06-21 20:22:55 -0500 |
commit | 2ed7fe7c1c6492c7f920581ec3ac8e7ec4278efd (patch) | |
tree | 7580b073445bd321afe9b4e3a0764108595c48c6 /TAO/tao | |
parent | b489eefef18d6c538d5498350bb732bc51792f50 (diff) | |
download | ATCD-2ed7fe7c1c6492c7f920581ec3ac8e7ec4278efd.tar.gz |
Support int8/uint8 Sequences and Arrays
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/.gitignore | 41 | ||||
-rw-r--r-- | TAO/tao/Basic_Types.h | 18 | ||||
-rw-r--r-- | TAO/tao/Basic_Types_IDLv4.h | 20 | ||||
-rw-r--r-- | TAO/tao/Bounded_Sequence_CDR_T.h | 71 | ||||
-rw-r--r-- | TAO/tao/Bounded_Value_Sequence_T.h | 2 | ||||
-rw-r--r-- | TAO/tao/CDR.h | 4 | ||||
-rw-r--r-- | TAO/tao/CDR.inl | 23 | ||||
-rw-r--r-- | TAO/tao/Unbounded_Sequence_CDR_T.h | 71 | ||||
-rw-r--r-- | TAO/tao/Unbounded_Value_Sequence_T.h | 2 | ||||
-rw-r--r-- | TAO/tao/tao.mpc | 12 |
10 files changed, 194 insertions, 70 deletions
diff --git a/TAO/tao/.gitignore b/TAO/tao/.gitignore index 03471db0e1c..8a019505f28 100644 --- a/TAO/tao/.gitignore +++ b/TAO/tao/.gitignore @@ -1,13 +1,16 @@ +/AnyTypeCode/Int8SeqA.cpp +/AnyTypeCode/Int8SeqA.h +/AnyTypeCode/UInt8SeqA.cpp +/AnyTypeCode/UInt8SeqA.h /BooleanSeqC.cpp /BooleanSeqC.h /BooleanSeqS.h -/CharSeqC.cpp -/CharSeqC.h -/CharSeqS.h -/config.h.in /CONV_FRAMEC.cpp /CONV_FRAMEC.h /CONV_FRAMES.h +/CharSeqC.cpp +/CharSeqC.h +/CharSeqS.h /CurrentC.cpp /CurrentC.h /CurrentS.h @@ -21,15 +24,19 @@ /GIOPC.h /GIOPC.inl /GIOPS.h -/IIOP_EndpointsC.cpp -/IIOP_EndpointsC.h -/IIOP_EndpointsS.h /IIOPC.cpp /IIOPC.h /IIOPS.h +/IIOP_EndpointsC.cpp +/IIOP_EndpointsC.h +/IIOP_EndpointsS.h /IOPC.cpp /IOPC.h /IOPS.h +/Int8Seq.pidl +/Int8SeqC.cpp +/Int8SeqC.h +/Int8SeqS.h /LongDoubleSeqC.cpp /LongDoubleSeqC.h /LongDoubleSeqS.h @@ -51,15 +58,15 @@ /OctetSeqC.cpp /OctetSeqC.h /OctetSeqS.h -/orb_typesC.cpp -/orb_typesC.h -/orb_typesS.h -/ParameterModeC.cpp -/ParameterModeC.h -/ParameterModeS.h /PI_ForwardC.cpp /PI_ForwardC.h /PI_ForwardS.h +/ParameterModeC.cpp +/ParameterModeC.h +/ParameterModeS.h +/PolicyC.cpp +/PolicyC.h +/PolicyC.inl /Policy_CurrentC.cpp /Policy_CurrentC.h /Policy_CurrentS.h @@ -90,6 +97,10 @@ /TimeBaseC.cpp /TimeBaseC.h /TimeBaseS.h +/UInt8Seq.pidl +/UInt8SeqC.cpp +/UInt8SeqC.h +/UInt8SeqS.h /ULongLongSeqC.cpp /ULongLongSeqC.h /ULongLongSeqS.h @@ -105,3 +116,7 @@ /WStringSeqC.cpp /WStringSeqC.h /WStringSeqS.h +/config.h.in +/orb_typesC.cpp +/orb_typesC.h +/orb_typesS.h diff --git a/TAO/tao/Basic_Types.h b/TAO/tao/Basic_Types.h index 538332cdf93..facd7e59348 100644 --- a/TAO/tao/Basic_Types.h +++ b/TAO/tao/Basic_Types.h @@ -75,6 +75,24 @@ namespace CORBA typedef ACE_CDR::WChar WChar; typedef WChar &WChar_out; + + typedef ACE_CDR::Int16 Int16; + typedef Int16 &Int16_out; + + typedef ACE_CDR::UInt16 UInt16; + typedef UInt16 &UInt16_out; + + typedef ACE_CDR::Int32 Int32; + typedef Int32 &Int32_out; + + typedef ACE_CDR::UInt32 UInt32; + typedef UInt32 &UInt32_out; + + typedef ACE_CDR::Int64 Int64; + typedef Int64 &Int64_out; + + typedef ACE_CDR::UInt64 UInt64; + typedef UInt64 &UInt64_out; //@} typedef TAO::String_var<CORBA::Char> String_var; diff --git a/TAO/tao/Basic_Types_IDLv4.h b/TAO/tao/Basic_Types_IDLv4.h index 0b278876e2f..e4966777daa 100644 --- a/TAO/tao/Basic_Types_IDLv4.h +++ b/TAO/tao/Basic_Types_IDLv4.h @@ -26,27 +26,11 @@ namespace CORBA //@{ typedef ACE_CDR::Int8 Int8; typedef Int8 &Int8_out; + struct Int8_tag {}; typedef ACE_CDR::UInt8 UInt8; typedef UInt8 &UInt8_out; - - typedef ACE_CDR::Int16 Int16; - typedef Int16 &Int16_out; - - typedef ACE_CDR::UInt16 UInt16; - typedef UInt16 &UInt16_out; - - typedef ACE_CDR::Int32 Int32; - typedef Int32 &Int32_out; - - typedef ACE_CDR::UInt32 UInt32; - typedef UInt32 &UInt32_out; - - typedef ACE_CDR::Int64 Int64; - typedef Int64 &Int64_out; - - typedef ACE_CDR::UInt64 UInt64; - typedef UInt64 &UInt64_out; + struct UInt8_tag {}; //@} } } diff --git a/TAO/tao/Bounded_Sequence_CDR_T.h b/TAO/tao/Bounded_Sequence_CDR_T.h index 6c673bd1214..f2339ff8bbf 100644 --- a/TAO/tao/Bounded_Sequence_CDR_T.h +++ b/TAO/tao/Bounded_Sequence_CDR_T.h @@ -1,5 +1,5 @@ -#ifndef guard_bounded_sequence_cdr -#define guard_bounded_sequence_cdr +#ifndef TAO_BOUNDED_SEQUENCE_CDR_T_H +#define TAO_BOUNDED_SEQUENCE_CDR_T_H /** * @file * @@ -11,6 +11,7 @@ #include "tao/orbconf.h" #include "tao/SystemException.h" +#include "tao/Basic_Types_IDLv4.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -277,6 +278,48 @@ namespace TAO { return true; } + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, + TAO::bounded_value_sequence <CORBA::IDLv4::UInt8, MAX, CORBA::IDLv4::UInt8_tag> & target) { + typedef TAO::bounded_value_sequence <CORBA::IDLv4::UInt8, MAX, CORBA::IDLv4::UInt8_tag> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_uint8_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, + TAO::bounded_value_sequence <CORBA::IDLv4::Int8, MAX, CORBA::IDLv4::Int8_tag> & target) { + typedef TAO::bounded_value_sequence <CORBA::IDLv4::Int8, MAX, CORBA::IDLv4::Int8_tag> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_int8_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + template <typename stream, typename value_t, CORBA::ULong MAX> bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <value_t, MAX> & target) { typedef TAO::bounded_value_sequence <value_t, MAX> sequence; @@ -382,9 +425,7 @@ namespace TAO { tmp.swap(target); return true; } -} -namespace TAO { template <typename stream, CORBA::ULong MAX> bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Short, MAX> & source) { ::CORBA::ULong const length = source.length (); @@ -504,6 +545,26 @@ namespace TAO { return strm.write_boolean_array (source.get_buffer (), length); } + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, + const TAO::bounded_value_sequence <CORBA::IDLv4::UInt8, MAX, CORBA::IDLv4::UInt8_tag> & source) { + ::CORBA::ULong const length = source.length (); + if (length > source.maximum () || !(strm << length)) { + return false; + } + return strm.write_uint8_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, + const TAO::bounded_value_sequence <CORBA::IDLv4::Int8, MAX, CORBA::IDLv4::Int8_tag> & source) { + ::CORBA::ULong const length = source.length (); + if (length > source.maximum () || !(strm << length)) { + return false; + } + return strm.write_int8_array (source.get_buffer (), length); + } + template <typename stream, typename value_t, CORBA::ULong MAX> bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <value_t, MAX> & source) { ::CORBA::ULong const length = source.length (); @@ -568,4 +629,4 @@ namespace TAO { TAO_END_VERSIONED_NAMESPACE_DECL -#endif /* guard_bounded_sequence_cdr */ +#endif /* TAO_BOUNDED_SEQUENCE_CDR_T_H */ diff --git a/TAO/tao/Bounded_Value_Sequence_T.h b/TAO/tao/Bounded_Value_Sequence_T.h index 8c766e1c1f7..a9e620aa42a 100644 --- a/TAO/tao/Bounded_Value_Sequence_T.h +++ b/TAO/tao/Bounded_Value_Sequence_T.h @@ -18,7 +18,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { -template<class T, CORBA::ULong MAX> +template<class T, CORBA::ULong MAX, class Tag=int> class bounded_value_sequence { public: diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h index d2ac02e1a0f..c6b7d64b17f 100644 --- a/TAO/tao/CDR.h +++ b/TAO/tao/CDR.h @@ -499,8 +499,6 @@ TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os, TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os, ACE_OutputCDR::from_std_wstring x); #endif /* ACE_LACKS_STD_WSTRING */ -TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::IDLv4::Int8 x); -TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::IDLv4::UInt8 x); // CDR input operators for CORBA types @@ -540,8 +538,6 @@ TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &os, TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &os, ACE_InputCDR::to_std_wstring x); #endif /* ACE_LACKS_STD_WSTRING */ -TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::IDLv4::Int8 &x); -TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::IDLv4::UInt8 &x); TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/CDR.inl b/TAO/tao/CDR.inl index 24952bb8329..89958d671dd 100644 --- a/TAO/tao/CDR.inl +++ b/TAO/tao/CDR.inl @@ -495,19 +495,6 @@ ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, } #endif /* ACE_LACKS_STD_WSTRING */ -ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::IDLv4::Int8 x) -{ - return os.fragment_stream (ACE_CDR::OCTET_ALIGN, ACE_CDR::OCTET_SIZE) - && static_cast<ACE_OutputCDR &> (os) << x; -} - -ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::IDLv4::UInt8 x) -{ - return - os.fragment_stream (ACE_CDR::OCTET_ALIGN, ACE_CDR::OCTET_SIZE) - && static_cast<ACE_OutputCDR &> (os) << x; -} - // **************************************************************** ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, @@ -638,14 +625,4 @@ ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, } #endif /* ACE_LACKS_STD_WSTRING */ -ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::IDLv4::Int8 &x) -{ - return static_cast<ACE_InputCDR &> (is) >> x; -} - -ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::IDLv4::UInt8 &x) -{ - return static_cast<ACE_InputCDR &> (is) >> x; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Unbounded_Sequence_CDR_T.h b/TAO/tao/Unbounded_Sequence_CDR_T.h index 0c8d5308970..ab4fb8aca9e 100644 --- a/TAO/tao/Unbounded_Sequence_CDR_T.h +++ b/TAO/tao/Unbounded_Sequence_CDR_T.h @@ -1,5 +1,5 @@ -#ifndef guard_unbounded_sequence_cdr -#define guard_unbounded_sequence_cdr +#ifndef TAO_UNBOUNDED_SEQUENCE_CDR_T_H +#define TAO_UNBOUNDED_SEQUENCE_CDR_T_H /** * @file * @@ -12,6 +12,7 @@ #include "tao/orbconf.h" #include "tao/CORBA_String.h" #include "tao/SystemException.h" +#include "tao/Basic_Types_IDLv4.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -313,6 +314,48 @@ namespace TAO { return true; } + template <typename stream> + bool demarshal_sequence(stream & strm, + TAO::unbounded_value_sequence <CORBA::IDLv4::UInt8, CORBA::IDLv4::UInt8_tag> & target) { + typedef TAO::unbounded_value_sequence <CORBA::IDLv4::UInt8, CORBA::IDLv4::UInt8_tag> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_uint8_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream> + bool demarshal_sequence(stream & strm, + TAO::unbounded_value_sequence <CORBA::IDLv4::Int8, CORBA::IDLv4::Int8_tag> & target) { + typedef TAO::unbounded_value_sequence <CORBA::IDLv4::Int8, CORBA::IDLv4::Int8_tag> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_int8_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + template <typename stream, typename value_t> bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <value_t> & target) { typedef TAO::unbounded_value_sequence <value_t> sequence; @@ -418,9 +461,7 @@ namespace TAO { tmp.swap(target); return true; } -} -namespace TAO { template <typename stream> bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Short> & source) { ::CORBA::ULong const length = source.length (); @@ -554,6 +595,26 @@ namespace TAO { return strm.write_boolean_array (source.get_buffer (), length); } + template <typename stream> + bool marshal_sequence(stream & strm, + const TAO::unbounded_value_sequence <CORBA::IDLv4::UInt8, CORBA::IDLv4::UInt8_tag> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_uint8_array (source.get_buffer (), length); + } + + template <typename stream> + bool marshal_sequence(stream & strm, + const TAO::unbounded_value_sequence <CORBA::IDLv4::Int8, CORBA::IDLv4::Int8_tag> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_int8_array (source.get_buffer (), length); + } + template <typename stream, typename value_t> bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <value_t> & source) { ::CORBA::ULong const length = source.length (); @@ -618,4 +679,4 @@ namespace TAO { TAO_END_VERSIONED_NAMESPACE_DECL -#endif /* guard_unbounded_sequence_cdr */ +#endif /* TAO_UNBOUNDED_SEQUENCE_CDR_T_H */ diff --git a/TAO/tao/Unbounded_Value_Sequence_T.h b/TAO/tao/Unbounded_Value_Sequence_T.h index a82aa26e6c4..3d6893254a3 100644 --- a/TAO/tao/Unbounded_Value_Sequence_T.h +++ b/TAO/tao/Unbounded_Value_Sequence_T.h @@ -18,7 +18,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { -template<class T> +template<class T, class Tag=int> class unbounded_value_sequence { public: diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc index a816e0ce154..fd742ddc17d 100644 --- a/TAO/tao/tao.mpc +++ b/TAO/tao/tao.mpc @@ -61,6 +61,12 @@ project(TAO_Core_idl) : tao_versioning_idl_defaults, gen_ostream, install, pidl_ } IDL_Files { + idlflags += -Sci -Gse -Gata --idl-version 4 + Int8Seq.pidl >> AnyTypeCode/Int8SeqA.h AnyTypeCode/Int8SeqA.cpp + UInt8Seq.pidl >> AnyTypeCode/UInt8SeqA.h AnyTypeCode/UInt8SeqA.cpp + } + + IDL_Files { idlflags += -GT -oS PortableServer -Gd \ -Wb,safe_include=tao/PolicyC.h \ -Wb,skel_export_macro=TAO_PortableServer_Export \ @@ -169,6 +175,7 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoid IIOPC.cpp Incoming_Message_Queue.cpp Incoming_Message_Stack.cpp + Int8SeqC.cpp Invocation_Adapter.cpp Invocation_Base.cpp Invocation_Endpoint_Selectors.cpp @@ -308,6 +315,7 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoid TSS_Resources.cpp TypeCodeFactory_Adapter.cpp Typecode_typesC.cpp + UInt8SeqC.cpp ULongLongSeqC.cpp ULongSeqC.cpp UserException.cpp @@ -453,6 +461,8 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoid IIOP_Transport.h Incoming_Message_Queue.h Incoming_Message_Stack.h + Int8SeqC.h + Int8SeqS.h Invocation_Adapter.h Invocation_Base.h Invocation_Endpoint_Selectors.h @@ -633,6 +643,8 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoid Typecode_typesS.h UB_String_Arguments.h UB_String_Argument_T.h + UInt8SeqC.h + UInt8SeqS.h ULongLongSeqC.h ULongLongSeqS.h ULongSeqC.h |