Go to the documentation of this file.00001 #include "tao/DiffServPolicy/DiffServPolicy_Factory.h"
00002
00003 ACE_RCSID (DiffServPolicy,
00004 DiffServPolicy_Factory,
00005 "$Id: DiffServPolicy_Factory.cpp 77167 2007-02-16 16:41:53Z jai $")
00006
00007 #include "tao/DiffServPolicy/Client_Network_Priority_Policy.h"
00008 #include "tao/DiffServPolicy/Server_Network_Priority_Policy.h"
00009 #include "tao/PolicyC.h"
00010 #include "tao/ORB_Constants.h"
00011
00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00013
00014 CORBA::Policy_ptr
00015 TAO_DiffServ_PolicyFactory::create_policy (
00016 CORBA::PolicyType type,
00017 const CORBA::Any &value)
00018 {
00019 if (type == TAO::CLIENT_NETWORK_PRIORITY_TYPE)
00020 return TAO_Client_Network_Priority_Policy::create (value);
00021
00022 if (type == TAO::NETWORK_PRIORITY_TYPE)
00023 return TAO_Server_Network_Priority_Policy::create (value);
00024
00025 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
00026 }
00027
00028 CORBA::Policy_ptr
00029 TAO_DiffServ_PolicyFactory::_create_policy (CORBA::PolicyType type)
00030 {
00031 CORBA::Policy_ptr policy = CORBA::Policy::_nil ();
00032
00033 if (type == TAO::CLIENT_NETWORK_PRIORITY_TYPE)
00034 {
00035 ACE_NEW_THROW_EX (policy,
00036 TAO_Client_Network_Priority_Policy (),
00037 CORBA::NO_MEMORY (
00038 CORBA::SystemException::_tao_minor_code (
00039 TAO::VMCID,
00040 ENOMEM),
00041 CORBA::COMPLETED_NO));
00042
00043 return policy;
00044 }
00045
00046 if (type == TAO::NETWORK_PRIORITY_TYPE)
00047 {
00048 ACE_NEW_THROW_EX (policy,
00049 TAO_Server_Network_Priority_Policy (),
00050 CORBA::NO_MEMORY (
00051 CORBA::SystemException::_tao_minor_code (
00052 TAO::VMCID,
00053 ENOMEM),
00054 CORBA::COMPLETED_NO));
00055
00056 return policy;
00057 }
00058
00059 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
00060 }
00061
00062 TAO_END_VERSIONED_NAMESPACE_DECL