rt_policy_i.h

来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C头文件 代码 · 共 749 行 · 第 1/2 页

H
749
字号
/* -*- C++ -*- */
//=============================================================================
/**
 *  @file   RT_Policy_i.h
 *
 *  RT_Policy_i.h,v 1.9 2003/10/28 18:29:32 bala Exp
 *
 *  @author Marina Spivak (marina@cs.wustl.edu)
 */
//=============================================================================


#ifndef TAO_RT_POLICY_I_H
#define TAO_RT_POLICY_I_H

#include /**/ "ace/pre.h"

#include "tao/orbconf.h"

#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#define TAO_RTCORBA_SAFE_INCLUDE
#include "RTCORBAC.h"
#undef TAO_RTCORBA_SAFE_INCLUDE

#include "tao/LocalObject.h"
#include "tao/Basic_Types.h"

#include "ace/SString.h"

#if defined(_MSC_VER)
#if (_MSC_VER >= 1200)
#pragma warning(push)
#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */


/**
 * @class TAO_PriorityModelPolicy
 *
 * @brief RTCORBA::PriorityModelPolicy implementation
 *
 * This policy controls how the priority at which a server handles
 * requests from clients is determined.
 */
class TAO_RTCORBA_Export TAO_PriorityModelPolicy
  : public RTCORBA::PriorityModelPolicy,
    public TAO_Local_RefCounted_Object
{
public:
  /// Constructor.
  TAO_PriorityModelPolicy (RTCORBA::PriorityModel priority_model,
                           RTCORBA::Priority server_priority);

  /// Copy constructor.
  TAO_PriorityModelPolicy (const TAO_PriorityModelPolicy &rhs);

  /**
   * Accessor for the <priority_model_> attribute.  This method is
   * used internally by the orb.  This is a more efficient
   * (non-virtual, no exception handling) relative of the idl interface
   * implementation <priority_model> below.
   */
  RTCORBA::PriorityModel get_priority_model (void);

  RTCORBA::PriorityModel priority_model (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  RTCORBA::Priority server_priority (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  /// This method writes a CDR representation of the object state.
  CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);

  /// This method reads the object state from a CDR representation.
  CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);

  // Return the cached policy type for this policy.
  TAO_Cached_Policy_Type _tao_cached_type (void) const;

  // Returns the scope at which this policy can be applied. See orbconf.h.
  TAO_Policy_Scope _tao_scope (void) const;

  /// Helper method for the implementation of
  /// CORBA::ORB::create_policy.
  static CORBA::Policy_ptr create (const CORBA::Any &val
                                   ACE_ENV_ARG_DECL);

protected:

  /// Protected destructor to enforce proper memory management of this
  /// reference counted object.
  virtual ~TAO_PriorityModelPolicy (void);

  /// This constructor is used by TAO_RT_PolicyFactory when decoding
  /// policies from tagged components in an IOR.
  friend class TAO_RT_PolicyFactory;
  TAO_PriorityModelPolicy (void);

private:

  /// Attributes.
  RTCORBA::PriorityModel priority_model_;
  RTCORBA::Priority server_priority_;
};

//*************************************************************************

/**
 * @class TAO_ThreadpoolPolicy
 *
 * @brief RTCORBA::ThreadpoolPolicy implementation
 *
 * This policy controls which threadpool is associated with a POA.
 */
class TAO_RTCORBA_Export TAO_ThreadpoolPolicy
  : public RTCORBA::ThreadpoolPolicy,
    public TAO_Local_RefCounted_Object
{
public:
  /// Constructor.
  TAO_ThreadpoolPolicy (RTCORBA::ThreadpoolId id);

  /// Copy constructor.
  TAO_ThreadpoolPolicy (const TAO_ThreadpoolPolicy &rhs);

  RTCORBA::ThreadpoolId threadpool (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  // Return the cached policy type for this policy.
  TAO_Cached_Policy_Type _tao_cached_type (void) const;

  // Returns the scope at which this policy can be applied. See orbconf.h.
  TAO_Policy_Scope _tao_scope (void) const;

  /// Helper method for the implementation of
  /// CORBA::ORB::create_policy.
  static CORBA::Policy_ptr create (const CORBA::Any &val
                                   ACE_ENV_ARG_DECL);

protected:

  /// Protected destructor to enforce proper memory management of this
  /// reference counted object.
  virtual ~TAO_ThreadpoolPolicy (void);

private:

  /// Attribute.
  RTCORBA::ThreadpoolId id_;
};

//*************************************************************************

/**
 * @class TAO_PrivateConnectionPolicy
 *
 * @brief RTCORBA::PrivateConnectionPolicy implementation
 *
 * This policy controls whether the transport connection for the
 * Object is private, i.e., not available for carrying out invocations on
 * other objects.
 */
class TAO_RTCORBA_Export TAO_PrivateConnectionPolicy
  : public RTCORBA::PrivateConnectionPolicy,
    public TAO_Local_RefCounted_Object
{
public:
  /// Constructor.
  TAO_PrivateConnectionPolicy (void);

  /// Copy constructor.
  TAO_PrivateConnectionPolicy (const TAO_PrivateConnectionPolicy &rhs);

  CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  // Return the cached policy type for this policy.
  TAO_Cached_Policy_Type _tao_cached_type (void) const;

  // Returns the scope at which this policy can be applied. See orbconf.h.
  TAO_Policy_Scope _tao_scope (void) const;

  /// Helper method for the implementation of
  /// CORBA::ORB::create_policy.
  static CORBA::Policy_ptr create (const CORBA::Any &val
                                   ACE_ENV_ARG_DECL);

protected:

  /// Protected destructor to enforce proper memory management of this
  /// reference counted object.
  virtual ~TAO_PrivateConnectionPolicy (void);

};

//*************************************************************************

/**
 * @class TAO_PriorityBandedConnectionPolicy
 *
 * @brief RTCORBA::PriorityBandedConnectionPolicy implementation
 *
 * RT CORBA provides facility for a client to communicate with a
 * server via multiple connections, aka bands, with each connection handling
 * invocations that are made at a different CORBA priority.
 * This policy allows the specification of the number of such
 * bands and their priorities.
 */
class TAO_RTCORBA_Export TAO_PriorityBandedConnectionPolicy
  : public RTCORBA::PriorityBandedConnectionPolicy,
    public TAO_Local_RefCounted_Object
{
public:
  /// Constructor.
  TAO_PriorityBandedConnectionPolicy (const RTCORBA::PriorityBands &bands);

  /// Copy constructor.
  TAO_PriorityBandedConnectionPolicy (const TAO_PriorityBandedConnectionPolicy &rhs);

  /**
   * Accessor to the underlying priority bands of the policy (does not
   * make a copy like the idl accessor <priority_bands> implementation
   * below.)
   */
  RTCORBA::PriorityBands &priority_bands_rep (void);

  RTCORBA::PriorityBands *priority_bands (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  /// This method writes a CDR representation of the current object.
  CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);

  /// This method reads the object state from a CDR representation.
  CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);

  // Return the cached policy type for this policy.
  TAO_Cached_Policy_Type _tao_cached_type (void) const;

  // Returns the scope at which this policy can be applied. See orbconf.h.
  TAO_Policy_Scope _tao_scope (void) const;

  /// Helper method for the implementation of
  /// CORBA::ORB::create_policy.
  static CORBA::Policy_ptr create (const CORBA::Any &val
                                   ACE_ENV_ARG_DECL);

protected:

  /// Protected destructor to enforce proper memory management of this
  /// reference counted object.
  virtual ~TAO_PriorityBandedConnectionPolicy (void);

  /// This constructor is used by TAO_RT_PolicyFactory when decoding
  /// policies from tagged components in an IOR.
  friend class TAO_RT_PolicyFactory;
  TAO_PriorityBandedConnectionPolicy (void);

private:

  /// Attribute.
  RTCORBA::PriorityBands priority_bands_;
};

//*************************************************************************

/**
 * @class TAO_ServerProtocolPolicy
 *
 * @brief RTCORBA::ServerProtocolPolicy implementation
 *
 * This policy controls selection and configuration of
 * communication protocols on the server-side of the RT ORB.
 */
class TAO_RTCORBA_Export TAO_ServerProtocolPolicy
  : public RTCORBA::ServerProtocolPolicy,
    public TAO_Local_RefCounted_Object
{
public:
  /// Constructor.
  TAO_ServerProtocolPolicy (const RTCORBA::ProtocolList &protocols);

  /// Copy constructor.
  TAO_ServerProtocolPolicy (const TAO_ServerProtocolPolicy &rhs);

  /**
   * Accessor to the underlying protocols list of the policy (does not
   * make a copy like the idl accessor <protocols> implementation
   * below.)
   */
  RTCORBA::ProtocolList & protocols_rep (void);

  RTCORBA::ProtocolList *protocols
  (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));

  static int hook (TAO_ORB_Core *orb_core,
                   int &send_buffer_size,
                   int &recv_buffer_size,
                   int &no_delay,
                   int &enable_network_priority,
                   const char *protocol_type);

  // Return the cached policy type for this policy.
  TAO_Cached_Policy_Type _tao_cached_type (void) const;

  // Returns the scope at which this policy can be applied. See orbconf.h.
  TAO_Policy_Scope _tao_scope (void) const;

  /// Helper method for the implementation of
  /// CORBA::ORB::create_policy.
  static CORBA::Policy_ptr create (const CORBA::Any &val
                                   ACE_ENV_ARG_DECL);

protected:

  /// Protected destructor to enforce proper memory management of this
  /// reference counted object.
  virtual ~TAO_ServerProtocolPolicy (void);

private:

  /// Attribute.
  RTCORBA::ProtocolList protocols_;
};

//*************************************************************************

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?