TAO  2.3.3
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
CORBA::Environment Class Reference

Environment. More...

#include <Environment.h>

Collaboration diagram for CORBA::Environment:
Collaboration graph
[legend]

Public Types

typedef CORBA::Environment_ptr _ptr_type
 
typedef CORBA::Environment_var _var_type
 
typedef CORBA::Environment_out _out_type
 

Public Member Functions

 Environment (void)
 
 Environment (const Environment &ACE_TRY_ENV)
 Copy constructor. More...
 
Environmentoperator= (const Environment &ACE_TRY_ENV)
 Assingment. More...
 
 ~Environment (void)
 Destructor, release the exception. More...
 
int exception_type (void) const
 
const char * exception_id (void) const
 return the repository ID for the exception. More...
 
void clear (void)
 Clear the exception. More...
 
void print_exception (const char *info, FILE *f=stdout) const
 

Static Public Member Functions

static Environment_duplicate (Environment *)
 Some static methods that need to be defined in every pseudo object. More...
 
static Environment_nil (void)
 
static CORBA::Environmentdefault_environment (void)
 

Public Attributes

CORBA::Exception *exception void const
 Return the contained CORBA::Exception. More...
 
void exception CORBA::Exceptionex
 Set the contained CORBA::Exception to ex. More...
 

Private Member Functions

 Environment (TAO_ORB_Core *orb_core)
 

Private Attributes

CORBA::Exceptionexception_
 Pointer to the exception object contained in the environment. More...
 
Environmentprevious_
 The previous environment on the "default environment stack". More...
 

Detailed Description

Environment.

A CORBA::Environment is a way to automagically ensure that exception data is freed – the "var" class for Exceptions. It adds just a bit of convenience function support, helping classify exceptions as well as reducing memory leakage. The thread has a default environment to simplify porting between platforms that support native C++ exceptions and those that don't. This is a TSS resource (always), but with a twist: if the user creates a new environment the old one is "pushed" (actually the new one remembers it), eventually the new environment destructor pops itself from the stack and we recover the old environment. This means that if the user create a new environment and somebody calls a function using the default one the exception will still be received in the environment created by the user. The only drawback is that environments life time must nest properly, this shouldn't be a problem because environments are usually created on the stack, but, the spec allows their creation on the heap and/or as class members; we need to investigate the tradeoffs and take a decision.

Member Typedef Documentation

Constructor & Destructor Documentation

CORBA::Environment::Environment ( void  )

The default constructor. The environment will hold no exceptions.

CORBA::Environment::Environment ( const Environment ACE_TRY_ENV)

Copy constructor.

CORBA::Environment::~Environment ( void  )

Destructor, release the exception.

CORBA::Environment::Environment ( TAO_ORB_Core orb_core)
private

Initialize using a well known ORB Core; this is intended for the bootstrapping of the ORB_Core, not for general consumption.

Member Function Documentation

ACE_INLINE CORBA::Environment * CORBA::Environment::_duplicate ( CORBA::Environment x)
static

Some static methods that need to be defined in every pseudo object.

ACE_INLINE CORBA::Environment_ptr CORBA::Environment::_nil ( void  )
static
void CORBA::Environment::clear ( void  )

Clear the exception.

CORBA::Environment & CORBA::Environment::default_environment ( void  )
static
const char * CORBA::Environment::exception_id ( void  ) const

return the repository ID for the exception.

int CORBA::Environment::exception_type ( void  ) const

Return if the exception is a user exception or a system exception.

CORBA::Environment & CORBA::Environment::operator= ( const Environment ACE_TRY_ENV)

Assingment.

void CORBA::Environment::print_exception ( const char *  info,
FILE *  f = stdout 
) const

Print the exception to output determined by f. This function is not CORBA compliant.

Member Data Documentation

CORBA::Exception* exception void CORBA::Environment::const

Return the contained CORBA::Exception.

CORBA::Environment retains ownership of the exception, this is contrary to the normal memory management rules in the C++ mapping, but actually mandated by the specification:

"C++ Language Mapping" (formal/00-01-02). Section 1.27 Environment (page 1-113)

void exception CORBA::Exception* CORBA::Environment::ex

Set the contained CORBA::Exception to ex.

CORBA::Environment assumes ownership of the exception, this is contrary to the normal memory management rules in the C++ mapping, but actually mandated by the specification:

"C++ Language Mapping" (formal/00-01-02). Section 1.27 Environment (page 1-113)

CORBA::Exception* CORBA::Environment::exception_
private

Pointer to the exception object contained in the environment.

Environment* CORBA::Environment::previous_
private

The previous environment on the "default environment stack".


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