summaryrefslogtreecommitdiff
path: root/TAO/tao/Union_TypeCode.inl
blob: 24537112597b00a6bec16ac499e7937f6e4dd711 (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
// -*- C++ -*-
//
// $Id$

template <typename StringType,
          typename TypeCodeType,
          class CaseArrayType,
          class RefCountPolicy>
ACE_INLINE
TAO::TypeCode::Union<StringType,
                     TypeCodeType,
                     CaseArrayType,
                     RefCountPolicy>::Union (
  char const * id,
  char const * name,
  TypeCodeType const & discriminant_type,
  CaseArrayType const & cases,
  CORBA::ULong ncases,
  CORBA::Long default_index)
  : CORBA::TypeCode (CORBA::tk_union)
  , RefCountPolicy ()
  , base_attributes_ (id, name)
  , discriminant_type_ (discriminant_type)
  , default_index_ (default_index)
  , ncases_ (ncases)
  , cases_ (cases)
{
}

template <typename StringType,
          typename TypeCodeType,
          typename CaseArrayType,
          class RefCountPolicy>
ACE_INLINE CORBA::ULong
TAO::TypeCode::Union<StringType,
                     TypeCodeType,
                     CaseArrayType,
                     RefCountPolicy>::case_count (void) const
{
  return this->ncases_;
}

template <typename StringType,
          typename TypeCodeType,
          typename CaseArrayType,
          class RefCountPolicy>
ACE_INLINE typename TAO::TypeCode::Union<StringType,
                                         TypeCodeType,
                                         CaseArrayType,
                                         RefCountPolicy>::case_type const &
TAO::TypeCode::Union<StringType,
                     TypeCodeType,
                     CaseArrayType,
                     RefCountPolicy>::the_case (CORBA::ULong index) const
{
  return *this->cases_[index];
}