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

📄 offer_iterators_t.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
字号:
// Offer_Iterators_T.cpp,v 1.18 2003/04/30 12:31:00 elliott_c Exp

#ifndef TAO_OFFER_ITERATORS_T_C
#define  TAO_OFFER_ITERATORS_T_C

#include "Offer_Iterators_T.h"

ACE_RCSID(Trader, Offer_Iterators_T, "Offer_Iterators_T.cpp,v 1.18 2003/04/30 12:31:00 elliott_c Exp")

template <class MAP_LOCK_TYPE>
TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>::
TAO_Register_Offer_Iterator (TAO_Offer_Database<MAP_LOCK_TYPE> &db,
                             const TAO_Property_Filter& pfilter)
  : TAO_Offer_Iterator (pfilter),
    db_ (db)
{
}

template <class MAP_LOCK_TYPE>
TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>::
~TAO_Register_Offer_Iterator (void)
{
  while (! this->offer_ids_.is_empty ())
    {
      CosTrading::OfferId offer_id = 0;
      this->offer_ids_.dequeue_head (offer_id);

      CORBA::string_free (offer_id);
    }
}

template <class MAP_LOCK_TYPE> void
TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>::
add_offer (CosTrading::OfferId id,
           const CosTrading::Offer* /* offer */)
{
  this->offer_ids_.enqueue_tail (id);
}

template <class MAP_LOCK_TYPE> CORBA::ULong
TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>::
max_left (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                  CosTrading::UnknownMaxLeft))
{
  return ACE_static_cast (CORBA::ULong, this->offer_ids_.size ());
}

template <class MAP_LOCK_TYPE> CORBA::Boolean
TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>::
next_n (CORBA::ULong n,
        CosTrading::OfferSeq_out offers
        ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  CORBA::ULong ret_offers = 0;

  CORBA::ULong max_possible_offers_in_sequence =
    (n <  this->offer_ids_.size ()) ? n :
       ACE_static_cast (CORBA::ULong, this->offer_ids_.size ());

  ACE_NEW_THROW_EX (offers,
                    CosTrading::OfferSeq,
                    CORBA::NO_MEMORY ());
  ACE_CHECK_RETURN (0);

  offers->length (max_possible_offers_in_sequence);

  // While there are entries left and we haven't filled <offers>
  // with requested number.
  while (! this->offer_ids_.is_empty ()
         && n > ret_offers)
    {
      // If offer is found, put it into the sequence.
      // remove this id irrespective of whether the offer is found
      // or not.
      CosTrading::OfferId id;
      this->offer_ids_.dequeue_head (id);

      CosTrading::OfferId_var offerid_var (id);
      CosTrading::Offer* offer = this->db_.lookup_offer (id ACE_ENV_ARG_PARAMETER);
      ACE_CHECK_RETURN (0);

      if (offer != 0)
        this->pfilter_.filter_offer (offer,
                                     offers[ret_offers++]);
    }

  // Reset the length to the correct value
  offers->length (ret_offers);

  return ACE_static_cast (CORBA::Boolean, ret_offers != 0);
}

#endif /* TAO_REGISTER_OFFER_ITERATOR_C */

⌨️ 快捷键说明

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