1 #include "tao/RTCORBA/RT_PolicyFactory.h"
3 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
5 #include "tao/RTCORBA/RT_Policy_i.h"
6 #include "tao/PolicyC.h"
7 #include "tao/ORB_Constants.h"
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
12 TAO_RT_PolicyFactory::create_policy (
13 CORBA::PolicyType type
,
14 const CORBA::Any
&value
)
18 case RTCORBA::PRIORITY_MODEL_POLICY_TYPE
:
19 return TAO_PriorityModelPolicy::create (value
);
20 case RTCORBA::THREADPOOL_POLICY_TYPE
:
21 return TAO_ThreadpoolPolicy::create (value
);
22 case RTCORBA::SERVER_PROTOCOL_POLICY_TYPE
:
23 return TAO_ServerProtocolPolicy::create (value
);
24 case RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE
:
25 return TAO_ClientProtocolPolicy::create (value
);
26 case RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE
:
27 return TAO_PrivateConnectionPolicy::create (value
);
28 case RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE
:
29 return TAO_PriorityBandedConnectionPolicy::create (value
);
32 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE
);
36 TAO_RT_PolicyFactory::_create_policy (CORBA::PolicyType type
)
38 CORBA::Policy_ptr policy
= CORBA::Policy_ptr ();
42 case RTCORBA::PRIORITY_MODEL_POLICY_TYPE
:
44 ACE_NEW_THROW_EX (policy
,
45 TAO_PriorityModelPolicy
,
47 CORBA::SystemException::_tao_minor_code (
50 CORBA::COMPLETED_NO
));
55 case RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE
:
57 ACE_NEW_THROW_EX (policy
,
58 TAO_PriorityBandedConnectionPolicy
,
60 CORBA::SystemException::_tao_minor_code (
63 CORBA::COMPLETED_NO
));
68 case RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE
:
70 ACE_NEW_THROW_EX (policy
,
71 TAO_ClientProtocolPolicy
,
73 CORBA::SystemException::_tao_minor_code (
76 CORBA::COMPLETED_NO
));
83 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE
);
86 TAO_END_VERSIONED_NAMESPACE_DECL
88 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */