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)
virtual void destroy (void)

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 void   )  [virtual]
 

Definition at line 82 of file Iterator.cpp.

00083 {
00084   PortableServer::ObjectId_var oid = poa_->servant_to_id (this);
00085   poa_->deactivate_object (oid.in());
00086 }

CORBA::Boolean ImR_Iterator::next_n CORBA::ULong  how_many,
ImplementationRepository::ServerInformationList_out  server_list
[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, Server_Info_Ptr, and Locator_Repository::servers().

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


Member Data Documentation

CORBA::ULong ImR_Iterator::count_ [private]
 

Definition at line 48 of file Iterator.h.

PortableServer::POA_ptr ImR_Iterator::poa_ [private]
 

Definition at line 49 of file Iterator.h.

Locator_Repository& ImR_Iterator::repo_ [private]
 

Definition at line 47 of file Iterator.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 15:55:47 2008 for TAO_Implementation_Repository by doxygen 1.3.6