Union_TypeCode_Static.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Union_TypeCode_Static.h
00006  *
00007  *  $Id: Union_TypeCode_Static.h 76551 2007-01-24 13:42:44Z johnnyw $
00008  *
00009  *  Header file for a static @c tk_union CORBA::TypeCode.
00010  *
00011  *  @author Ossama Othman
00012  */
00013 //=============================================================================
00014 
00015 #ifndef TAO_UNION_TYPECODE_STATIC_H
00016 #define TAO_UNION_TYPECODE_STATIC_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 #include "tao/AnyTypeCode/Null_RefCount_Policy.h"
00028 
00029 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00030 
00031 namespace TAO
00032 {
00033   namespace TypeCode
00034   {
00035     template <typename StringType,
00036               typename TypeCodeType,
00037               class CaseArrayType,
00038               class RefCountPolicy> class Union;
00039     template <typename StringType, typename TypeCodeType> class Case;
00040     /**
00041      * @class Union
00042      *
00043      * @brief @c CORBA::TypeCode implementation for an OMG IDL
00044      *        @c union.
00045      *
00046      * This class implements a @c CORBA::TypeCode for an OMG IDL
00047      * @c union.
00048      */
00049     template<>
00050     class TAO_AnyTypeCode_Export Union<char const *,
00051                            CORBA::TypeCode_ptr const *,
00052                            Case<char const *,
00053                                 CORBA::TypeCode_ptr const *> const * const *,
00054                            TAO::Null_RefCount_Policy>
00055       : public CORBA::TypeCode,
00056         private TAO::Null_RefCount_Policy
00057     {
00058     public:
00059 
00060       /// @typedef Type of individual case array element, not the
00061       ///          array itself.
00062       typedef TAO::TypeCode::Case<char const *,
00063                                   CORBA::TypeCode_ptr const *> case_type;
00064 
00065       /// Constructor.
00066       Union (char const * id,
00067              char const * name,
00068              CORBA::TypeCode_ptr const * discriminant_type,
00069              Case<char const *,
00070                   CORBA::TypeCode_ptr const *> const * const * cases,
00071              CORBA::ULong ncases,
00072              CORBA::Long default_index);
00073 
00074       /**
00075        * @name TAO-specific @c CORBA::TypeCode Methods
00076        *
00077        * Methods required by TAO's implementation of the
00078        * @c CORBA::TypeCode class.
00079        *
00080        * @see @c CORBA::TypeCode
00081        */
00082       //@{
00083       virtual bool tao_marshal (TAO_OutputCDR & cdr,
00084                                 CORBA::ULong offset) const;
00085       virtual void tao_duplicate (void);
00086       virtual void tao_release (void);
00087       //@}
00088 
00089     protected:
00090 
00091       /**
00092        * @name @c TAO CORBA::TypeCode Template Methods
00093        *
00094        * @c tk_union @c CORBA::TypeCode -specific template methods.
00095        *
00096        * @see @c CORBA::TypeCode
00097        */
00098       //@{
00099       virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
00100                                       ) 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     private:
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<char const *> const base_attributes_;
00136 
00137       /// Type of IDL @c union discriminant.
00138       CORBA::TypeCode_ptr const * const 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 const default_index_;
00146 
00147       /// The number of cases in the OMG IDL union, excluding the
00148       /// @c default case.
00149       CORBA::ULong const ncases_;
00150 
00151       /// Array of @c TAO::TypeCode::Case representing structure of
00152       /// the OMG IDL defined @c union.
00153       Case<char const *,
00154            CORBA::TypeCode_ptr const *> const * const * const cases_;
00155 
00156       //@}
00157 
00158     };
00159 
00160   }  // End namespace TypeCode
00161 }  // End namespace TAO
00162 
00163 TAO_END_VERSIONED_NAMESPACE_DECL
00164 
00165 #ifdef __ACE_INLINE__
00166 # include "tao/AnyTypeCode/Union_TypeCode_Static.inl"
00167 #endif  /* __ACE_INLINE__ */
00168 
00169 #include /**/ "ace/post.h"
00170 
00171 #endif /* TAO_UNION_TYPECODE_STATIC_H */

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