rt_policy_i.cpp
来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 1,410 行 · 第 1/3 页
CPP
1,410 行
// RT_Policy_i.cpp,v 1.13 2003/09/24 14:02:58 bala Exp
#include "RT_Policy_i.h"
#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
#include "tao/ORB_Core.h"
#include "tao/Policy_Manager.h"
#include "tao/debug.h"
#if ! defined (__ACE_INLINE__)
#include "RT_Policy_i.i"
#endif /* __ACE_INLINE__ */
ACE_RCSID (TAO,
RT_Policy_i,
"RT_Policy_i.cpp,v 1.13 2003/09/24 14:02:58 bala Exp")
// ****************************************************************
TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (RTCORBA::PriorityModel priority_model,
RTCORBA::Priority server_priority)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::PriorityModelPolicy ()
, TAO_Local_RefCounted_Object ()
, priority_model_ (priority_model)
, server_priority_ (server_priority)
{
}
TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (const TAO_PriorityModelPolicy &rhs)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::PriorityModelPolicy ()
, TAO_Local_RefCounted_Object ()
, priority_model_ (rhs.priority_model_)
, server_priority_ (rhs.server_priority_)
{
}
TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (void)
: priority_model_ (RTCORBA::SERVER_DECLARED),
server_priority_ (0)
{
}
TAO_PriorityModelPolicy::~TAO_PriorityModelPolicy (void)
{
}
CORBA::Policy_ptr
TAO_PriorityModelPolicy::create (const CORBA::Any &
ACE_ENV_ARG_DECL)
{
/*
* @@ The following code should be changed once the OMG spec has
* been fixed such that a RTCORBA::PriorityModelPolicy can be
* created by using the ORB::create_policy interface.
*/
ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
CORBA::Policy::_nil ());
}
RTCORBA::PriorityModel
TAO_PriorityModelPolicy::get_priority_model (void)
{
return this->priority_model_;
}
RTCORBA::PriorityModel
TAO_PriorityModelPolicy::priority_model (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return this->priority_model_;
}
RTCORBA::Priority
TAO_PriorityModelPolicy::server_priority (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return this->server_priority_;
}
CORBA::PolicyType
TAO_PriorityModelPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return RTCORBA::PRIORITY_MODEL_POLICY_TYPE;
}
CORBA::Policy_ptr
TAO_PriorityModelPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_PriorityModelPolicy* tmp;
ACE_NEW_THROW_EX (tmp,
TAO_PriorityModelPolicy (*this),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (CORBA::Policy::_nil ());
return tmp;
}
void
TAO_PriorityModelPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
}
CORBA::Boolean
TAO_PriorityModelPolicy::_tao_encode (TAO_OutputCDR &out_cdr)
{
// Note: the fields are encoded according to
// the order specified in the RTCORBA 1.0 spec (ptc/99-05-03)
// section 4.7.3.
return ((out_cdr << priority_model_) && (out_cdr << server_priority_));
}
CORBA::Boolean
TAO_PriorityModelPolicy::_tao_decode (TAO_InputCDR &in_cdr)
{
return ((in_cdr >> priority_model_) && (in_cdr >> server_priority_));
}
TAO_Cached_Policy_Type
TAO_PriorityModelPolicy::_tao_cached_type (void) const
{
return TAO_CACHED_POLICY_PRIORITY_MODEL;
}
TAO_Policy_Scope
TAO_PriorityModelPolicy::_tao_scope (void) const
{
// Note that this policy is propogated to the client even though
// it is not specified here. The reason for this is that the
// server priority field is set dynamically depending on the model
// and the servant's priority. Therefore, it can't be simply
// copied to the list of client exposed policies.
return ACE_static_cast (TAO_Policy_Scope,
TAO_POLICY_ORB_SCOPE |
TAO_POLICY_POA_SCOPE |
TAO_POLICY_CLIENT_EXPOSED);
}
// ****************************************************************
TAO_ThreadpoolPolicy::TAO_ThreadpoolPolicy (RTCORBA::ThreadpoolId id)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::ThreadpoolPolicy ()
, TAO_Local_RefCounted_Object ()
, id_ (id)
{
}
TAO_ThreadpoolPolicy::TAO_ThreadpoolPolicy (const TAO_ThreadpoolPolicy &rhs)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::ThreadpoolPolicy ()
, TAO_Local_RefCounted_Object ()
, id_ (rhs.id_)
{
}
TAO_ThreadpoolPolicy::~TAO_ThreadpoolPolicy (void)
{
}
CORBA::Policy_ptr
TAO_ThreadpoolPolicy::create (const CORBA::Any &val
ACE_ENV_ARG_DECL)
{
RTCORBA::ThreadpoolId value;
if ((val >>= value) == 0)
ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
CORBA::Policy::_nil ());
TAO_ThreadpoolPolicy *tmp = 0;
ACE_NEW_THROW_EX (tmp,
TAO_ThreadpoolPolicy (value),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (CORBA::Policy::_nil ());
return tmp;
}
RTCORBA::ThreadpoolId
TAO_ThreadpoolPolicy::threadpool (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return this->id_;
}
CORBA::PolicyType
TAO_ThreadpoolPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return RTCORBA::THREADPOOL_POLICY_TYPE;
}
CORBA::Policy_ptr
TAO_ThreadpoolPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_ThreadpoolPolicy* tmp;
ACE_NEW_THROW_EX (tmp,
TAO_ThreadpoolPolicy (*this),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (CORBA::Policy::_nil ());
return tmp;
}
void
TAO_ThreadpoolPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
}
TAO_Cached_Policy_Type
TAO_ThreadpoolPolicy::_tao_cached_type (void) const
{
return TAO_CACHED_POLICY_THREADPOOL;
}
TAO_Policy_Scope
TAO_ThreadpoolPolicy::_tao_scope (void) const
{
return ACE_static_cast (TAO_Policy_Scope,
TAO_POLICY_ORB_SCOPE |
TAO_POLICY_POA_SCOPE);
}
// ****************************************************************
TAO_PrivateConnectionPolicy::TAO_PrivateConnectionPolicy (void)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::PrivateConnectionPolicy ()
, TAO_Local_RefCounted_Object ()
{
}
TAO_PrivateConnectionPolicy::TAO_PrivateConnectionPolicy (const TAO_PrivateConnectionPolicy &)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::PrivateConnectionPolicy ()
, TAO_Local_RefCounted_Object ()
{
}
TAO_PrivateConnectionPolicy::~TAO_PrivateConnectionPolicy (void)
{
}
CORBA::Policy_ptr
TAO_PrivateConnectionPolicy::create (const CORBA::Any &
ACE_ENV_ARG_DECL)
{
TAO_PrivateConnectionPolicy *tmp = 0;
ACE_NEW_THROW_EX (tmp,
TAO_PrivateConnectionPolicy (),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (CORBA::Policy::_nil ());
return tmp;
}
CORBA::PolicyType
TAO_PrivateConnectionPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE;
}
CORBA::Policy_ptr
TAO_PrivateConnectionPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_PrivateConnectionPolicy* tmp;
ACE_NEW_THROW_EX (tmp,
TAO_PrivateConnectionPolicy (*this),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (CORBA::Policy::_nil ());
return tmp;
}
void
TAO_PrivateConnectionPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
}
TAO_Cached_Policy_Type
TAO_PrivateConnectionPolicy::_tao_cached_type (void) const
{
return TAO_CACHED_POLICY_RT_PRIVATE_CONNECTION;
}
TAO_Policy_Scope
TAO_PrivateConnectionPolicy::_tao_scope (void) const
{
return ACE_static_cast (TAO_Policy_Scope,
TAO_POLICY_OBJECT_SCOPE |
TAO_POLICY_THREAD_SCOPE |
TAO_POLICY_ORB_SCOPE);
}
// ****************************************************************
TAO_PriorityBandedConnectionPolicy::TAO_PriorityBandedConnectionPolicy (const RTCORBA::PriorityBands &bands)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::PriorityBandedConnectionPolicy ()
, TAO_Local_RefCounted_Object ()
, priority_bands_ (bands)
{
}
TAO_PriorityBandedConnectionPolicy::TAO_PriorityBandedConnectionPolicy (const TAO_PriorityBandedConnectionPolicy &rhs)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::PriorityBandedConnectionPolicy ()
, TAO_Local_RefCounted_Object ()
, priority_bands_ (rhs.priority_bands_)
{
}
TAO_PriorityBandedConnectionPolicy::TAO_PriorityBandedConnectionPolicy (void)
{
}
TAO_PriorityBandedConnectionPolicy::~TAO_PriorityBandedConnectionPolicy (void)
{
}
CORBA::Policy_ptr
TAO_PriorityBandedConnectionPolicy::create (const CORBA::Any &val
ACE_ENV_ARG_DECL)
{
RTCORBA::PriorityBands *value = 0;
if ((val >>= value) == 0)
ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
CORBA::Policy::_nil ());
TAO_PriorityBandedConnectionPolicy *tmp = 0;
ACE_NEW_THROW_EX (tmp,
TAO_PriorityBandedConnectionPolicy (*value),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (CORBA::Policy::_nil ());
return tmp;
}
RTCORBA::PriorityBands *
TAO_PriorityBandedConnectionPolicy::priority_bands (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
RTCORBA::PriorityBands *tmp;
ACE_NEW_THROW_EX (tmp,
RTCORBA::PriorityBands (this->priority_bands_),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (0);
return tmp;
}
CORBA::PolicyType
TAO_PriorityBandedConnectionPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE;
}
CORBA::Policy_ptr
TAO_PriorityBandedConnectionPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_PriorityBandedConnectionPolicy *tmp;
ACE_NEW_THROW_EX (tmp,
TAO_PriorityBandedConnectionPolicy (*this),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (CORBA::Policy::_nil ());
return tmp;
}
void
TAO_PriorityBandedConnectionPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
}
CORBA::Boolean
TAO_PriorityBandedConnectionPolicy::_tao_encode (TAO_OutputCDR &out_cdr)
{
return out_cdr << priority_bands_;
}
CORBA::Boolean
TAO_PriorityBandedConnectionPolicy::_tao_decode (TAO_InputCDR &in_cdr)
{
return in_cdr >> priority_bands_;
}
TAO_Cached_Policy_Type
TAO_PriorityBandedConnectionPolicy::_tao_cached_type (void) const
{
return TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION;
}
TAO_Policy_Scope
TAO_PriorityBandedConnectionPolicy::_tao_scope (void) const
{
return ACE_static_cast (TAO_Policy_Scope,
TAO_POLICY_DEFAULT_SCOPE |
TAO_POLICY_CLIENT_EXPOSED);
}
RTCORBA::PriorityBands &
TAO_PriorityBandedConnectionPolicy::priority_bands_rep (void)
{
return priority_bands_;
}
// ****************************************************************
TAO_ServerProtocolPolicy::TAO_ServerProtocolPolicy (const RTCORBA::ProtocolList &protocols)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::ServerProtocolPolicy ()
, TAO_Local_RefCounted_Object ()
, protocols_ (protocols)
{
}
TAO_ServerProtocolPolicy::TAO_ServerProtocolPolicy (const TAO_ServerProtocolPolicy &rhs)
: ACE_NESTED_CLASS (CORBA, Object) ()
, ACE_NESTED_CLASS (CORBA, Policy) ()
, ACE_NESTED_CLASS (CORBA, LocalObject) ()
, RTCORBA::ServerProtocolPolicy ()
, TAO_Local_RefCounted_Object ()
, protocols_ (rhs.protocols_)
{
}
TAO_ServerProtocolPolicy::~TAO_ServerProtocolPolicy (void)
{
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?