1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
// -*- C++ -*-
//=============================================================================
/**
* @file CDR_Encaps_Codec.h
*
* $Id$
*
* @author Ossama Othman <ossama@uci.edu>
*/
//=============================================================================
#ifndef TAO_CDR_ENCAPS_CODEC_H
#define TAO_CDR_ENCAPS_CODEC_H
#include "ace/pre.h"
#include "TAO_Export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "IOPC.h"
#include "LocalObject.h"
// This is to remove "inherits via dominance" warnings from MSVC.
// MSVC is being a little too paranoid.
#if defined(_MSC_VER)
#if (_MSC_VER >= 1200)
#pragma warning(push)
#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */
/**
* @class TAO_CDR_Encaps_Codec
*
* @brief Implementation of a CDR encapsulation coder/decoder
* (Codec).
*
* This coder/decoder (Codec) class encodes and decodes data to and
* from a CDR encapsulation, respectively. It is useful for creation
* of octet sequences that contain CDR encapsulations. Those octet
* sequences can then be placed in a IOP::ServiceContext or an
* IOP::TaggedComponent, for example.
*
* @note This Codec should not be used for operations internal to the
* ORB core since it uses interpretive marshaling rather than compiled
* marshaling.
*/
class TAO_Export TAO_CDR_Encaps_Codec
: public virtual IOP::Codec,
public virtual TAO_Local_RefCounted_Object
{
public:
/// Constructor.
TAO_CDR_Encaps_Codec (CORBA::Octet major,
CORBA::Octet minor,
TAO_ORB_Core * orb_core);
/// Encode the given data, including the TypeCode, into an octet
/// sequence.
virtual CORBA::OctetSeq * encode (const CORBA::Any & data
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
IOP::Codec::InvalidTypeForEncoding));
/// Extract the TypeCode and the value from the octet sequence and
/// place them into an Any.
virtual CORBA::Any * decode (const CORBA::OctetSeq & data
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
IOP::Codec::FormatMismatch));
/// Encode the given data, excluding the TypeCode, into an octet
/// sequence.
virtual CORBA::OctetSeq * encode_value (const CORBA::Any & data
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
IOP::Codec::InvalidTypeForEncoding));
/// Extract the value from the octet sequence, based on the given
/// TypeCode, and place it into an Any.
virtual CORBA::Any * decode_value (const CORBA::OctetSeq & data,
CORBA::TypeCode_ptr tc
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
IOP::Codec::FormatMismatch,
IOP::Codec::TypeMismatch));
protected:
/// Destructor.
/**
* Only allow this class to be instantiated on the heap since it is
* reference counted.
*/
~TAO_CDR_Encaps_Codec (void);
/// Verify that it is possible to encode the given data using this
/// Codec.
/**
* Typical reasons for failure include attempting to encode a type
* that isn't supported for the version of GIOP associated with this
* Codec.
*/
void check_type_for_encoding (const CORBA::Any & data
ACE_ENV_ARG_DECL);
private:
/// Prevent copying through the copy constructor and the assignment
/// operator.
ACE_UNIMPLEMENTED_FUNC (
TAO_CDR_Encaps_Codec (const TAO_CDR_Encaps_Codec &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_CDR_Encaps_Codec &))
private:
/// The major GIOP version associated with this Codec.
CORBA::Octet major_;
/// The minor GIOP version associated with this Codec.
CORBA::Octet minor_;
/// The ORB Core to be used when decoding values from a CDR
/// encapsulation.
TAO_ORB_Core * orb_core_;
};
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
#include "ace/post.h"
#endif /* TAO_CDR_ENCAPS_CODEC_H */
|