#include <Offer_Iterators.h>
Collaboration diagram for TAO_Offer_Id_Iterator:
Public Member Functions | |
TAO_Offer_Id_Iterator (void) | |
No op constructor. | |
~TAO_Offer_Id_Iterator (void) | |
virtual CORBA::ULong | max_left () throw (CORBA::SystemException, CosTrading::UnknownMaxLeft) |
virtual void | destroy () throw (CORBA::SystemException) |
virtual CORBA::Boolean | next_n (CORBA::ULong _n, CosTrading::OfferIdSeq_out _ids) throw (CORBA::SystemException) |
void | insert_id (CosTrading::OfferId new_id) |
Insert a into the contents of the iterator. | |
Private Member Functions | |
TAO_Offer_Id_Iterator (const TAO_Offer_Id_Iterator &) | |
TAO_Offer_Id_Iterator & | operator= (TAO_Offer_Id_Iterator &) |
Private Attributes | |
TAO_String_Queue | ids_ |
|
No op constructor.
Definition at line 218 of file Offer_Iterators.cpp.
00219 { 00220 } |
|
Definition at line 222 of file Offer_Iterators.cpp. References ACE_Unbounded_Queue< T >::dequeue_head(), CosTrading::OfferId, and CORBA::string_free().
00223 { 00224 int return_value = 0; 00225 00226 do 00227 { 00228 CosTrading::OfferId offer_id = 0; 00229 00230 return_value = this->ids_.dequeue_head (offer_id); 00231 if (return_value == 0) 00232 CORBA::string_free (offer_id); 00233 } 00234 while (return_value == 0); 00235 } |
|
|
|
The destroy operation destroys the iterator. No further operations can be invoked on an iterator after it has been destroyed. Definition at line 246 of file Offer_Iterators.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and ACE_ENV_SINGLE_ARG_PARAMETER.
00248 { 00249 // Remove self from POA 00250 00251 PortableServer::POA_var poa = 00252 this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER); 00253 ACE_CHECK; 00254 00255 PortableServer::ObjectId_var id = 00256 poa->servant_to_id (this ACE_ENV_ARG_PARAMETER); 00257 ACE_CHECK; 00258 00259 poa->deactivate_object (id.in () 00260 ACE_ENV_ARG_PARAMETER); 00261 ACE_CHECK; 00262 } |
|
Insert a into the contents of the iterator.
Definition at line 317 of file Offer_Iterators.cpp. References ACE_Unbounded_Queue< T >::enqueue_tail(), and CosTrading::OfferId. Referenced by TAO_Offer_Database< LOCK_TYPE >::retrieve_all_offer_ids().
00318 { 00319 this->ids_.enqueue_tail (new_id); 00320 } |
|
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). Definition at line 238 of file Offer_Iterators.cpp.
|
|
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. Definition at line 265 of file Offer_Iterators.cpp. References ACE_NEW_RETURN, CosTrading::OfferId, and CosTrading::OfferIdSeq. Referenced by TAO_Admin< TRADER_LOCK_TYPE, MAP_LOCK_TYPE >::list_offers().
00269 { 00270 // Calculate the number of Ids to be returned in this. 00271 CORBA::ULong items_left = static_cast<CORBA::ULong> (this->ids_.size()); 00272 int difference = items_left - n; 00273 CORBA::ULong returnable_items = (difference >= 0) ? n : items_left; 00274 CORBA::Boolean return_value = (CORBA::Boolean) (difference > 0); 00275 00276 if (returnable_items == 0) 00277 ACE_NEW_RETURN (_ids, 00278 CosTrading::OfferIdSeq, 00279 return_value); 00280 else 00281 { 00282 // Allocate space for the returned OfferIds. 00283 CosTrading::OfferId* id_buf = 00284 CosTrading::OfferIdSeq::allocbuf (returnable_items); 00285 00286 if (id_buf != 0) 00287 { 00288 // Copy in those ids! 00289 for (CORBA::ULong i = 0; i < returnable_items; i++) 00290 { 00291 CosTrading::OfferId offer_id = 0; 00292 00293 this->ids_.dequeue_head (offer_id); 00294 id_buf[i] = offer_id; 00295 } 00296 00297 // Place them into an OfferIdSeq. 00298 ACE_NEW_RETURN (_ids, 00299 CosTrading::OfferIdSeq (returnable_items, 00300 returnable_items, 00301 id_buf, 00302 1), 00303 return_value); 00304 } 00305 else 00306 ACE_NEW_RETURN (_ids, 00307 CosTrading::OfferIdSeq, 00308 return_value); 00309 } 00310 00311 // Return true only if there are items left to be returned in 00312 // subsequent calls. 00313 return return_value; 00314 } |
|
|
|
Definition at line 288 of file Offer_Iterators.h. |