summaryrefslogtreecommitdiff
path: root/TAO/tao/DynamicAny/DynAnyUtils_T.h
blob: f91d18b9f25b40947b5b2fbea2d02977adb77df8 (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file    DynAnyUtils_T.h
 *
 *  $Id$
 *
 *  Declaration of templatized common code used in Dynamic Any
 *
 *  @author Jeff Parsons <j.parsons@vanderbilt.edu>
 */
//=============================================================================

#ifndef TAO_DYNANYUTILS_T_H
#define TAO_DYNANYUTILS_T_H

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

#include "tao/DynamicAny/DynamicAny.h"

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

#include "tao/AnyTypeCode/BasicTypeTraits.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

class TAO_DynCommon;

namespace TAO
{
  // Encapsulates common code for inserting and extracting basic
  // types, parameterized on the basic type.
  template<typename T>
  struct DynAnyBasicTypeUtils
  {
    static void
    insert_value (const T &val,
                  TAO_DynCommon *the_dynany)
      ACE_THROW_SPEC ((
          CORBA::SystemException,
          DynamicAny::DynAny::TypeMismatch,
          DynamicAny::DynAny::InvalidValue
        ));

    static typename BasicTypeTraits<T>::return_type
    get_value (TAO_DynCommon *the_dynany)
      ACE_THROW_SPEC ((
          CORBA::SystemException,
          DynamicAny::DynAny::TypeMismatch,
          DynamicAny::DynAny::InvalidValue
        ));
  };

  // Encapsulates code that would otherwise be repeated in
  // TAO_DynCommon::set_flag(). Parameterized on the type
  // of dynany impl class that underlies the DynAny arg.
  template<typename T>
  struct DynAnyFlagUtils
  {
    static void
    set_flag_t (DynamicAny::DynAny_ptr component,
                CORBA::Boolean destroying)
      ACE_THROW_SPEC ((
          CORBA::SystemException
        ));
  };

  // Used by MakeDynAnyUtils below, parameterized on the type of
  // impl class and on {Any | TypeCode}.
  template<typename DA_IMPL, typename ANY_TC>
  struct CreateDynAnyUtils
  {
    static DynamicAny::DynAny_ptr
    create_dyn_any_t (ANY_TC any_tc);
  };

  // Code common to DynAnyFactory create_* calls, parameterized on
  // {Any | TypeCode}.
  namespace MakeDynAnyUtils
  {
    template<typename ANY_TC>
    DynamicAny::DynAny_ptr
    make_dyn_any_t (CORBA::TypeCode_ptr tc, ANY_TC any_tc);
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "tao/DynamicAny/DynAnyUtils_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("tao/DynamicAny/DynAnyUtils_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

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

#endif /* TAO_DYNANYUTILS_T_H */