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

TAO_CodecFactory Class Reference

Implementation of the IOP::CodecFactory interface. More...

#include <CodecFactory.h>

Inheritance diagram for TAO_CodecFactory:

Inheritance graph
[legend]
Collaboration diagram for TAO_CodecFactory:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_CodecFactory (TAO_ORB_Core *orb_core)
 Constructor. More...

virtual IOP::Codec_ptr create_codec (const IOP::Encoding &enc ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException, IOP::CodecFactory::UnknownEncoding)
 Create a Coder/Decoder for the given type of encoding. More...


Private Methods

 TAO_CodecFactory (const TAO_CodecFactory &)
 Prevent copying through the copy constructor and the assignment operator. More...

void operator= (const TAO_CodecFactory &)

Private Attributes

TAO_ORB_Coreorb_core_
 Pointer to the ORB Core. More...


Detailed Description

Implementation of the IOP::CodecFactory interface.

This class can be used to create Codec (coder/decoder) of a given type, such as a CDR encapsulation Codec.

Definition at line 45 of file CodecFactory.h.


Constructor & Destructor Documentation

TAO_CodecFactory::TAO_CodecFactory TAO_ORB_Core   orb_core
 

Constructor.

Definition at line 13 of file CodecFactory.cpp.

00014   : orb_core_ (orb_core)
00015 {
00016 }

TAO_CodecFactory::TAO_CodecFactory const TAO_CodecFactory &    [private]
 

Prevent copying through the copy constructor and the assignment operator.


Member Function Documentation

IOP::Codec_ptr TAO_CodecFactory::create_codec const IOP::Encoding &enc    ACE_ENV_ARG_DECL_WITH_DEFAULTS throw (CORBA::SystemException, IOP::CodecFactory::UnknownEncoding) [virtual]
 

Create a Coder/Decoder for the given type of encoding.

Implements IOP::CodecFactory.

Definition at line 19 of file CodecFactory.cpp.

References IOP::Codec::_nil, CORBA_SystemException::_tao_minor_code, ACE_CHECK_RETURN, ACE_ENV_ARG_DECL, ACE_NEW_THROW_EX, ACE_THROW_RETURN, and TAO_DEFAULT_MINOR_CODE.

00023 {
00024   // @todo: Ideally we should have some sort of CodecFactory
00025   //        registry to make it possible to add factories
00026   //        dynamically.  However, there currently isn't a need to
00027   //        support anything other than CDR encapsulations yet so we
00028   //        hardcode its Codec.  This may change once TAO starts to
00029   //        support messaging formats other than GIOP.
00030 
00031   IOP::Codec_ptr codec = IOP::Codec::_nil ();
00032 
00033   switch (enc.format)
00034     {
00035 
00036       // @@ MSVC 6 gets confused and thinks that
00037       //    IOP::ENCODING_CDR_ENCAPS is not a constant, so its actual
00038       //    value (0) is used instead.
00039     case 0 /* IOP::ENCODING_CDR_ENCAPS */:
00040       if (enc.major_version < 1)
00041         {
00042           // There is no such thing as a "0.x" CDR encapsulation.
00043           ACE_THROW_RETURN (CORBA::BAD_PARAM (
00044                               CORBA_SystemException::_tao_minor_code (
00045                                 TAO_DEFAULT_MINOR_CODE,
00046                                 EINVAL),
00047                               CORBA::COMPLETED_NO),
00048                             IOP::Codec::_nil ());
00049         }
00050 
00051       ACE_NEW_THROW_EX (codec,
00052                         TAO_CDR_Encaps_Codec (enc.major_version,
00053                                               enc.minor_version,
00054                                               this->orb_core_),
00055                         CORBA::NO_MEMORY (
00056                           CORBA_SystemException::_tao_minor_code (
00057                             TAO_DEFAULT_MINOR_CODE,
00058                             ENOMEM),
00059                           CORBA::COMPLETED_MAYBE));
00060       ACE_CHECK_RETURN (IOP::Codec::_nil ());
00061       break;
00062 
00063     default:
00064       ACE_THROW_RETURN (IOP::CodecFactory::UnknownEncoding (),
00065                         IOP::Codec::_nil ());
00066 
00067     }
00068 
00069   return codec;
00070 }

void TAO_CodecFactory::operator= const TAO_CodecFactory &    [private]
 


Member Data Documentation

TAO_ORB_Core* TAO_CodecFactory::orb_core_ [private]
 

Pointer to the ORB Core.

Some Codec implementations may need access to the ORB Core with which they are associated.

Definition at line 75 of file CodecFactory.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:08:46 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002