summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Trader/Offer_Id_Iterator.h
blob: 95dd129763d3952904f76eb5197d80505893164c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* -*- C++ -*- */

// ========================================================================
// $Id$
// 
// = LIBRARY 
//    orbsvcs
//  
// = FILENAME 
//    Offer_Id_terator.h
//
// = AUTHOR 
//    Seth Widoff <sbw1@cs.wustl.edu>
//  
// ======================================================================= 

#ifndef TAO_OFFER_ID_ITERATOR_H
#define TAO_OFFER_ID_ITERATOR_H

#include <deque>
#include <queue>
#include <string>

#include "orbsvcs/CosTradingS.h"

class TAO_Offer_Id_Iterator : public POA_CosTrading::OfferIdIterator
// = TITLE
//   Silly little iterator that contains the overflow of offer ids
//   from the Admin list_offers method.
// 
// = DESCRIPTION
//
//   BEGIN SPEC
//   The OfferIdIterator interface is used to return a set of offer
//   identifiers from the list_offers operation and the list_proxies
//   operation in the Admin interface by enabling the offer identifiers
//   to be extracted by successive operations on the OfferIdIterator
//   interface. 
//   END SPEC
{
 public:
  
  TAO_Offer_Id_Iterator(void);
  // No op constructor

  ~TAO_Offer_Id_Iterator (void);
  
  virtual CORBA::ULong max_left(CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException,
		     CosTrading::UnknownMaxLeft));
  // The max_left operation returns the number of offer identifiers
  // remaining in the iterator. The exception UnknownMaxLeft is raised
  // if the iterator cannot determine the remaining number of offer
  // identifiers (e.g., if the iterator determines its set of offer
  // identifiers through lazy evaluation). 
  
  virtual void destroy(CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException));
  // The destroy operation destroys the iterator. No further
  // operations can be invoked on an iterator after it has been
  // destroyed. 
  
  virtual CORBA::Boolean next_n(CORBA::ULong _n,
				CosTrading::OfferIdSeq_out _ids,
				CORBA::Environment& env)
    TAO_THROW_SPEC ((CORBA::SystemException));
  // The next_n operation returns a set of offer identifiers in the
  // output parameter "ids." The operation returns n offer identifiers
  // if there are at least n offer identifiers remaining in the
  // iterator. If there are fewer than n offer identifiers in the
  // iterator, then all remaining offer identifiers are returned. The
  // actual number of offer identifiers returned can be determined
  // from the length of the "ids" sequence. The next_n operation
  // returns TRUE if there are further offer identifiers to be
  // extracted from the iterator. It returns FALSE if there are no
  // further offer identifiers to be extracted. 
  
  void insert_id(CosTrading::OfferId new_id);
  // Insert a <new_id> into the contents of the iterator.
  
 private:

#ifdef OS_NO_DEFAULT_TEMPLATE_ARGUMENTS
  typedef queue<CosTrading::OfferId, deque<CosTrading::OfferId> > OFFER_ID_QUEUE;
#else
  typedef queue<CosTrading::OfferId> OFFER_ID_QUEUE;
#endif /* OS_NO_DEFAULT_TEMPLATE_ARGUMENTS */
  
  OFFER_ID_QUEUE ids_;
};

#endif /* TAO_OFFER_ID_ITERATOR_H */