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

// $Id$

// =========================================================================
//
// = LIBRARY
//    TAO_DynamicAny
//
// = FILENAME
//    DynAnyFactory.h
//
// = AUTHOR
//    Carlos O'Ryan <coryan@uci.edu>
//
// =========================================================================

#ifndef TAO_DYNANYFACTORY_H
#define TAO_DYNANYFACTORY_H
#include "ace/pre.h"

#include "DynamicAny.h"

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

#if defined (_MSC_VER)
# if (_MSC_VER >= 1200)
#  pragma warning(push)
# endif /* _MSC_VER >= 1200 */
# pragma warning (disable:4250)
#endif /* _MSC_VER */

class TAO_DynamicAny_Export TAO_DynAnyFactory 
  : public virtual DynamicAny::DynAnyFactory, 
    public virtual TAO_Local_RefCounted_Object
{
  // = DESCRIPTION
  //   Implements the DynamicAnyFactory interface and provides several
  //   utility functions shared by all the Dynamic Any components.
  //
public:
  TAO_DynAnyFactory (void);
  // Constructor.

  static CORBA::TCKind unalias (CORBA_TypeCode_ptr tc,
                                CORBA::Environment &ACE_TRY_ENV);
  // Obtain the kind of object, after all aliasing has been removed.

  static CORBA_TypeCode_ptr strip_alias (CORBA_TypeCode_ptr tc,
                                         CORBA::Environment &ACE_TRY_ENV);
  // Same as above, but returns type code instead of TCKind. Caller
  // must release the return value.

  static DynamicAny::DynAny_ptr
     make_dyn_any (const CORBA_Any &any,
                   CORBA::Environment &ACE_TRY_ENV);
  // Create the correct type of DynAny object for <any>.

  static DynamicAny::DynAny_ptr
     make_dyn_any (CORBA::TypeCode_ptr tc,
                   CORBA::Environment &ACE_TRY_ENV);
  // Create the correct type of DynAny object for <tc>

  // = The DynamicAnyFactory methods.
  virtual DynamicAny::DynAny_ptr create_dyn_any (
      const CORBA::Any & value,
      CORBA::Environment &ACE_TRY_ENV =
        TAO_default_environment ()
    )
    ACE_THROW_SPEC ((
        CORBA::SystemException,
        DynamicAny::DynAnyFactory::InconsistentTypeCode
      ));

  virtual DynamicAny::DynAny_ptr create_dyn_any_from_type_code (
      CORBA::TypeCode_ptr type,
      CORBA::Environment &ACE_TRY_ENV =
        TAO_default_environment ()
    )
    ACE_THROW_SPEC ((
        CORBA::SystemException,
        DynamicAny::DynAnyFactory::InconsistentTypeCode
      ));

private:
  // Not allowed.
  TAO_DynAnyFactory (const TAO_DynAnyFactory &src);
  TAO_DynAnyFactory &operator= (const TAO_DynAnyFactory &src);
};

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma warning(pop)
#endif /* _MSC_VER */

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