Union_TypeCode.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Union_TypeCode.h
00006  *
00007  *  $Id: Union_TypeCode.h 78264 2007-05-04 09:13:12Z johnnyw $
00008  *
00009  *  Header file for a @c tk_union CORBA::TypeCode.
00010  *
00011  *  @author Ossama Othman
00012  */
00013 //=============================================================================
00014 
00015 #ifndef TAO_UNION_TYPECODE_H
00016 #define TAO_UNION_TYPECODE_H
00017 
00018 #include /**/ "ace/pre.h"
00019 
00020 #include "tao/AnyTypeCode/TypeCode.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
00027 
00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 namespace TAO
00031 {
00032   namespace TypeCode
00033   {
00034 
00035     /**
00036      * @class Union
00037      *
00038      * @brief @c CORBA::TypeCode implementation for an OMG IDL
00039      *        @c union.
00040      *
00041      * This class implements a @c CORBA::TypeCode for an OMG IDL
00042      * @c union.
00043      */
00044     template <typename StringType,
00045               typename TypeCodeType,
00046               class CaseArrayType,
00047               class RefCountPolicy>
00048     class Union
00049       : public CORBA::TypeCode,
00050         private RefCountPolicy
00051     {
00052     public:
00053 
00054       /// @typedef Type of individual case array element, not the
00055       ///          array itself.
00056       typedef TAO::TypeCode::Case<StringType, TypeCodeType> case_type;
00057 
00058       /// Constructor.
00059       Union (char const * id,
00060              char const * name,
00061 #if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
00062              // Borland C++ currently can't handle a reference to
00063              // const pointer to const CORBA::TypeCode_ptr
00064              TypeCodeType discriminant_type,
00065 #else
00066              TypeCodeType const & discriminant_type,
00067 #endif
00068              CaseArrayType const & cases,
00069              CORBA::ULong ncases,
00070              CORBA::Long default_index);
00071 
00072       /// Constructor used for recursive TypeCodes.
00073       Union (CORBA::TCKind kind, char const * id);
00074 
00075       /**
00076        * @name TAO-specific @c CORBA::TypeCode Methods
00077        *
00078        * Methods required by TAO's implementation of the
00079        * @c CORBA::TypeCode class.
00080        *
00081        * @see @c CORBA::TypeCode
00082        */
00083       //@{
00084       virtual bool tao_marshal (TAO_OutputCDR & cdr,
00085                                 CORBA::ULong offset) const;
00086       virtual void tao_duplicate (void);
00087       virtual void tao_release (void);
00088       //@}
00089 
00090     protected:
00091 
00092       /**
00093        * @name @c TAO CORBA::TypeCode Template Methods
00094        *
00095        * @c tk_union @c CORBA::TypeCode -specific template methods.
00096        *
00097        * @see @c CORBA::TypeCode
00098        */
00099       //@{
00100       virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc) const;
00101       virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
00102                                            ) const;
00103       virtual CORBA::TypeCode_ptr get_compact_typecode_i (
00104         void) const;
00105       virtual char const * id_i (void) const;
00106       virtual char const * name_i (void) const;
00107       virtual CORBA::ULong member_count_i (void) const;
00108       virtual char const * member_name_i (CORBA::ULong index
00109                                           ) const;
00110       virtual CORBA::TypeCode_ptr member_type_i (CORBA::ULong index
00111                                                  ) const;
00112       virtual CORBA::Any * member_label_i (CORBA::ULong index
00113                                            ) const;
00114       virtual CORBA::TypeCode_ptr discriminator_type_i (
00115         void) const;
00116       virtual CORBA::Long default_index_i (void) const;
00117       //@}
00118 
00119     protected:
00120 
00121       /**
00122        * @c Union Attributes
00123        *
00124        * Attributes representing the structure of an OMG IDL
00125        * @c union.
00126        *
00127        * @note These attributes are declared in the order in which
00128        *       they are marshaled into a CDR stream in order to
00129        *       increase cache hits by improving spatial locality.
00130        */
00131       //@{
00132 
00133       /// Base attributes containing repository ID and name of
00134       /// union type.
00135       Base_Attributes<StringType> base_attributes_;
00136 
00137       /// Type of IDL @c union discriminant.
00138       TypeCodeType discriminant_type_;
00139 
00140       /// Index of the default union case.
00141       /**
00142        * This value will be -1 if no default case is found in the
00143        * union.
00144        */
00145       CORBA::Long default_index_;
00146 
00147       /// The number of cases in the OMG IDL union, excluding the
00148       /// @c default case.
00149       CORBA::ULong ncases_;
00150 
00151       /// Array of @c TAO::TypeCode::Case representing structure of
00152       /// the OMG IDL defined @c union.
00153       CaseArrayType cases_;
00154 
00155       //@}
00156 
00157     };
00158 
00159   }  // End namespace TypeCode
00160 }  // End namespace TAO
00161 
00162 TAO_END_VERSIONED_NAMESPACE_DECL
00163 
00164 
00165 #ifdef __ACE_INLINE__
00166 # include "tao/AnyTypeCode/Union_TypeCode.inl"
00167 #endif  /* __ACE_INLINE__ */
00168 
00169 #ifdef ACE_TEMPLATES_REQUIRE_SOURCE
00170 # include "tao/AnyTypeCode/Union_TypeCode.cpp"
00171 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00172 
00173 #ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
00174 # pragma implementation ("Union_TypeCode.cpp")
00175 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00176 
00177 
00178 #include /**/ "ace/post.h"
00179 
00180 #endif /* TAO_UNION_TYPECODE_H */

Generated on Sun Jan 27 13:21:07 2008 for TAO_AnyTypeCode by doxygen 1.3.6