1 #include "tao/PI/PI_PolicyFactory.h"
3 #if TAO_HAS_INTERCEPTORS == 1
5 #include "tao/PI/ProcessingModePolicy.h"
6 #include "tao/ORB_Constants.h"
7 #include "tao/SystemException.h"
8 #include "ace/CORBA_macros.h"
10 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 TAO_PI_PolicyFactory::create_policy (
14 CORBA::PolicyType type
,
15 const CORBA::Any
&value
)
17 if (type
== PortableInterceptor::PROCESSING_MODE_POLICY_TYPE
)
19 TAO_ProcessingModePolicy
*processing_mode_policy
= 0;
20 PortableInterceptor::ProcessingMode policy_value
;
22 if ((value
>>= policy_value
) == 0)
24 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE
);
27 ACE_NEW_THROW_EX (processing_mode_policy
,
28 TAO_ProcessingModePolicy (policy_value
),
29 CORBA::NO_MEMORY (TAO::VMCID
,
30 CORBA::COMPLETED_NO
));
32 return processing_mode_policy
;
35 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE
);
38 TAO_END_VERSIONED_NAMESPACE_DECL
40 #endif /* TAO_HAS_INTERCEPTORS == 1 */