ImR_Iterator Class Reference

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

#include <Iterator.h>

Collaboration diagram for ImR_Iterator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ImR_Iterator (CORBA::ULong n, Locator_Repository &repo, PortableServer::POA_ptr poa)
virtual CORBA::Boolean next_n (CORBA::ULong how_many, ImplementationRepository::ServerInformationList_out server_list) throw (CORBA::SystemException)
virtual void destroy () throw (CORBA::SystemException)

Private Attributes

Locator_Repositoryrepo_
CORBA::ULong count_
PortableServer::POA_ptr poa_

Detailed Description

The Iterator for servers in the ImR.

Definition at line 31 of file Iterator.h.


Constructor & Destructor Documentation

ImR_Iterator::ImR_Iterator CORBA::ULong  n,
Locator_Repository repo,
PortableServer::POA_ptr  poa
 

Definition at line 15 of file Iterator.cpp.

00016   : repo_(repo)
00017   , count_(n)
00018   , poa_(poa)
00019 {
00020 }


Member Function Documentation

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

Definition at line 84 of file Iterator.cpp.

References ACE_CHECK, and ACE_ENV_ARG_PARAMETER.

00086 {
00087   PortableServer::ObjectId_var oid = poa_->servant_to_id (this ACE_ENV_ARG_PARAMETER);
00088   ACE_CHECK;
00089   poa_->deactivate_object (oid.in() ACE_ENV_ARG_PARAMETER);
00090   ACE_CHECK;
00091 }

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

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

Definition at line 24 of file Iterator.cpp.

References ACE_ASSERT, ACE_NEW_THROW_EX, and Server_Info_Ptr.

00028 {
00029   ACE_NEW_THROW_EX (server_list,
00030     ImplementationRepository::ServerInformationList(0), CORBA::NO_MEMORY());
00031 
00032   Locator_Repository::SIMap::ENTRY* entry = 0;
00033   Locator_Repository::SIMap::ITERATOR it (this->repo_.servers ());
00034 
00035   // Number of servers that will go into the server_list.
00036   CORBA::ULong n = this->repo_.servers().current_size();
00037   if (n <= this->count_)
00038     {
00039       return 0; // We already finished.
00040     }
00041   else
00042     {
00043       n -= this->count_;
00044     }
00045 
00046   if (how_many > 0 && n > how_many)
00047     {
00048       n = how_many;
00049   }
00050 
00051   server_list->length (n);
00052 
00053   CORBA::ULong i = 0;
00054   for (; i < this->count_; ++i)
00055     {
00056       it.advance ();
00057     }
00058 
00059   for (i = 0; i < n; ++i)
00060     {
00061       it.next (entry);
00062       it.advance ();
00063       ACE_ASSERT(entry != 0);
00064 
00065       Server_Info_Ptr info = entry->int_id_;
00066 
00067       server_list[i].server = info->name.c_str ();
00068       server_list[i].startup.command_line = info->cmdline.c_str ();
00069       server_list[i].startup.environment = info->env_vars;
00070       server_list[i].startup.working_directory = info->dir.c_str ();
00071       server_list[i].startup.activation = info->activation_mode;
00072       server_list[i].startup.activator = info->activator.c_str ();
00073       server_list[i].startup.start_limit = info->start_limit;
00074       server_list[i].partial_ior = info->partial_ior.c_str ();
00075     }
00076 
00077   this->count_ += n;
00078 
00079   return 1;
00080 }


Member Data Documentation

CORBA::ULong ImR_Iterator::count_ [private]
 

Definition at line 51 of file Iterator.h.

PortableServer::POA_ptr ImR_Iterator::poa_ [private]
 

Definition at line 52 of file Iterator.h.

Locator_Repository& ImR_Iterator::repo_ [private]
 

Definition at line 50 of file Iterator.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:37:11 2006 for TAO_Implementation_Repository by doxygen 1.3.6