blob: 137b00ac8a8246d6992d36723e97bec0dd914470 (
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
|
// $Id$
#ifndef TAO_TYPECODE_CASE_CPP
#define TAO_TYPECODE_CASE_CPP
#include "TypeCode_Case.h"
#include "tao/CDR.h"
#include "tao/Any.h"
#ifndef __ACE_INLINE__
# include "tao/TypeCode_Case.inl"
#endif /* __ACE_INLINE__ */
namespace TAO
{
namespace TypeCode
{
template <typename T>
struct Case_Traits
{
inline static T any_from (T v)
{
return v;
}
};
// Specializations for types that require wrapper for Any
// insertion. Note that we only define specializations for types
// that can be used in an IDL union discriminator.
template <>
struct Case_Traits<CORBA::Boolean>
{
inline static CORBA::Any::from_boolean any_from (CORBA::Boolean v)
{
return CORBA::Any::from_boolean (v);
}
};
template <>
struct Case_Traits<CORBA::Char>
{
inline static CORBA::Any::from_char any_from (CORBA::Char v)
{
return CORBA::Any::from_char (v);
}
};
template <>
struct Case_Traits<CORBA::WChar>
{
inline static CORBA::Any::from_wchar any_from (CORBA::WChar v)
{
return CORBA::Any::from_wchar (v);
}
};
} // End TypeCode namespace
} // End TAO namespace
// ----------------------------------------------------------------
template <typename DISCRIMINATOR_TYPE, typename STRING_TYPE>
bool
TAO::TypeCode::Case<DISCRIMINATOR_TYPE, STRING_TYPE>::marshal_label (
TAO_OutputCDR & cdr) const
{
return (cdr << this->label_);
}
template <typename DISCRIMINATOR_TYPE, typename STRING_TYPE>
CORBA::Any *
TAO::TypeCode::Case<DISCRIMINATOR_TYPE, STRING_TYPE>::label (
ACE_ENV_SINGLE_ARG_DECL) const
{
CORBA::Any * value;
ACE_NEW_THROW_EX (value,
CORBA::Any,
CORBA::NO_MEMORY ());
ACE_CHECK_RETURN (0);
CORBA::Any_var safe_value (value);
*value <<=
TAO::TypeCode::Case_Traits<DISCRIMINATOR_TYPE>::any_from (this->label_);
return safe_value._retn ();
}
#endif /* TAO_TYPECODE_CASE_CPP */
|