00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Policy_Creator_T.h 00006 * 00007 * $Id: Policy_Creator_T.h 76561 2007-01-24 18:27:10Z elliott_c $ 00008 * 00009 * @author Johnny Willemsen <jwillemsen@remedy.nl> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_PORTABLESERVER_POLICY_CREATOR_T_H 00014 #define TAO_PORTABLESERVER_POLICY_CREATOR_T_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/ORB_Constants.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00025 00026 namespace TAO 00027 { 00028 namespace Portable_Server 00029 { 00030 template <class POLICYTYPE, typename POLICYVALUE> 00031 void create_policy ( 00032 POLICYTYPE *& policy, 00033 POLICYVALUE &value, 00034 const CORBA::Any& val 00035 ) 00036 { 00037 if ((val >>= value) == 0) 00038 throw CORBA::PolicyError (CORBA::BAD_POLICY_VALUE); 00039 00040 ACE_NEW_THROW_EX (policy, 00041 POLICYTYPE (value), 00042 CORBA::NO_MEMORY (TAO::VMCID, 00043 CORBA::COMPLETED_NO)); 00044 } 00045 } 00046 } 00047 00048 TAO_END_VERSIONED_NAMESPACE_DECL 00049 00050 #include /**/ "ace/post.h" 00051 00052 #endif /* TAO_PORTABLESERVER_POLICY_CREATOR_T_H */