2 #include "tao/DiffServPolicy/DiffServPolicy_Factory.h"
3 #include "tao/DiffServPolicy/Client_Network_Priority_Policy.h"
4 #include "tao/DiffServPolicy/Server_Network_Priority_Policy.h"
5 #include "tao/PolicyC.h"
6 #include "tao/ORB_Constants.h"
8 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
11 TAO_DiffServ_PolicyFactory::create_policy (
12 CORBA::PolicyType type
,
13 const CORBA::Any
&value
)
15 if (type
== TAO::CLIENT_NETWORK_PRIORITY_TYPE
)
16 return TAO_Client_Network_Priority_Policy::create (value
);
18 if (type
== TAO::NETWORK_PRIORITY_TYPE
)
19 return TAO_Server_Network_Priority_Policy::create (value
);
21 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE
);
25 TAO_DiffServ_PolicyFactory::_create_policy (CORBA::PolicyType type
)
27 CORBA::Policy_ptr policy
= CORBA::Policy::_nil ();
29 if (type
== TAO::CLIENT_NETWORK_PRIORITY_TYPE
)
31 ACE_NEW_THROW_EX (policy
,
32 TAO_Client_Network_Priority_Policy (),
34 CORBA::SystemException::_tao_minor_code (
37 CORBA::COMPLETED_NO
));
42 if (type
== TAO::NETWORK_PRIORITY_TYPE
)
44 ACE_NEW_THROW_EX (policy
,
45 TAO_Server_Network_Priority_Policy (),
47 CORBA::SystemException::_tao_minor_code (
50 CORBA::COMPLETED_NO
));
55 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE
);
58 TAO_END_VERSIONED_NAMESPACE_DECL