#include <Offer_Database.h>
Collaboration diagram for TAO_Service_Offer_Iterator< LOCK_TYPE >:
Public Types | |
typedef TAO_Offer_Database< LOCK_TYPE > | Offer_Database |
Public Member Functions | |
TAO_Service_Offer_Iterator (const char *type, TAO_Offer_Database< LOCK_TYPE > &offer_database) | |
~TAO_Service_Offer_Iterator (void) | |
Release all the locks acquired. | |
int | has_more_offers (void) |
Returns 1 if there are more offers, 0 otherwise. | |
CosTrading::OfferId | get_id (void) |
Get the id for the current offer. | |
CosTrading::Offer * | get_offer (void) |
Returns the next offer in the series. | |
void | next_offer (void) |
Advances the iterator 1. | |
Private Attributes | |
TAO_Offer_Database< LOCK_TYPE > & | stm_ |
Lock the top_level map. | |
LOCK_TYPE * | lock_ |
Lock for the internal map. | |
TAO_Offer_Map::iterator * | offer_iter_ |
Iterator over the actual offer map. | |
const char * | type_ |
The name of the type. Used for constructing offer ids. |
Definition at line 164 of file Offer_Database.h.
|
Definition at line 168 of file Offer_Database.h. |
|
Definition at line 321 of file Offer_Database.cpp. References ACE_NEW, TAO_Service_Offer_Iterator< LOCK_TYPE >::offer_iter_, and TAO_Service_Offer_Iterator< LOCK_TYPE >::stm_.
00323 : stm_ (offer_database), 00324 lock_ (0), 00325 offer_iter_ (0), 00326 type_ (type) 00327 { 00328 CORBA::String_var service_type (type); 00329 00330 if (this->stm_.db_lock_.acquire_read () == -1) 00331 return; 00332 00333 ACE_TYPENAME TAO_Offer_Database<LOCK_TYPE>::Offer_Map_Entry* entry = 0; 00334 if (this->stm_.offer_db_.find (service_type, entry) == -1) 00335 return; 00336 else 00337 { 00338 this->lock_ = &entry->lock_; 00339 if (this->lock_->acquire_read () == -1) 00340 return; 00341 00342 ACE_NEW (offer_iter_, 00343 TAO_Offer_Map::iterator (*entry->offer_map_)); 00344 } 00345 } |
|
Release all the locks acquired.
Definition at line 348 of file Offer_Database.cpp. References TAO_Service_Offer_Iterator< LOCK_TYPE >::offer_iter_, and TAO_Service_Offer_Iterator< LOCK_TYPE >::stm_.
00349 { 00350 this->stm_.db_lock_.release (); 00351 00352 if (this->lock_ != 0) 00353 { 00354 this->lock_->release (); 00355 delete this->offer_iter_; 00356 } 00357 } |
|
Get the id for the current offer.
Definition at line 360 of file Offer_Database.cpp. References TAO_Offer_Database< LOCK_TYPE >::generate_offer_id(), and TAO_Service_Offer_Iterator< LOCK_TYPE >::offer_iter_.
00361 { 00362 return (this->offer_iter_ != 0) 00363 ? TAO_Offer_Database<LOCK_TYPE>::generate_offer_id (this->type_, (**this->offer_iter_).ext_id_) 00364 : 0; 00365 } |
|
Returns the next offer in the series.
Definition at line 375 of file Offer_Database.cpp. References TAO_Service_Offer_Iterator< LOCK_TYPE >::offer_iter_.
00376 { 00377 return (this->offer_iter_ != 0) ? (**this->offer_iter_).int_id_ : 0; 00378 } |
|
Returns 1 if there are more offers, 0 otherwise.
Definition at line 368 of file Offer_Database.cpp. References TAO_Service_Offer_Iterator< LOCK_TYPE >::offer_iter_.
00369 { 00370 return (this->offer_iter_ != 0) ? ! this->offer_iter_->done () : 0; 00371 } |
|
Advances the iterator 1.
Definition at line 381 of file Offer_Database.cpp. References TAO_Service_Offer_Iterator< LOCK_TYPE >::offer_iter_.
00382 { 00383 if (this->offer_iter_ != 0) 00384 this->offer_iter_->advance (); 00385 } |
|
Lock for the internal map.
Definition at line 195 of file Offer_Database.h. |
|
Iterator over the actual offer map.
Definition at line 198 of file Offer_Database.h. Referenced by TAO_Service_Offer_Iterator< LOCK_TYPE >::get_id(), TAO_Service_Offer_Iterator< LOCK_TYPE >::get_offer(), TAO_Service_Offer_Iterator< LOCK_TYPE >::has_more_offers(), TAO_Service_Offer_Iterator< LOCK_TYPE >::next_offer(), TAO_Service_Offer_Iterator< LOCK_TYPE >::TAO_Service_Offer_Iterator(), and TAO_Service_Offer_Iterator< LOCK_TYPE >::~TAO_Service_Offer_Iterator(). |
|
Lock the top_level map.
Definition at line 192 of file Offer_Database.h. Referenced by TAO_Service_Offer_Iterator< LOCK_TYPE >::TAO_Service_Offer_Iterator(), and TAO_Service_Offer_Iterator< LOCK_TYPE >::~TAO_Service_Offer_Iterator(). |
|
The name of the type. Used for constructing offer ids.
Definition at line 201 of file Offer_Database.h. |