ACE_Service_Config_Guard Class Reference

A guard class, designed to be instantiated on the stack. More...

#include <Service_Config.h>

Collaboration diagram for ACE_Service_Config_Guard:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Service_Config_Guard (ACE_Service_Gestalt *psg)
 ~ACE_Service_Config_Guard (void)

Private Member Functions

 ACE_Service_Config_Guard (const ACE_Service_Config_Guard &)
ACE_Service_Config_Guardoperator= (const ACE_Service_Config_Guard &)

Private Attributes

ACE_Service_Gestaltsaved_

Detailed Description

A guard class, designed to be instantiated on the stack.

Instantiating it with a specific configuration ensures any references to ACE_Service_Config::instance(), even when occuring in static constructors, will allways access the designated configuration instance. This comes very handy when a dynamic service also registers any static services of its own and their static factories.

Definition at line 619 of file Service_Config.h.


Constructor & Destructor Documentation

ACE_Service_Config_Guard::ACE_Service_Config_Guard ACE_Service_Gestalt psg  ) 
 

Definition at line 45 of file Service_Config.cpp.

References ACE_DEBUG, ACE_TEXT, ACE_Service_Config::current(), ACE::debug(), LM_DEBUG, ACE_Service_Gestalt::repo_, and saved_.

00046   : saved_ (ACE_Service_Config::instance ())
00047 {
00048   if (ACE::debug ())
00049     ACE_DEBUG ((LM_DEBUG,
00050                 ACE_TEXT ("ACE (%P|%t) Service_Config_Guard:<ctor=%@>")
00051                 ACE_TEXT (" - config=%@ repo=%@ superceded by repo=%@\n"),
00052                 this,
00053                 this->saved_,
00054                 this->saved_->repo_,
00055                 psg->repo_));
00056 
00057   // Modify the TSS if the repo has changed
00058   if (saved_ != psg)
00059       (void)ACE_Service_Config::current (psg);
00060 }

ACE_Service_Config_Guard::~ACE_Service_Config_Guard void   ) 
 

Definition at line 62 of file Service_Config.cpp.

References ACE_DEBUG, ACE_TEXT, ACE_Service_Config::current(), ACE::debug(), and LM_DEBUG.

00063 {
00064   ACE_Service_Config::current (this->saved_);
00065 
00066   if (ACE::debug ())
00067     ACE_DEBUG ((LM_DEBUG,
00068                 ACE_TEXT ("ACE (%P|%t) Service_Config_Guard:<dtor=%@>")
00069                 ACE_TEXT (" - new repo=%@\n"),
00070                 this,
00071                 this->saved_->repo_));
00072 }

ACE_Service_Config_Guard::ACE_Service_Config_Guard const ACE_Service_Config_Guard  )  [private]
 


Member Function Documentation

ACE_Service_Config_Guard& ACE_Service_Config_Guard::operator= const ACE_Service_Config_Guard  )  [private]
 


Member Data Documentation

ACE_Service_Gestalt* ACE_Service_Config_Guard::saved_ [private]
 

Definition at line 631 of file Service_Config.h.

Referenced by ACE_Service_Config_Guard().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 12:57:16 2008 for ACE by doxygen 1.3.6