Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# CORBA_Environment Class Reference

CORBA_Environment. More...

`#include <Environment.h>`

Collaboration diagram for CORBA_Environment:

[legend]
List of all members.

## Public Types
typedef CORBA_Environment_ptr | _ptr_type
typedef CORBA_Environment_var | _var_type
## Public Methods
| CORBA_Environment (void)
| The default constructor, the environment will hold no exceptions.
| CORBA_Environment (const CORBA_Environment &ACE_TRY_ENV)
| Copy constructor.
CORBA_Environment& | operator= (const CORBA_Environment &ACE_TRY_ENV)
| Assingment.
| ~CORBA_Environment (void)
| Destructor, release the exception.
int | exception_type (void) const
| Return if the exception is a user exception or a system exception.
const char* | exception_id (void) const
| return the repository ID for the exception.
void | clear (void)
| Clear the exception.
void | print_exception (const char *info, FILE *f=stdout) const
| Print the exception to output determined by f. This function is not CORBA compliant.
## Public Attributes
CORBA_Exception* exception void | const
| Return the exception. Caller must call <_incr_refcnf> in order to keep the ptr.
void exception CORBA_Exception* | ex
| Set the exception to <ex>, taking a reference on it.
## Static Public Methods
CORBA_Environment* | _duplicate (CORBA_Environment *)
| Some static methods that need to be defined in every pseudo object.
CORBA_Environment* | _nil (void)
CORBA_Environment& | default_environment (void)
## Private Methods
| CORBA_Environment (TAO_ORB_Core *orb_core)
## Private Attributes
CORBA_Exception* | exception_
| Pointer to the exception object contained in the environment.
CORBA_Environment* | previous_
| The previous environment on the "default environment stack".
## Friends
class | TAO_ORB_Core

## Detailed Description

CORBA_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

typedef CORBA_Environment_ptr CORBA_Environment::_ptr_type

typedef CORBA_Environment_var CORBA_Environment::_var_type

## Constructor & Destructor Documentation

CORBA_Environment::CORBA_Environment ( | void )`[inline]`

| The default constructor, the environment will hold no exceptions.

CORBA_Environment::CORBA_Environment ( | const CORBA_Environment & ACE_TRY_ENV )

| Copy constructor.

CORBA_Environment::~CORBA_Environment ( | void )

| Destructor, release the exception.

CORBA_Environment::CORBA_Environment ( | TAO_ORB_Core * orb_core )`[private]`

## 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 CORBA_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.

## Friends And Related Function Documentation

class TAO_ORB_Core`[friend]`

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

## Member Data Documentation

CORBA_Exception *exception void CORBA_Environment::const

| Return the exception. Caller must call <_incr_refcnf> in order to keep the ptr.

void exception CORBA_Exception * CORBA_Environment::ex

| Set the exception to <ex>, taking a reference on it.

CORBA_Exception * CORBA_Environment::exception_`[private]`

| Pointer to the exception object contained in the environment.

CORBA_Environment * CORBA_Environment::previous_`[private]`

| The previous environment on the "default environment stack".

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

- Environment.h
- Environment.cpp
- Environment.i