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

ImR_Iterator Class Reference

The Iterator for servers in the ImR. More...

#include <Iterator.h>

Inheritance diagram for ImR_Iterator:

Inheritance graph
[legend]
Collaboration diagram for ImR_Iterator:

Collaboration graph
[legend]
List of all members.

Public Methods

 ImR_Iterator (Server_Repository::HASH_IMR_ITER *iterator, PortableServer::POA_ptr poa)
 Constructor Ownership of iterator is transfered to this class (we'll delete it). More...

 ~ImR_Iterator ()
 Destructor. More...

virtual CORBA::Boolean next_n (CORBA::ULong how_many, ImplementationRepository::ServerInformationList_out server_list ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException)
 Returns the next list of up to <how_many> servers. If empty, will return false. More...

virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException)
 Destroys the iterator. More...


Private Attributes

Server_Repository::HASH_IMR_ITERiterator_
 Our very own iterator for transversing the server repository. More...

PortableServer::POA_var poa_
 Our lovely POA. More...


Detailed Description

The Iterator for servers in the ImR.

Definition at line 27 of file Iterator.h.


Constructor & Destructor Documentation

ImR_Iterator::ImR_Iterator Server_Repository::HASH_IMR_ITER   iterator,
PortableServer::POA_ptr    poa
 

Constructor Ownership of iterator is transfered to this class (we'll delete it).

Definition at line 17 of file Iterator.cpp.

References Server_Repository::HASH_IMR_ITER.

00019   : iterator_ (iterator),
00020     poa_ (poa)
00021 {
00022   // Nothing
00023 }

ImR_Iterator::~ImR_Iterator  
 

Destructor.

Definition at line 28 of file Iterator.cpp.

References iterator_.

00029 {
00030   delete iterator_;
00031 }


Member Function Documentation

void ImR_Iterator::destroy ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS    throw (CORBA::SystemException) [virtual]
 

Destroys the iterator.

Implements POA_ImplementationRepository::ServerInformationIterator.

Definition at line 98 of file Iterator.cpp.

References ACE_ENV_SINGLE_ARG_DECL_NOT_USED.

00100 {
00101 }

CORBA::Boolean ImR_Iterator::next_n CORBA::ULong    how_many,
ImplementationRepository::ServerInformationList_out server_list    ACE_ENV_ARG_DECL_WITH_DEFAULTS
throw (CORBA::SystemException) [virtual]
 

Returns the next list of up to <how_many> servers. If empty, will return false.

Implements POA_ImplementationRepository::ServerInformationIterator.

Definition at line 38 of file Iterator.cpp.

References ACE_CString, ACE_ENV_ARG_DECL, ACE_NEW_THROW_EX, Server_Repository::HASH_IMR_ENTRY, and CORBA::string_dup.

00042 {
00043   ACE_NEW_THROW_EX (server_list,
00044                     ImplementationRepository::ServerInformationList (0),
00045                     CORBA::NO_MEMORY ());
00046 
00047   // If there are no more bindings...
00048   if (this->iterator_->done ())
00049     return 0; // Return false
00050 
00051   // Initially assume that iterator has the requested number of
00052   // bindings.
00053   server_list->length (how_many);
00054 
00055   Server_Repository::HASH_IMR_ENTRY *server_entry;
00056 
00057   // Iterate and populate the BindingList.
00058 
00059   for (CORBA::ULong i = 0; i < how_many; i++)
00060     {
00061       this->iterator_->next (server_entry);
00062 
00063       ACE_CString logical, server, command_line, working_directory, location, server_ior;
00064       ImplementationRepository::EnvironmentList environment_vars;
00065       ImplementationRepository::ActivationMode activation =
00066         ImplementationRepository::NORMAL;
00067 
00068       server_entry->int_id_->get_running_info (location, server_ior);
00069       server_entry->int_id_->get_startup_info (logical,
00070                                                command_line,
00071                                                environment_vars,
00072                                                working_directory,
00073                                                activation);
00074 
00075       server_list[i].logical_server = CORBA::string_dup (logical.c_str ());
00076       server_list[i].server = CORBA::string_dup (server_entry->ext_id_.c_str ());
00077       server_list[i].startup.command_line = CORBA::string_dup (command_line.c_str ());
00078       server_list[i].startup.environment = environment_vars;
00079       server_list[i].startup.working_directory = CORBA::string_dup (working_directory.c_str ());
00080       server_list[i].startup.activation = activation;
00081       server_list[i].location = CORBA::string_dup (location.c_str ());
00082 
00083       if (this->iterator_->advance () == 0)
00084         {
00085           // If no more servers left, reset length to the actual
00086           // number servers and get out of the loop.
00087           server_list->length (i + 1);
00088           break;
00089         }
00090     }
00091   return 1;
00092 }


Member Data Documentation

Server_Repository::HASH_IMR_ITER* ImR_Iterator::iterator_ [private]
 

Our very own iterator for transversing the server repository.

Definition at line 54 of file Iterator.h.

Referenced by ~ImR_Iterator.

PortableServer::POA_var ImR_Iterator::poa_ [private]
 

Our lovely POA.

Definition at line 57 of file Iterator.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 20:03:19 2003 for TAO_Implementation_Repository by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002