Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tao / PI_Server / Policy_Creator_T.h
blobacbc65f09755ed3cb86297a75962d5e972816df5
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Policy_Creator_T.h
7 * @author Johnny Willemsen <jwillemsen@remedy.nl>
8 */
9 //=============================================================================
11 #ifndef TAO_PORTABLESERVER_POLICY_CREATOR_T_H
12 #define TAO_PORTABLESERVER_POLICY_CREATOR_T_H
14 #include /**/ "ace/pre.h"
16 #include "tao/ORB_Constants.h"
17 #include "tao/PolicyC.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
25 namespace TAO
27 namespace Portable_Server
29 template <class POLICYTYPE, typename POLICYVALUE>
30 void create_policy (
31 POLICYTYPE *& policy,
32 POLICYVALUE &value,
33 const CORBA::Any& val
36 if ((val >>= value) == 0)
37 throw CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
39 ACE_NEW_THROW_EX (policy,
40 POLICYTYPE (value),
41 CORBA::NO_MEMORY (TAO::VMCID,
42 CORBA::COMPLETED_NO));
47 TAO_END_VERSIONED_NAMESPACE_DECL
49 #include /**/ "ace/post.h"
51 #endif /* TAO_PORTABLESERVER_POLICY_CREATOR_T_H */