summaryrefslogtreecommitdiff
path: root/TAO/tao/AnyTypeCode/TypeCode_Case_Enum_T.h
blob: d23aaa6b2476469b28467e99f744e9473d904523 (plain)
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
// -*- C++ -*-

//=============================================================================
/**
 *  @file    TypeCode_Case_Enum_T.h
 *
 *  Header file for @c TAO::TypeCode::Case_T template.
 *
 *  @author Ossama Othman
 */
//=============================================================================

#ifndef TAO_TYPECODE_CASE_ENUM_T_H
#define TAO_TYPECODE_CASE_ENUM_T_H

#include /**/ "ace/pre.h"

#include "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/AnyTypeCode/TypeCode_Case_Base_T.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace TypeCode
  {
    /**
     * @class Case_Enum_T
     *
     * @brief Representation of an OMG IDL defined @c union @c case for
     * unions with Enum discriminators.
     *
     * When dynamically creating a union type with a enum
     * discriminator, there is not way that the template
     * parameter DiscriminatorType can be specified at runtime.
     *
     * Since enums are encoded as ULongs, DiscriminatorType has
     * been replaced with CORBA::ULong.
     */
    template <typename StringType,
              typename TypeCodeType>
    class Case_Enum_T : public Case<StringType, TypeCodeType>
    {
    public:
      /// Constructor.
      Case_Enum_T (CORBA::TypeCode_ptr discriminator_tc,
                   CORBA::ULong member_label,
                   char const * member_name,
                   TypeCodeType member_type);

      /// Constructor.
      /**
       * Constructor only used in the dynamically constructed @c union
       * @c TypeCode case.
       */
      Case_Enum_T (CORBA::TypeCode_ptr discriminator_tc,
                   CORBA::ULong member_label);

      /**
       * @name @c TAO::TypeCode::Case Methods
       *
       * Methods required by the @c TAO::TypeCode::Case abstract base
       * class.
       *
       * @see @c TAO::TypeCode::Case
       */
      //@{
      Case<StringType, TypeCodeType> * clone () const;
      virtual CORBA::Any * label () const;
      virtual bool marshal_label (TAO_OutputCDR & cdr) const;
      virtual bool equal_label (CORBA::ULong index,
                                CORBA::TypeCode_ptr tc) const;
      //@}

    private:
      /// IDL @c union case/member label value.
      ::CORBA::ULong const label_;

      /// IDL @c union discriminator typecode.
      CORBA::TypeCode_var discriminator_tc_;
    };
  }  // End namespace TypeCode
}  // End namespace TAO

TAO_END_VERSIONED_NAMESPACE_DECL


#ifdef __ACE_INLINE__
# include "tao/AnyTypeCode/TypeCode_Case_Enum_T.inl"
#endif /* __ACE_INLINE__ */

#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
# include "tao/AnyTypeCode/TypeCode_Case_Enum_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
# pragma implementation ("TypeCode_Case_Enum_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

#include /**/ "ace/post.h"

#endif /* TAO_TYPECODE_CASE_T_H */