Use =default for skeleton copy constructor
[ACE_TAO.git] / TAO / tao / DiffServPolicy / DiffServPolicy_Factory.cpp
blobe02ea24553624df4917fbbedecb1d5e51870118c
1 // -*- C++ -*-
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
10 CORBA::Policy_ptr
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);
24 CORBA::Policy_ptr
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 (),
33 CORBA::NO_MEMORY (
34 CORBA::SystemException::_tao_minor_code (
35 TAO::VMCID,
36 ENOMEM),
37 CORBA::COMPLETED_NO));
39 return policy;
42 if (type == TAO::NETWORK_PRIORITY_TYPE)
44 ACE_NEW_THROW_EX (policy,
45 TAO_Server_Network_Priority_Policy (),
46 CORBA::NO_MEMORY (
47 CORBA::SystemException::_tao_minor_code (
48 TAO::VMCID,
49 ENOMEM),
50 CORBA::COMPLETED_NO));
52 return policy;
55 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
58 TAO_END_VERSIONED_NAMESPACE_DECL