Offer_Iterators_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Offer_Iterators_T.h
00006  *
00007  *  Offer_Iterators_T.h,v 1.17 2006/03/14 06:14:35 jtc Exp
00008  *
00009  *  @author Marina Spivak <marina@cs.wustl.edu>
00010  *  @author Seth Widoff <sbw1@cs.wustl.edu>
00011  */
00012 //=============================================================================
00013 
00014 
00015 #ifndef TAO_REGISTER_OFFER_ITERATOR_H
00016 #define TAO_REGISTER_OFFER_ITERATOR_H
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "orbsvcs/Trader/Offer_Iterators.h"
00020 #include "orbsvcs/Trader/Offer_Database.h"
00021 
00022 #if defined(_MSC_VER)
00023 #pragma warning(push)
00024 #pragma warning(disable:4250)
00025 #endif /* _MSC_VER */
00026 
00027 
00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 /**
00031  * @class TAO_Register_Offer_Iterator
00032  *
00033  * @brief An implementation of CosTrading::OfferIterator IDL interface
00034  * appropriate when trader has Register functionality.
00035  *
00036  * Stores ids of offers to be iterated over.  Before returning
00037  * an offer, checks if the offer is still there (since it may
00038  * have been removed by the Register).
00039  */
00040 template <class MAP_LOCK_TYPE>
00041 class TAO_Register_Offer_Iterator : public TAO_Offer_Iterator
00042 {
00043 public:
00044 
00045   // = Initialization and termination methods.
00046 
00047   /// Takes service type and trader reference in order to
00048   /// later locate offers using their ids.
00049   TAO_Register_Offer_Iterator (TAO_Offer_Database<MAP_LOCK_TYPE> &db,
00050                                const TAO_Property_Filter& pfilter);
00051 
00052   /// Destructor.
00053   virtual ~TAO_Register_Offer_Iterator (void);
00054 
00055   /// Deposit at maximum n offers into the return sequence and return 1,
00056   /// or return 0 if the iterator is done and no offers are returned.
00057   virtual CORBA::Boolean next_n (CORBA::ULong n,
00058                                  CosTrading::OfferSeq_out offers
00059                                  ACE_ENV_ARG_DECL_NOT_USED)
00060     ACE_THROW_SPEC ((CORBA::SystemException));
00061 
00062   /**
00063    * Throws CosTrading::UnknownMaxLeft since with the presence of
00064    * "Register" functionality, the iterator cannot guarantee that
00065    * the trader will have all the offers it has now when the time
00066    * to return them comes.
00067    */
00068   virtual CORBA::ULong max_left (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00069     ACE_THROW_SPEC ((CORBA::SystemException,
00070                     CosTrading::UnknownMaxLeft));
00071 
00072   /// Add an offer the iterator should iterate over.
00073   void add_offer (CosTrading::OfferId id,
00074                   const CosTrading::Offer *);
00075 
00076 private:
00077 
00078   /// A reference to the trader is needed for access to the map of offers.
00079   TAO_Offer_Database<MAP_LOCK_TYPE> &db_;
00080 
00081   /// Offer ids of offers to iterate over.
00082   TAO_String_Queue offer_ids_;
00083 };
00084 
00085 TAO_END_VERSIONED_NAMESPACE_DECL
00086 
00087 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00088 #include "orbsvcs/Trader/Offer_Iterators_T.cpp"
00089 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00090 
00091 #if defined(_MSC_VER)
00092 #pragma warning(pop)
00093 #endif /* _MSC_VER */
00094 
00095 #include /**/ "ace/post.h"
00096 #endif /* TAO_REGISTER_OFFER_ITERATOR_H */

Generated on Thu Nov 9 13:59:57 2006 for TAO_CosTrader by doxygen 1.3.6