Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Registry::Binding_Iterator::Context_Iteration Class Reference

Inheritance diagram for ACE_Registry::Binding_Iterator::Context_Iteration:

Inheritance graph
[legend]
Collaboration diagram for ACE_Registry::Binding_Iterator::Context_Iteration:

Collaboration graph
[legend]
List of all members.

Public Methods

 Context_Iteration (Binding_Iterator &iterator)
int next_n (u_long how_many, Binding_List &list)
 Next <how_many> entries. More...


Constructor & Destructor Documentation

ACE_Registry::Binding_Iterator::Context_Iteration::Context_Iteration Binding_Iterator   iterator
 

Definition at line 851 of file Registry.cpp.

References ACE_Registry::Binding_Iterator::Binding_Iterator, and ACE_Registry::Binding_Iterator::Iteration_State.

00852   : Iteration_State (iter)
00853 {
00854 }


Member Function Documentation

int ACE_Registry::Binding_Iterator::Context_Iteration::next_n u_long    how_many,
Binding_List   list
[virtual]
 

Next <how_many> entries.

Implements ACE_Registry::Binding_Iterator::Iteration_State.

Definition at line 1005 of file Registry.cpp.

References ACE_TCHAR, ACE_Registry::Binding_Iterator::Iteration_State::index_, ACE_Unbounded_Set::insert, ACE_Registry::Naming_Context::MAX_CONTEXT_NAME_SIZE, and ACE_Registry::Binding_Iterator::Iteration_State::parent_.

01007 {
01008   // Make a copy
01009   u_long requested = how_many;
01010 
01011   // While there are more entries to be added to the list
01012   while (how_many > 0)
01013     {
01014       ACE_TCHAR string [ACE_Registry::Naming_Context::MAX_CONTEXT_NAME_SIZE];
01015       u_long size = sizeof string / sizeof (ACE_TCHAR);
01016       long result = ACE_TEXT_RegEnumKeyEx (this->parent_->naming_context (). key (),
01017                                            this->index_,
01018                                            string,
01019                                            &size,
01020                                            0,
01021                                            0,
01022                                            0,
01023                                            0);
01024       switch (result)
01025         {
01026         case ERROR_SUCCESS:
01027           // Object found
01028           {
01029             // Readjust counters
01030             this->index_++;
01031             how_many--;
01032 
01033             // Add to list
01034             // Create binding
01035             Binding binding (string, CONTEXT);
01036             // Add to binding list
01037             list.insert (binding);
01038           }
01039         // Continue to add to list
01040         break;
01041 
01042         case ERROR_NO_MORE_ITEMS:
01043           // Enumeration of objects complete
01044 
01045           /* FALL THROUGH */
01046 
01047         default:
01048           // Strange error
01049 
01050           // Reset index
01051           this->index_ = 0;
01052           // Current enumeration will become CONTEXTS
01053           this->parent_->current_enumeration (this->parent_->iteration_complete_);
01054 
01055           // If we were able to add contexts
01056           if (requested != how_many)
01057             return 0;
01058           else
01059             return -1;
01060         }
01061     }
01062   // If we reach here, all of <how_many> pairs were added to the list
01063   // Since more entries may be available
01064   // current enumeration will remain CONTEXTS
01065   return 0;
01066 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:55:11 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002