Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CDR_Encaps_Codec.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  * @file CDR_Encaps_Codec.h
00006  *
00007  * $Id: CDR_Encaps_Codec.h,v 1.1.1.2 2003/02/21 18:36:44 chad Exp $
00008  *
00009  * @author Ossama Othman <ossama@uci.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_CDR_ENCAPS_CODEC_H
00014 #define TAO_CDR_ENCAPS_CODEC_H
00015 
00016 #include "ace/pre.h"
00017 
00018 #include "TAO_Export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "IOPC.h"
00025 #include "LocalObject.h"
00026 
00027 // This is to remove "inherits via dominance" warnings from MSVC.
00028 // MSVC is being a little too paranoid.
00029 #if defined(_MSC_VER)
00030 #if (_MSC_VER >= 1200)
00031 #pragma warning(push)
00032 #endif /* _MSC_VER >= 1200 */
00033 #pragma warning(disable:4250)
00034 #endif /* _MSC_VER */
00035 
00036 
00037 /**
00038  * @class TAO_CDR_Encaps_Codec
00039  *
00040  * @brief Implementation of a CDR encapsulation coder/decoder
00041  * (Codec).
00042  *
00043  * This coder/decoder (Codec) class encodes and decodes data to and
00044  * from a CDR encapsulation, respectively.  It is useful for creation
00045  * of octet sequences that contain CDR encapsulations.  Those octet
00046  * sequences can then be placed in a IOP::ServiceContext or an
00047  * IOP::TaggedComponent, for example.
00048  *
00049  * @note This Codec should not be used for operations internal to the
00050  * ORB core since it uses interpretive marshaling rather than compiled
00051  * marshaling.
00052  */
00053 class TAO_Export TAO_CDR_Encaps_Codec
00054   : public virtual IOP::Codec,
00055     public virtual TAO_Local_RefCounted_Object
00056 {
00057 public:
00058 
00059   /// Constructor.
00060   TAO_CDR_Encaps_Codec (CORBA::Octet major,
00061                         CORBA::Octet minor,
00062                         TAO_ORB_Core * orb_core);
00063 
00064   /// Encode the given data, including the TypeCode, into an octet
00065   /// sequence.
00066   virtual CORBA::OctetSeq * encode (const CORBA::Any & data
00067                                     ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00068     ACE_THROW_SPEC ((CORBA::SystemException,
00069                      IOP::Codec::InvalidTypeForEncoding));
00070 
00071   /// Extract the TypeCode and the value from the octet sequence and
00072   /// place them into an Any.
00073   virtual CORBA::Any * decode (const CORBA::OctetSeq & data
00074                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00075     ACE_THROW_SPEC ((CORBA::SystemException,
00076                      IOP::Codec::FormatMismatch));
00077 
00078   /// Encode the given data, excluding the TypeCode, into an octet
00079   /// sequence.
00080   virtual CORBA::OctetSeq * encode_value (const CORBA::Any & data
00081                                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00082     ACE_THROW_SPEC ((CORBA::SystemException,
00083                      IOP::Codec::InvalidTypeForEncoding));
00084 
00085   /// Extract the value from the octet sequence, based on the given
00086   /// TypeCode,  and place it into an Any.
00087   virtual CORBA::Any * decode_value (const CORBA::OctetSeq & data,
00088                                      CORBA::TypeCode_ptr tc
00089                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00090     ACE_THROW_SPEC ((CORBA::SystemException,
00091                      IOP::Codec::FormatMismatch,
00092                      IOP::Codec::TypeMismatch));
00093 
00094 protected:
00095 
00096   /// Destructor.
00097   /**
00098    * Only allow this class to be instantiated on the heap since it is
00099    * reference counted.
00100    */
00101   ~TAO_CDR_Encaps_Codec (void);
00102 
00103   /// Verify that it is possible to encode the given data using this
00104   /// Codec.
00105   /**
00106    * Typical reasons for failure include attempting to encode a type
00107    * that isn't supported for the version of GIOP associated with this
00108    * Codec.
00109    */
00110   void check_type_for_encoding (const CORBA::Any & data
00111                                 ACE_ENV_ARG_DECL);
00112 
00113 private:
00114 
00115   /// Prevent copying through the copy constructor and the assignment
00116   /// operator.
00117   ACE_UNIMPLEMENTED_FUNC (
00118     TAO_CDR_Encaps_Codec (const TAO_CDR_Encaps_Codec &))
00119   ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_CDR_Encaps_Codec &))
00120 
00121 private:
00122 
00123   /// The major GIOP version associated with this Codec.
00124   CORBA::Octet major_;
00125 
00126   /// The minor GIOP version associated with this Codec.
00127   CORBA::Octet minor_;
00128 
00129   /// The ORB Core to be used when decoding values from a CDR
00130   /// encapsulation.
00131   TAO_ORB_Core * orb_core_;
00132 
00133 };
00134 
00135 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00136 #pragma warning(pop)
00137 #endif /* _MSC_VER */
00138 
00139 #include "ace/post.h"
00140 
00141 #endif  /* TAO_CDR_ENCAPS_CODEC_H */

Generated on Mon Jun 16 13:48:03 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002