Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / RTCORBA / RT_PolicyFactory.cpp
blob4c5dc4ae6055d2e438e1f7dd80898cf086838b7c
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
11 CORBA::Policy_ptr
12 TAO_RT_PolicyFactory::create_policy (
13 CORBA::PolicyType type,
14 const CORBA::Any &value)
16 switch (type)
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);
35 CORBA::Policy_ptr
36 TAO_RT_PolicyFactory::_create_policy (CORBA::PolicyType type)
38 CORBA::Policy_ptr policy = CORBA::Policy_ptr ();
40 switch (type)
42 case RTCORBA::PRIORITY_MODEL_POLICY_TYPE :
44 ACE_NEW_THROW_EX (policy,
45 TAO_PriorityModelPolicy,
46 CORBA::NO_MEMORY (
47 CORBA::SystemException::_tao_minor_code (
48 TAO::VMCID,
49 ENOMEM),
50 CORBA::COMPLETED_NO));
52 return policy;
54 break;
55 case RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE :
57 ACE_NEW_THROW_EX (policy,
58 TAO_PriorityBandedConnectionPolicy,
59 CORBA::NO_MEMORY (
60 CORBA::SystemException::_tao_minor_code (
61 TAO::VMCID,
62 ENOMEM),
63 CORBA::COMPLETED_NO));
65 return policy;
67 break;
68 case RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE :
70 ACE_NEW_THROW_EX (policy,
71 TAO_ClientProtocolPolicy,
72 CORBA::NO_MEMORY (
73 CORBA::SystemException::_tao_minor_code (
74 TAO::VMCID,
75 ENOMEM),
76 CORBA::COMPLETED_NO));
78 return policy;
80 break;
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 */