TAO_CosNaming  2.1.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY > Class Template Reference

This class implements the <BindingIterator> interface that is part of the <CosNaming> idl module. This class works with Hash_Map-based implementations of CosNaming::NamingContext. More...

#include <Bindings_Iterator_T.h>

Inheritance diagram for TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >:
Inheritance graph
Collaboration diagram for TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >:
Collaboration graph

Public Member Functions

 TAO_Bindings_Iterator (TAO_Hash_Naming_Context *context, ITERATOR *hash_iter, PortableServer::POA_ptr poa, TAO_SYNCH_RECURSIVE_MUTEX &lock)
 
 ~TAO_Bindings_Iterator (void)
 Destructor. More...
 
virtual PortableServer::POA_ptr _default_POA (void)
 Returns the Default POA of this Servant object. More...
 
CORBA::Boolean next_one (CosNaming::Binding_out b)
 
CORBA::Boolean next_n (CORBA::ULong how_many, CosNaming::BindingList_out bl)
 
void destroy (void)
 This operation destroys the iterator. More...
 

Static Public Member Functions

static int populate_binding (TABLE_ENTRY *hash_entry, CosNaming::Binding &b)
 

Private Attributes

bool destroyed_
 
TAO_Hash_Naming_Contextcontext_
 
ITERATOR * hash_iter_
 A pointer to the hash map iterator. More...
 
TAO_SYNCH_RECURSIVE_MUTEXlock_
 
PortableServer::POA_var poa_
 Implement a different _default_POA(). More...
 

Detailed Description

template<class ITERATOR, class TABLE_ENTRY>
class TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >

This class implements the <BindingIterator> interface that is part of the <CosNaming> idl module. This class works with Hash_Map-based implementations of CosNaming::NamingContext.

This class is templatized by the types of the underlying hash table iterator and hash table entry, so that it can be used for both TAO_Transient_Naming_Context and TAO_Persistent_Naming_Context (and any other classes with underlying data structures supporting ACE_Hash_Map_Manager/Iterator - like interfaces).

Instances of <TAO_Bindings_Iterator>s affect reference counts of corresponding Naming Contexts. Reference count on a Naming Context is incremented by one for a lifetime of each instance of <TAO_Bindings_Iterator> created for that context, i.e., a Naming Context cannot be cleaned up (but, of course, it can be invalidated) before all of its iterators have been cleaned up. When <destroy> method is invoked on a Naming Context, all of its iterators are destroyed in a "lazy evaluation" fashion, i.e., whenever a next operation is invoked on an iterator, and it can detect that the corresponding Naming Context has been invalidated, the iterator is destroyed.

Constructor & Destructor Documentation

template<class ITERATOR , class TABLE_ENTRY >
TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::TAO_Bindings_Iterator ( TAO_Hash_Naming_Context context,
ITERATOR *  hash_iter,
PortableServer::POA_ptr  poa,
TAO_SYNCH_RECURSIVE_MUTEX lock 
)

Constructor expects a pointer to a dynamically allocated hash map iterator (destructor deallocates hash map iterator).

template<class ITERATOR , class TABLE_ENTRY >
TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::~TAO_Bindings_Iterator ( void  )

Destructor.

Member Function Documentation

template<class ITERATOR , class TABLE_ENTRY >
PortableServer::POA_ptr TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::_default_POA ( void  )
virtual

Returns the Default POA of this Servant object.

template<class ITERATOR , class TABLE_ENTRY >
void TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::destroy ( void  )

This operation destroys the iterator.

template<class ITERATOR , class TABLE_ENTRY >
CORBA::Boolean TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::next_n ( CORBA::ULong  how_many,
CosNaming::BindingList_out  bl 
)

This operation passes back at most <how_many> unseen bindings. True is returned if bindings were passed back, and false is returned if no bindings were passed back.

template<class ITERATOR , class TABLE_ENTRY >
CORBA::Boolean TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::next_one ( CosNaming::Binding_out  b)

This operation passes back the next unseen binding. True is returned if a binding is passed back, and false is returned otherwise.

template<class ITERATOR , class TABLE_ENTRY >
int TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::populate_binding ( TABLE_ENTRY *  hash_entry,
CosNaming::Binding b 
)
static

Helper function used by TAO_*_Naming_Context and TAO_BindingIterator: populate a binding with info contained in <hash_entry>. Return 1 if everything went smoothly, 0 if an allocation failed.

Member Data Documentation

template<class ITERATOR , class TABLE_ENTRY >
TAO_Hash_Naming_Context* TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::context_
private

Pointer to the Naming Context we are iterating over. We need this pointer to make sure the context is still valid before each iteration, and to decrement its reference count once we are <destroyed>.

template<class ITERATOR , class TABLE_ENTRY >
bool TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::destroyed_
private

Flag indicating whether this iterator is still valid. (The iterator becomes invalid when <destroy> method has been invoked on it, or when <destroy> method has been invoked on the corresponding Naming Context.) This flag is necessary because immediate destruction of this servant might not be possible due to pending requests in the POA.

template<class ITERATOR , class TABLE_ENTRY >
ITERATOR* TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::hash_iter_
private

A pointer to the hash map iterator.

template<class ITERATOR , class TABLE_ENTRY >
TAO_SYNCH_RECURSIVE_MUTEX& TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::lock_
private

Lock passed on from Naming Context to serialize access to the internal data structure.

template<class ITERATOR , class TABLE_ENTRY >
PortableServer::POA_var TAO_Bindings_Iterator< ITERATOR, TABLE_ENTRY >::poa_
private

Implement a different _default_POA().


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