#include <Offer_Iterators.h>
Collaboration diagram for TAO_Offer_Iterator_Collection:
Public Member Functions | |
TAO_Offer_Iterator_Collection (void) | |
virtual | ~TAO_Offer_Iterator_Collection (void) |
virtual CORBA::Boolean | next_n (CORBA::ULong n, CosTrading::OfferSeq_out offers) throw (CORBA::SystemException) |
Retrieve n offers from the set of iterators. | |
virtual void | destroy () throw (CORBA::SystemException) |
Destroy the collection of iterators. | |
virtual CORBA::ULong | max_left () throw (CORBA::SystemException, CosTrading::UnknownMaxLeft) |
Determine how many offers are left in the collection. | |
void | add_offer_iterator (CosTrading::OfferIterator_ptr offer_iter) |
Add an iterator to the collection. | |
Private Types | |
typedef ACE_Unbounded_Queue< CosTrading::OfferIterator * > | Offer_Iters |
Private Member Functions | |
TAO_Offer_Iterator_Collection (const TAO_Offer_Iterator_Collection &) | |
TAO_Offer_Iterator_Collection & | operator= (const TAO_Offer_Iterator_Collection &) |
Private Attributes | |
Offer_Iters | iters_ |
The iterator collection. |
|
Definition at line 211 of file Offer_Iterators.h. |
|
Definition at line 86 of file Offer_Iterators.cpp.
00087 { 00088 } |
|
Definition at line 90 of file Offer_Iterators.cpp. References ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, ACE_Unbounded_Queue< T >::dequeue_head(), CosTrading::OfferIterator::destroy(), ACE_Unbounded_Queue< T >::is_empty(), iters_, and CORBA::release().
00091 { 00092 while (! this->iters_.is_empty ()) 00093 { 00094 CosTrading::OfferIterator* offer_iter = 0; 00095 this->iters_.dequeue_head (offer_iter); 00096 00097 ACE_TRY_NEW_ENV 00098 { 00099 offer_iter->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); 00100 ACE_TRY_CHECK; 00101 00102 CORBA::release (offer_iter); 00103 } 00104 ACE_CATCHANY 00105 { 00106 // Don't let the exceptions propagate since we're in a 00107 // destructor! 00108 } 00109 ACE_ENDTRY; 00110 } 00111 } |
|
|
|
Add an iterator to the collection.
Definition at line 115 of file Offer_Iterators.cpp. References ACE_Unbounded_Queue< T >::enqueue_tail(), CORBA::is_nil(), and iters_. Referenced by TAO_Lookup< TRADER_LOCK_TYPE, MAP_LOCK_TYPE >::federated_query().
00116 { 00117 if (! CORBA::is_nil (offer_iter)) 00118 this->iters_.enqueue_tail (offer_iter); 00119 } |
|
Destroy the collection of iterators.
Definition at line 180 of file Offer_Iterators.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and ACE_ENV_SINGLE_ARG_PARAMETER.
00182 { 00183 // Destroy all iterators in the collection. 00184 for (Offer_Iters::ITERATOR iters_iter (this->iters_); 00185 ! iters_iter.done (); 00186 iters_iter.advance ()) 00187 { 00188 CosTrading::OfferIterator** iter = 0; 00189 00190 iters_iter.next (iter); 00191 (*iter)->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); 00192 ACE_CHECK; 00193 } 00194 00195 // Remove self from POA 00196 00197 PortableServer::POA_var poa = 00198 this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER); 00199 ACE_CHECK; 00200 00201 PortableServer::ObjectId_var id = 00202 poa->servant_to_id (this ACE_ENV_ARG_PARAMETER); 00203 ACE_CHECK; 00204 00205 poa->deactivate_object (id.in () ACE_ENV_ARG_PARAMETER); 00206 ACE_CHECK; 00207 } |
|
Determine how many offers are left in the collection.
Definition at line 210 of file Offer_Iterators.cpp. References ACE_THROW_RETURN.
00213 { 00214 ACE_THROW_RETURN (CosTrading::UnknownMaxLeft(), 00215 0); 00216 } |
|
Retrieve n offers from the set of iterators.
Definition at line 122 of file Offer_Iterators.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_NEW_THROW_EX, CosTrading::OfferIterator::destroy(), CosTrading::OfferIterator::next_n(), CosTrading::OfferSeq, and CORBA::release().
00126 { 00127 CORBA::ULong offers_left = n; 00128 CORBA::Boolean return_value = 1; 00129 CosTrading::OfferSeq_var out_offers; 00130 00131 ACE_NEW_THROW_EX (offers, 00132 CosTrading::OfferSeq, 00133 CORBA::NO_MEMORY ()); 00134 ACE_CHECK_RETURN (return_value); 00135 00136 while (offers_left > 0 && ! this->iters_.is_empty ()) 00137 { 00138 CORBA::ULong offset = 0; 00139 CORBA::Boolean any_left = 0; 00140 CosTrading::OfferIterator* iter = 0; 00141 this->iters_.dequeue_head (iter); 00142 00143 // Determine how many offers we should retrieve from this 00144 // iterator. 00145 00146 // Retrieve the set of offers. 00147 any_left = 00148 iter->next_n (offers_left, 00149 CosTrading::OfferSeq_out (out_offers.out ()) 00150 ACE_ENV_ARG_PARAMETER); 00151 ACE_CHECK_RETURN (return_value); 00152 00153 // If we've exhausted this iterator, destroy it. 00154 if (any_left == 0) 00155 { 00156 iter->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); 00157 ACE_CHECK_RETURN (return_value); 00158 CORBA::release (iter); 00159 } 00160 else 00161 this->iters_.enqueue_head (iter); 00162 00163 // Merge it with the passed set. 00164 offset = offers->length (); 00165 offers->length (out_offers->length () + offset); 00166 for (CORBA::ULong j = out_offers->length (); j > 0; j--) 00167 offers[j + offset - 1] = out_offers[j - 1]; 00168 00169 offers_left -= out_offers->length (); 00170 } 00171 00172 // Determine if we have anything left to offer. 00173 if (this->iters_.is_empty ()) 00174 return_value = 0; 00175 00176 return return_value; 00177 } |
|
|
|
The iterator collection.
Definition at line 214 of file Offer_Iterators.h. Referenced by add_offer_iterator(), and ~TAO_Offer_Iterator_Collection(). |