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

//=============================================================================
/**
 *  @file    DynAnyUtils_T.h
 *
 *  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);

    static typename BasicTypeTraits<T>::return_type
    get_value (TAO_DynCommon *the_dynany);
  };

  // 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);
  };

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

    static DynamicAny::DynAny_ptr
      create_dyn_any_t (
        CORBA::TypeCode_ptr tc,
        ANY_TC any_tc,
        CORBA::Boolean allow_truncation= true);
  };

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

TAO_END_VERSIONED_NAMESPACE_DECL

#include "tao/DynamicAny/DynAnyUtils_T.cpp"

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

#endif /* TAO_DYNANYUTILS_T_H */