RT_PolicyFactory.cpp

Go to the documentation of this file.
00001 #include "tao/RTCORBA/RT_PolicyFactory.h"
00002 
00003 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00004 
00005 ACE_RCSID (RTCORBA,
00006            RT_PolicyFactory,
00007            "RT_PolicyFactory.cpp,v 1.13 2006/03/10 07:19:16 jtc Exp")
00008 
00009 #include "tao/RTCORBA/RT_Policy_i.h"
00010 
00011 #include "tao/PolicyC.h"
00012 #include "tao/ORB_Constants.h"
00013 
00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 CORBA::Policy_ptr
00017 TAO_RT_PolicyFactory::create_policy (
00018     CORBA::PolicyType type,
00019     const CORBA::Any &value
00020     ACE_ENV_ARG_DECL)
00021   ACE_THROW_SPEC ((CORBA::SystemException,
00022                    CORBA::PolicyError))
00023 {
00024   if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
00025     return TAO_PriorityModelPolicy::create (value
00026                                             ACE_ENV_ARG_PARAMETER);
00027 
00028   if (type == RTCORBA::THREADPOOL_POLICY_TYPE)
00029     return TAO_ThreadpoolPolicy::create (value
00030                                          ACE_ENV_ARG_PARAMETER);
00031 
00032   if (type == RTCORBA::SERVER_PROTOCOL_POLICY_TYPE)
00033     return TAO_ServerProtocolPolicy::create (value
00034                                              ACE_ENV_ARG_PARAMETER);
00035 
00036   if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
00037     return TAO_ClientProtocolPolicy::create (value
00038                                              ACE_ENV_ARG_PARAMETER);
00039 
00040   if (type == RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE)
00041     return TAO_PrivateConnectionPolicy::create (value
00042                                                 ACE_ENV_ARG_PARAMETER);
00043 
00044   if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
00045     return TAO_PriorityBandedConnectionPolicy::create (value
00046                                                        ACE_ENV_ARG_PARAMETER);
00047 
00048   ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
00049                     CORBA::Policy::_nil ());
00050 }
00051 
00052 CORBA::Policy_ptr
00053 TAO_RT_PolicyFactory::_create_policy (
00054     CORBA::PolicyType type
00055     ACE_ENV_ARG_DECL)
00056   ACE_THROW_SPEC ((CORBA::SystemException,
00057                    CORBA::PolicyError))
00058 {
00059   CORBA::Policy_ptr policy = CORBA::Policy::_nil ();
00060 
00061   if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
00062     {
00063       ACE_NEW_THROW_EX (policy,
00064                         TAO_PriorityModelPolicy,
00065                         CORBA::NO_MEMORY (
00066                           CORBA::SystemException::_tao_minor_code (
00067                             TAO::VMCID,
00068                             ENOMEM),
00069                           CORBA::COMPLETED_NO));
00070       ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00071 
00072       return policy;
00073     }
00074 
00075   if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
00076     {
00077       ACE_NEW_THROW_EX (policy,
00078                         TAO_PriorityBandedConnectionPolicy,
00079                         CORBA::NO_MEMORY (
00080                           CORBA::SystemException::_tao_minor_code (
00081                             TAO::VMCID,
00082                             ENOMEM),
00083                           CORBA::COMPLETED_NO));
00084       ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00085 
00086       return policy;
00087     }
00088 
00089   if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
00090     {
00091       ACE_NEW_THROW_EX (policy,
00092                         TAO_ClientProtocolPolicy,
00093                         CORBA::NO_MEMORY (
00094                           CORBA::SystemException::_tao_minor_code (
00095                             TAO::VMCID,
00096                             ENOMEM),
00097                           CORBA::COMPLETED_NO));
00098       ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00099 
00100       return policy;
00101     }
00102 
00103   ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
00104                     CORBA::Policy::_nil ());
00105 }
00106 
00107 TAO_END_VERSIONED_NAMESPACE_DECL
00108 
00109 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */

Generated on Thu Nov 9 12:58:01 2006 for TAO_RTCORBA by doxygen 1.3.6