⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trader.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
📖 第 1 页 / 共 3 页
字号:
// Trader.cpp,v 1.69 2003/11/04 08:12:59 dhinton Exp

#include "Trader.h"
#include "Offer_Iterators_T.h"
#include "ace/Thread_Mutex.h"
#include "ace/RW_Thread_Mutex.h"
#include "ace/OS_NS_strings.h"
#include "ace/os_include/os_ctype.h"
#include "ace/OS_NS_string.h"

// The following #include is needed only for the instantiation pragmas.
#include "Trader_Interfaces.h"

ACE_RCSID (Trader,
           Trader,
           "Trader.cpp,v 1.69 2003/11/04 08:12:59 dhinton Exp")

TAO_Trader_Base::TAO_Trader_Base (void)
  : trading_components_ (*this),
    import_attributes_ (*this),
    support_attributes_ (*this),
    link_attributes_ (*this)
{
}

TAO_Trader_Base::~TAO_Trader_Base (void)
{
}

TAO_Import_Attributes_i &
TAO_Trader_Base::import_attributes (void)
{
  return this->import_attributes_;
}

const TAO_Import_Attributes_i &
TAO_Trader_Base::import_attributes (void) const
{
  return this->import_attributes_;
}

TAO_Support_Attributes_i &
TAO_Trader_Base::support_attributes (void)
{
  return this->support_attributes_;
}

const TAO_Support_Attributes_i &
TAO_Trader_Base::support_attributes (void) const
{
  return this->support_attributes_;
}

TAO_Link_Attributes_i &
TAO_Trader_Base::link_attributes (void)
{
  return this->link_attributes_;
}

const TAO_Link_Attributes_i &
TAO_Trader_Base::link_attributes (void) const
{
  return this->link_attributes_;
}

TAO_Trading_Components_i &
TAO_Trader_Base::trading_components (void)
{
  return this->trading_components_;
}

const TAO_Trading_Components_i &
TAO_Trader_Base::trading_components (void) const
{
  return this->trading_components_;
}

CORBA::Boolean
TAO_Trader_Base::is_valid_identifier_name (const char* ident)
{
  int return_value = 0;

  if (ident == 0)
    return return_value;

  size_t length = ACE_OS::strlen (ident);
  if (length >= 1 && isalpha (ident[0]))
    {
      return_value = 1;
      for (size_t i = 0; i < length; i++)
        {
          if (! (isalnum (ident[i]) || ident[i] == '_'))
            {
              return_value = 0;
              break;
            }
        }
    }

  return return_value;
}

TAO_Support_Attributes_i::
TAO_Support_Attributes_i (TAO_Lockable &locker)
  : locker_ (locker),
    supports_modifiable_properties_ (1),
    supports_dynamic_properties_ (1),
    supports_proxy_offers_ (0),
    type_repos_ (CosTrading::TypeRepository::_nil ()),
    service_type_repos_ (CosTradingRepos::ServiceTypeRepository::_nil ())
{
}

TAO_Support_Attributes_i::~TAO_Support_Attributes_i (void)
{
}

CORBA::Boolean
TAO_Support_Attributes_i::supports_modifiable_properties (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (),
                         0);
  return this->supports_modifiable_properties_;
}

void
TAO_Support_Attributes_i::
supports_modifiable_properties (CORBA::Boolean new_value)
{
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());
  this->supports_modifiable_properties_ = new_value;
}

CORBA::Boolean
TAO_Support_Attributes_i::supports_dynamic_properties (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (),
                         0);

  return this->supports_dynamic_properties_;
}

void
TAO_Support_Attributes_i::
supports_dynamic_properties (CORBA::Boolean new_value)
{
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());
  this->supports_dynamic_properties_ = new_value;
}

CORBA::Boolean
TAO_Support_Attributes_i::supports_proxy_offers (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (),
                         0);

  return this->supports_proxy_offers_;
}

void
TAO_Support_Attributes_i::
supports_proxy_offers (CORBA::Boolean new_value)
{
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());
  this->supports_proxy_offers_ = new_value;
}

CosTrading::TypeRepository_ptr
TAO_Support_Attributes_i::type_repos (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (),
                         CosTrading::TypeRepository::_nil ());
  return this->type_repos_.ptr ();
}

void
TAO_Support_Attributes_i::
type_repos (CosTrading::TypeRepository_ptr new_value)
{
  // @@ Seth, There is no way to propagate the exception out.
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());

  ACE_DECLARE_NEW_CORBA_ENV;
  this->type_repos_ = new_value;
  // @@ What can we do even if we catch this?
  this->service_type_repos_ =
    CosTradingRepos::ServiceTypeRepository::_narrow (new_value ACE_ENV_ARG_PARAMETER);
}

CosTradingRepos::ServiceTypeRepository_ptr
TAO_Support_Attributes_i::service_type_repos (void) const
{
  return this->service_type_repos_.ptr ();
}


TAO_Import_Attributes_i::
TAO_Import_Attributes_i (TAO_Lockable &locker)
  : locker_ (locker),
    def_search_card_ (200),
    max_search_card_ (500),
    def_match_card_ (200),
    max_match_card_ (500),
    def_return_card_ (200),
    max_return_card_ (500),
    max_list_ (0),
    def_hop_count_ (5),
    max_hop_count_ (10),
    def_follow_policy_ (CosTrading::if_no_local),
    max_follow_policy_ (CosTrading::always)
{
}


TAO_Import_Attributes_i::~TAO_Import_Attributes_i (void)
{
}

CORBA::ULong
TAO_Import_Attributes_i::def_search_card (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (), 10);
  return this->def_search_card_;
}

void
TAO_Import_Attributes_i::def_search_card (CORBA::ULong new_value)
{
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());

  if (new_value > this->max_search_card_)
    this->def_search_card_ = this->max_search_card_;
  else
    this->def_search_card_ = new_value;
}

CORBA::ULong
TAO_Import_Attributes_i::max_search_card (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (), 10);
  return this->max_search_card_;
}

void
TAO_Import_Attributes_i::max_search_card (CORBA::ULong new_value)
{
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());

  this->max_search_card_ = new_value;

  if (this->def_search_card_ > this->max_search_card_)
    this->def_search_card_ = this->max_search_card_;
}

CORBA::ULong
TAO_Import_Attributes_i::def_match_card (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (), 10);
  return this->def_match_card_;
}

void
TAO_Import_Attributes_i::def_match_card (CORBA::ULong new_value)
{
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());

  if (new_value > this->max_match_card_)
    this->def_match_card_ = this->max_match_card_;
  else
    this->def_match_card_ = new_value;
}

CORBA::ULong
TAO_Import_Attributes_i::max_match_card (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (), 10);
  return this->max_match_card_;
}

void
TAO_Import_Attributes_i::max_match_card (CORBA::ULong new_value)
{
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());
  this->max_match_card_ = new_value;

  if (this->def_match_card_ > this->max_match_card_)
    this->def_match_card_ = this->max_match_card_;
}

CORBA::ULong
TAO_Import_Attributes_i::def_return_card (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (), 10);
  return this->def_return_card_;
}

void
TAO_Import_Attributes_i::def_return_card (CORBA::ULong new_value)
{
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());

  if (new_value > this->max_return_card_)
    this->def_return_card_ = this->max_return_card_;
  else
    this->def_return_card_ = new_value;
}

CORBA::ULong
TAO_Import_Attributes_i::max_return_card (void) const
{
  ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->locker_.lock (), 10);
  return this->max_return_card_;
}

void
TAO_Import_Attributes_i::max_return_card (CORBA::ULong new_value)
{
  ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->locker_.lock ());
  this->max_return_card_ = new_value;

  if (this->def_return_card_ > this->max_return_card_)

⌨️ 快捷键说明

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