summaryrefslogtreecommitdiff
path: root/TAO/tao/AnyTypeCode/String_TypeCode_Traits.h
blob: 2b921ddc93a9db9241133b394df510ddd7354d5f (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file    String_TypeCode_Traits.h
 *
 *  $Id$
 *
 *  Header file for bound
 *    @c tk_string,
 *    @c tk_wstring,
 *  @c CORBA::TypeCode factories.
 *
 *  @author Ossama Othman <ossama@dre.vanderbilt.edu>
 */
//=============================================================================

#ifndef TAO_STRING_TYPECODE_TRAITS_H
#define TAO_STRING_TYPECODE_TRAITS_H

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


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

#include "tao/AnyTypeCode/String_TypeCode.h"
#include "tao/AnyTypeCode/True_RefCount_Policy.h"


TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace TypeCodeFactory
  {
    template <typename T> struct String_Traits;

    template<>
    struct String_Traits<CORBA::Any::from_string>
    {
      static CORBA::TypeCode_ptr create_typecode (CORBA::TCKind kind,
                                                  CORBA::ULong bound)
      {
        typedef TAO::TypeCode::String<TAO::True_RefCount_Policy> typecode_type;

        CORBA::TypeCode_ptr tc = CORBA::TypeCode_ptr ();
        ACE_NEW_RETURN (tc,
                        typecode_type (kind, bound),
                        tc);

        return tc;
      }
    };

    template <>
    struct String_Traits<CORBA::Any::from_wstring>
    {
      static CORBA::TypeCode_ptr create_typecode (CORBA::TCKind kind,
                                                  CORBA::ULong bound)
      {
        typedef TAO::TypeCode::String<TAO::True_RefCount_Policy> typecode_type;

        CORBA::TypeCode_ptr tc = CORBA::TypeCode_ptr ();
        ACE_NEW_RETURN (tc,
                        typecode_type (kind, bound),
                        tc);

        return tc;
      }
    };

  }  // End namespace TypeCodeFactory
}  // End namespace TAO

TAO_END_VERSIONED_NAMESPACE_DECL

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

#endif /* TAO_STRING_TYPECODE_TRAITS_H */