Any_Insert_Policy_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Any_Insert_Policy_T.h
00006  *
00007  *  Any_Insert_Policy_T.h,v 1.11 2006/06/20 05:37:55 jwillemsen Exp
00008  *
00009  *  @author Johnny Willemsen  <jwillemsen@remedy.nl>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_ANY_INSERT_POLICY_H
00014 #define TAO_ANY_INSERT_POLICY_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/UB_String_Argument_T.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "tao/Arg_Traits_T.h"
00025 #include "tao/Argument.h"
00026 #include "tao/AnyTypeCode_Adapter.h"
00027 
00028 #include "ace/Dynamic_Service.h"
00029 #include "ace/Log_Msg.h"
00030 #include "tao/debug.h"
00031 #include "tao/IFR_Client_Adapter.h"
00032 
00033 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00034 
00035 namespace TAO
00036 {
00037   template <typename S>
00038   class Any_Insert_Policy_Stream
00039   {
00040   public:
00041 
00042     static inline void any_insert (CORBA::Any* p, S const & x)
00043       {
00044         (*p) <<= x;
00045       }
00046   };
00047 
00048   template <typename S>
00049   class Any_Insert_Policy_AnyTypeCode_Adapter
00050   {
00051   public:
00052 
00053     static inline void any_insert (CORBA::Any* p, S const & x)
00054       {
00055         TAO_AnyTypeCode_Adapter *adapter =
00056           ACE_Dynamic_Service<TAO_AnyTypeCode_Adapter>::instance (
00057               "AnyTypeCode_Adapter"
00058           );
00059 
00060         if (adapter)
00061           {
00062             adapter->insert_into_any (p, x);
00063           }
00064         else
00065           {
00066             ACE_ERROR ((LM_ERROR,
00067                         ACE_TEXT ("(%P|%t) %p\n"),
00068                         ACE_TEXT ("ERROR: unable to find AnyTypeCode Adapter ")));
00069           }
00070       }
00071   };
00072 
00073   template <typename S>
00074   class Any_Insert_Policy_IFR_Client_Adapter
00075   {
00076   public:
00077 
00078     static inline void any_insert (CORBA::Any* p, S const & x)
00079       {
00080         TAO_IFR_Client_Adapter *adapter =
00081           ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
00082               "Concrete_IFR_Client_Adapter"
00083             );
00084 
00085         adapter->interfacedef_any_insert (p, x);
00086       }
00087   };
00088 
00089   template <typename S>
00090   class Any_Insert_Policy_Noop
00091   {
00092   public:
00093     static inline void any_insert (CORBA::Any* , S const &)
00094       {
00095       }
00096   };
00097 
00098   template <typename S>
00099   class Any_Insert_Policy_CORBA_Object
00100   {
00101   public:
00102 
00103     static inline void any_insert (CORBA::Any* , S const &)
00104       {
00105         if (TAO_debug_level > 2)
00106           {
00107             ACE_DEBUG ((LM_DEBUG,
00108                         "TAO (%P|%t) - Cannot insert a vanilla CORBA Object"
00109                         " into an Any for returning the return value.\n"));
00110           }
00111       }
00112   };
00113 }
00114 
00115 TAO_END_VERSIONED_NAMESPACE_DECL
00116 
00117 #include /**/ "ace/post.h"
00118 
00119 #endif /* TAO_ANY_INSERT_POLICY_H */

Generated on Thu Nov 9 11:54:07 2006 for TAO by doxygen 1.3.6