2 #include "tao/BiDir_GIOP/BiDir_PolicyFactory.h"
3 #include "tao/BiDir_GIOP/BiDirGIOP.h"
4 #include "tao/BiDir_GIOP/BiDir_Policy_i.h"
5 #include "tao/ORB_Constants.h"
6 #include "tao/AnyTypeCode/Any.h"
7 #include "ace/CORBA_macros.h"
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
12 TAO_BiDir_PolicyFactory::create_policy (
13 CORBA::PolicyType type
,
14 const CORBA::Any
&value
)
16 CORBA::Policy_ptr policy
= CORBA::Policy_ptr ();
18 if (type
== BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE
)
20 BiDirPolicy::BidirectionalPolicyValue val
;
22 // Extract the value from the any.
23 if ((value
>>= val
) == 0)
25 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE
);
28 ACE_NEW_THROW_EX (policy
,
29 TAO_BidirectionalPolicy (val
),
31 CORBA::SystemException::_tao_minor_code (
34 CORBA::COMPLETED_NO
));
39 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE
);
42 TAO_END_VERSIONED_NAMESPACE_DECL