TAO_CosTrader 3.1.4
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
TAO_Offer_Database< LOCK_TYPE > Class Template Reference

#include <Offer_Database.h>

Collaboration diagram for TAO_Offer_Database< LOCK_TYPE >:
Collaboration graph
[legend]

Classes

struct  Offer_Map_Entry
 

Public Types

typedef TAO_Service_Offer_Iterator< LOCK_TYPE > offer_iterator
 
typedef ACE_Hash_Map_Manager_Ex< CORBA::String_var, Offer_Map_Entry *, ACE_Hash< CORBA::String_var >, ACE_Equal_To< CORBA::String_var >, ACE_Null_MutexOffer_Database
 

Public Member Functions

 TAO_Offer_Database ()
 No arg constructor.
 
 ~TAO_Offer_Database ()
 
CosTrading::OfferId insert_offer (const char *type, CosTrading::Offer *offer)
 
int remove_offer (const CosTrading::OfferId offer_id)
 
CosTrading::Offerlookup_offer (const CosTrading::OfferId offer_id)
 
CosTrading::Offerlookup_offer (const CosTrading::OfferId offer_id, char *&type_name)
 
TAO_Offer_Id_Iteratorretrieve_all_offer_ids ()
 

Private Member Functions

CosTrading::Offerlookup_offer (const char *type, CORBA::ULong id)
 
int remove_offer (const char *type, CORBA::ULong id)
 
void operator= (const TAO_Offer_Database< LOCK_TYPE > &)=delete
 
 TAO_Offer_Database (const TAO_Offer_Database< LOCK_TYPE > &)=delete
 

Static Private Member Functions

static CosTrading::OfferId generate_offer_id (const char *type_name, CORBA::ULong id)
 
static void parse_offer_id (const CosTrading::OfferId offer_id, char *&service_type, CORBA::ULong &id)
 

Private Attributes

LOCK_TYPE db_lock_
 
Offer_Database offer_db_
 

Friends

class TAO_Service_Offer_Iterator< LOCK_TYPE >
 

Detailed Description

template<class LOCK_TYPE>
class TAO_Offer_Database< LOCK_TYPE >

The TAO_Offer_Database encapsulates the mapping of service types to those offers exported with that service types. The underlying structure is a map of maps. The first maps maps the service type name to a map of exported offers. The second map maps the identifying index for that offer within the service types. So a service type name and an index uniquely identifies an exported offer. In fact, when the register export interface returns a CosTrading::OfferId, it's returning no more than a simple string concatenation of these two values. In addition to all these wonderful things, the TAO_Offer_Database has built-in locking, one reader/writer-style lock for modifying the top-level map and a reader/writer-style for each of the offer maps. Needless to say the locks are acquired when the TAO_Offer_Database performs operations on the structures they guard. NOTE: TAO_Offer_Database needs to be parameterized by a READER/WRITER LOCK, a RECURSIVE MUTEX, or a NULL MUTEX, not a simple binary mutex! Mutexes will cause deadlock when you try to contruct an iterator (which acquires a read lock on the map under an existing read lock). Just don't do it, ok?

Member Typedef Documentation

◆ Offer_Database

◆ offer_iterator

template<class LOCK_TYPE >
typedef TAO_Service_Offer_Iterator<LOCK_TYPE> TAO_Offer_Database< LOCK_TYPE >::offer_iterator

Constructor & Destructor Documentation

◆ TAO_Offer_Database() [1/2]

template<class LOCK_TYPE >
TAO_Offer_Database< LOCK_TYPE >::TAO_Offer_Database ( )

No arg constructor.

◆ ~TAO_Offer_Database()

template<class LOCK_TYPE >
TAO_Offer_Database< LOCK_TYPE >::~TAO_Offer_Database ( )

◆ TAO_Offer_Database() [2/2]

template<class LOCK_TYPE >
TAO_Offer_Database< LOCK_TYPE >::TAO_Offer_Database ( const TAO_Offer_Database< LOCK_TYPE > & )
privatedelete

Member Function Documentation

◆ generate_offer_id()

template<class LOCK_TYPE >
CosTrading::OfferId TAO_Offer_Database< LOCK_TYPE >::generate_offer_id ( const char * type_name,
CORBA::ULong id )
staticprivate

Take in a service type name for the offer the current value of of the counter and generate an offer id.

◆ insert_offer()

template<class LOCK_TYPE >
CosTrading::OfferId TAO_Offer_Database< LOCK_TYPE >::insert_offer ( const char * type,
CosTrading::Offer * offer )

Add an offer of type @ type and generate a CosTrading::OfferId for it. Returns 0 on failure.

◆ lookup_offer() [1/3]

template<class LOCK_TYPE >
CosTrading::Offer * TAO_Offer_Database< LOCK_TYPE >::lookup_offer ( const char * type,
CORBA::ULong id )
private

Lookup an offer whose type is @ type and id, id. Return 0 on failure.

◆ lookup_offer() [2/3]

template<class LOCK_TYPE >
CosTrading::Offer * TAO_Offer_Database< LOCK_TYPE >::lookup_offer ( const CosTrading::OfferId offer_id)

Lookup an offer whose offer_id is offer_id, and return it. Otherwise, throw the appropriate exception.

◆ lookup_offer() [3/3]

template<class LOCK_TYPE >
CosTrading::Offer * TAO_Offer_Database< LOCK_TYPE >::lookup_offer ( const CosTrading::OfferId offer_id,
char *& type_name )

Lookup an offer whose OfferId is offer_id and return in type_name the type name of the object. Type name is just a pointer to a location in offer_id, so DON'T DELETE IT.

◆ operator=()

template<class LOCK_TYPE >
void TAO_Offer_Database< LOCK_TYPE >::operator= ( const TAO_Offer_Database< LOCK_TYPE > & )
privatedelete

◆ parse_offer_id()

template<class LOCK_TYPE >
void TAO_Offer_Database< LOCK_TYPE >::parse_offer_id ( const CosTrading::OfferId offer_id,
char *& service_type,
CORBA::ULong & id )
staticprivate

Take in a previously generated offer id and return the type and id that were used to generate the offer id.

◆ remove_offer() [1/2]

template<class LOCK_TYPE >
int TAO_Offer_Database< LOCK_TYPE >::remove_offer ( const char * type,
CORBA::ULong id )
private

Remove an offers whose id is @id. Returns 0 on success, -1 on failure, and throws a CosTrading::IllegalOfferId if it can't parse the CosTrading::OfferId.

◆ remove_offer() [2/2]

template<class LOCK_TYPE >
int TAO_Offer_Database< LOCK_TYPE >::remove_offer ( const CosTrading::OfferId offer_id)

◆ retrieve_all_offer_ids()

template<class LOCK_TYPE >
TAO_Offer_Id_Iterator * TAO_Offer_Database< LOCK_TYPE >::retrieve_all_offer_ids ( )

Return an iterator that will traverse and return all the offer ids in the service type map.

Friends And Related Symbol Documentation

◆ TAO_Service_Offer_Iterator< LOCK_TYPE >

template<class LOCK_TYPE >
friend class TAO_Service_Offer_Iterator< LOCK_TYPE >
friend

Member Data Documentation

◆ db_lock_

template<class LOCK_TYPE >
LOCK_TYPE TAO_Offer_Database< LOCK_TYPE >::db_lock_
private

◆ offer_db_

template<class LOCK_TYPE >
Offer_Database TAO_Offer_Database< LOCK_TYPE >::offer_db_
private

The documentation for this class was generated from the following files: