user_ty::become Class Reference

#include <user.h>


Public Member Functions

 become (user_ty::pointer a_up)
 ~become ()

Private Member Functions

 become (const become &)
becomeoperator= (const become &)

Private Attributes

user_ty::pointer up


Detailed Description

The user_ty::become class is used to take care of becoming a user, and then ceasing to become that user at the end of the scope. For example:

{ user_ty::become scoped(up); ...glue... if (something) return; ...execute... }

No matter how the flow of execution leaves the scope (break, continue, return, exceptions) the become_end will always occur, because the destructor is automatically called by the compiler.

This is an example of the Resoure Acquisition Is Initialisation (RAII) design pattern.

Definition at line 386 of file user.h.


Constructor & Destructor Documentation

user_ty::become::become ( user_ty::pointer  a_up  )  [inline]

The constructor. Start impersonating the user.

Definition at line 392 of file user.h.

user_ty::become::~become (  )  [inline]

The destructor. Stop impersonating the user.

Definition at line 401 of file user.h.

user_ty::become::become ( const become  )  [private]

The copy constructor. Do not use.


Member Function Documentation

become& user_ty::become::operator= ( const become  )  [private]

The assignment operator. Do not use.


Field Documentation

The up instance variable is used to remember which user is being impersonated.

Definition at line 411 of file user.h.


The documentation for this class was generated from the following file:

Generated on Wed Mar 12 23:37:45 2008 for Aegis by  doxygen 1.5.5