3 //=============================================================================
5 * @file CDR_Encaps_Codec.h
7 * @author Ossama Othman <ossama@uci.edu>
9 //=============================================================================
11 #ifndef TAO_CDR_ENCAPS_CODEC_H
12 #define TAO_CDR_ENCAPS_CODEC_H
14 #include /**/ "ace/pre.h"
16 #include "tao/CodecFactory/IOP_Codec_includeC.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/LocalObject.h"
24 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
26 class TAO_Codeset_Translator_Base
;
29 * @class TAO_CDR_Encaps_Codec
31 * @brief Implementation of a CDR encapsulation coder/decoder
34 * This coder/decoder (Codec) class encodes and decodes data to and
35 * from a CDR encapsulation, respectively. It is useful for creation
36 * of octet sequences that contain CDR encapsulations. Those octet
37 * sequences can then be placed in a IOP::ServiceContext or an
38 * IOP::TaggedComponent, for example.
40 * @note This Codec should not be used for operations internal to the
41 * ORB core since it uses interpretive marshaling rather than compiled
44 class TAO_CDR_Encaps_Codec
45 : public virtual IOP::Codec
,
46 public virtual ::CORBA::LocalObject
50 TAO_CDR_Encaps_Codec (CORBA::Octet major
,
52 TAO_ORB_Core
* orb_core
,
53 TAO_Codeset_Translator_Base
* char_trans
,
54 TAO_Codeset_Translator_Base
* wchar_trans
);
56 /// Encode the given data, including the TypeCode, into an octet
58 virtual CORBA::OctetSeq
* encode (const CORBA::Any
& data
);
60 /// Extract the TypeCode and the value from the octet sequence and
61 /// place them into an Any.
62 virtual CORBA::Any
* decode (const CORBA::OctetSeq
& data
);
64 /// Encode the given data, excluding the TypeCode, into an octet
66 virtual CORBA::OctetSeq
* encode_value (const CORBA::Any
& data
);
68 /// Extract the value from the octet sequence, based on the given
69 /// TypeCode, and place it into an Any.
70 virtual CORBA::Any
* decode_value (const CORBA::OctetSeq
& data
,
71 CORBA::TypeCode_ptr tc
);
76 * Only allow this class to be instantiated on the heap since it is
79 virtual ~TAO_CDR_Encaps_Codec ();
81 /// Verify that it is possible to encode the given data using this
84 * Typical reasons for failure include attempting to encode a type
85 * that isn't supported for the version of GIOP associated with this
88 void check_type_for_encoding (const CORBA::Any
& data
);
91 TAO_CDR_Encaps_Codec (const TAO_CDR_Encaps_Codec
&) = delete;
92 void operator= (const TAO_CDR_Encaps_Codec
&) = delete;
95 /// The major GIOP version associated with this Codec.
96 CORBA::Octet
const major_
;
98 /// The minor GIOP version associated with this Codec.
99 CORBA::Octet
const minor_
;
101 /// The ORB Core to be used when decoding values from a CDR
103 TAO_ORB_Core
* const orb_core_
;
105 /// Char codeset translator
106 TAO_Codeset_Translator_Base
* char_translator_
;
108 /// WChar codeset translator
109 TAO_Codeset_Translator_Base
* wchar_translator_
;
112 TAO_END_VERSIONED_NAMESPACE_DECL
114 #include /**/ "ace/post.h"
116 #endif /* TAO_CDR_ENCAPS_CODEC_H */