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)
 ctor
 ~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_Intrusive_Auto_Ptr< 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 660 of file Service_Config.h.


Constructor & Destructor Documentation

ACE_Service_Config_Guard::ACE_Service_Config_Guard ( ACE_Service_Gestalt psg  ) 

ctor

Definition at line 108 of file Service_Config.cpp.

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

00109   : saved_ (ACE_Service_Config::current ())
00110 {
00111   if (ACE::debug ())
00112     ACE_DEBUG ((LM_DEBUG,
00113                 ACE_TEXT ("ACE (%P|%t) SCG:<ctor=%@>")
00114                 ACE_TEXT (" - config=%@ repo=%@ superceded by repo=%@\n"),
00115                 this,
00116                 this->saved_.get (),
00117                 this->saved_->repo_,
00118                 psg->repo_));
00119 
00120   // Modify the TSS if the repo has changed
00121   ACE_Service_Config::current (psg);
00122 }

ACE_Service_Config_Guard::~ACE_Service_Config_Guard ( void   ) 

Definition at line 124 of file Service_Config.cpp.

References ACE_ASSERT, ACE_DEBUG, ACE_TEXT, ACE_Service_Config::current(), ACE::debug(), ACE_Intrusive_Auto_Ptr< X >::get(), LM_DEBUG, and saved_.

00125 {
00126   ACE_Service_Gestalt* s = this->saved_.get ();
00127   ACE_ASSERT (s != 0);
00128 
00129   ACE_Service_Config::current (s);
00130 
00131   if (ACE::debug ())
00132     ACE_DEBUG ((LM_DEBUG,
00133                 ACE_TEXT ("ACE (%P|%t) SCG:<dtor=%@>")
00134                 ACE_TEXT (" - new repo=%@\n"),
00135                 this,
00136                 this->saved_->repo_));
00137 }

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_Intrusive_Auto_Ptr<ACE_Service_Gestalt> ACE_Service_Config_Guard::saved_ [private]

Definition at line 672 of file Service_Config.h.

Referenced by ACE_Service_Config_Guard(), and ~ACE_Service_Config_Guard().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:34 2010 for ACE by  doxygen 1.4.7