Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Any_Insert_Policy_T.h
blob8fb6594831119259873dd9d8ebe5cda44152973f
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Any_Insert_Policy_T.h
7 * @author Johnny Willemsen <jwillemsen@remedy.nl>
8 */
9 //=============================================================================
11 #ifndef TAO_ANY_INSERT_POLICY_H
12 #define TAO_ANY_INSERT_POLICY_H
14 #include /**/ "ace/pre.h"
16 #include "tao/UB_String_Argument_T.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/Arg_Traits_T.h"
23 #include "tao/Argument.h"
24 #include "tao/AnyTypeCode_Adapter.h"
26 #include "ace/Dynamic_Service.h"
27 #include "ace/Log_Msg.h"
28 #include "tao/debug.h"
29 #include "tao/IFR_Client_Adapter.h"
31 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
33 namespace TAO
35 template <typename S>
36 class Any_Insert_Policy_Stream
38 public:
39 static inline void any_insert (CORBA::Any* p, S const & x)
41 (*p) <<= x;
45 template <typename S>
46 class Any_Insert_Policy_AnyTypeCode_Adapter
48 public:
49 static inline void any_insert (CORBA::Any* p, S const & x)
51 TAO_AnyTypeCode_Adapter *adapter =
52 ACE_Dynamic_Service<TAO_AnyTypeCode_Adapter>::instance (
53 "AnyTypeCode_Adapter");
55 if (adapter)
57 adapter->insert_into_any (p, x);
59 else
61 TAOLIB_ERROR ((LM_ERROR,
62 ACE_TEXT ("(%P|%t) %p\n"),
63 ACE_TEXT ("ERROR: unable to find AnyTypeCode Adapter ")));
68 template <typename S>
69 class Any_Insert_Policy_IFR_Client_Adapter
71 public:
72 static inline void any_insert (CORBA::Any* p, S const & x)
74 TAO_IFR_Client_Adapter *adapter =
75 ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
76 "Concrete_IFR_Client_Adapter");
78 adapter->interfacedef_any_insert (p, x);
82 template <typename S>
83 class Any_Insert_Policy_Noop
85 public:
86 static inline void any_insert (CORBA::Any* , S const &)
91 template <typename S>
92 class Any_Insert_Policy_CORBA_Object
94 public:
95 static inline void any_insert (CORBA::Any* , S const &)
97 if (TAO_debug_level > 2)
99 TAOLIB_DEBUG ((LM_DEBUG,
100 "TAO (%P|%t) - Cannot insert a vanilla CORBA Object"
101 " into an Any for returning the return value.\n"));
107 TAO_END_VERSIONED_NAMESPACE_DECL
109 #include /**/ "ace/post.h"
111 #endif /* TAO_ANY_INSERT_POLICY_H */