diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2003-02-20 17:20:52 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2003-02-20 17:20:52 +0000 |
commit | 82b5c6cfc962509b662c157658ed2846fa44a108 (patch) | |
tree | 05e044b047e36dd6705dd881c6e5372cc7307152 /TAO/tao/Environment.h | |
parent | 1edb96d85b266e120d4d9446fd78942345b0b10d (diff) | |
download | ATCD-82b5c6cfc962509b662c157658ed2846fa44a108.tar.gz |
AbstractBase.*
Diffstat (limited to 'TAO/tao/Environment.h')
-rw-r--r-- | TAO/tao/Environment.h | 320 |
1 files changed, 161 insertions, 159 deletions
diff --git a/TAO/tao/Environment.h b/TAO/tao/Environment.h index 1779f5b6687..eb420bc1657 100644 --- a/TAO/tao/Environment.h +++ b/TAO/tao/Environment.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -6,14 +6,13 @@ * * $Id$ * - * Declare the CORBA_Environment class. Note that this header file + * Declare the CORBA::Environment class. Note that this header file * only requires a few forward declarations of CORBA classes, this * is *very* important because even the ORB needs to know about it; * make your changes with care. It is also a good idea trying to * minimize cross dependencies between header files. * - * - * @author Carlos O'Ryan <coryan@cs.wustl.edu> + * @author Carlos O'Ryan <coryan@cs.wustl.edu> */ //============================================================================= @@ -30,177 +29,180 @@ class TAO_ORB_Core; -/** - * @class CORBA_Environment - * - * @brief 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. - */ -class TAO_Export CORBA_Environment +namespace CORBA { -public: - // = Initialization and termination methods. - /// The default constructor, the environment will hold no exceptions. - CORBA_Environment (void); - - /// Copy constructor. - CORBA_Environment (const CORBA_Environment &ACE_TRY_ENV); - - /// Assingment. - CORBA_Environment &operator=(const CORBA_Environment &ACE_TRY_ENV); - - /// Destructor, release the exception. - ~CORBA_Environment (void); - - /// Some static methods that need to be defined in every pseudo object - static CORBA_Environment * _duplicate (CORBA_Environment *); - static CORBA_Environment * _nil (void); - - /// 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: + * @class Environment * - * "C++ Language Mapping" (formal/00-01-02). Section 1.27 - * Environment (page 1-113) + * @brief 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. */ - CORBA_Exception* exception (void) const; - - /// 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) - * - */ - void exception (CORBA_Exception *ex); - - /// Return if the exception is a user exception or a system - /// exception. - int exception_type (void) const; - - /// return the repository ID for the exception. - const char *exception_id (void) const; - - /// Clear the exception. - void clear (void); - - /// Print the exception to output determined by f. This function is - /// not CORBA compliant. - void print_exception (const char *info, - FILE *f=stdout) const; - - // = Obtain a default environment to use with TAO. - static CORBA_Environment &default_environment (void); + class TAO_Export Environment + { + public: + /// The default constructor. The environment will hold no + /// exceptions. + Environment (void); + + /// Copy constructor. + Environment (const Environment &ACE_TRY_ENV); + + /// Assingment. + Environment &operator=(const Environment &ACE_TRY_ENV); + + /// Destructor, release the exception. + ~Environment (void); + + /// Some static methods that need to be defined in every pseudo object + static Environment * _duplicate (Environment *); + static Environment * _nil (void); + + /// 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) + */ + CORBA::Exception* exception (void) const; + + /// 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) + * + */ + void exception (CORBA::Exception *ex); + + /// Return if the exception is a user exception or a system + /// exception. + int exception_type (void) const; + + /// return the repository ID for the exception. + const char *exception_id (void) const; + + /// Clear the exception. + void clear (void); + + /// Print the exception to output determined by f. This function + /// is not CORBA compliant. + void print_exception (const char *info, + FILE *f=stdout) const; + + // = Obtain a default environment to use with TAO. + static CORBA::Environment &default_environment (void); #if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 - typedef CORBA_Environment_ptr _ptr_type; - typedef CORBA_Environment_var _var_type; + // Useful for template programming. + typedef CORBA::Environment_ptr _ptr_type; + typedef CORBA::Environment_var _var_type; #endif /* __GNUC__ */ - // Useful for template programming. -private: + private: - /// Initialize using a well known ORB Core; this is intended for the - /// bootstraping of the ORB_Core, not for general consumption. - friend class TAO_ORB_Core; - CORBA_Environment (TAO_ORB_Core *orb_core); + /// Initialize using a well known ORB Core; this is intended for + /// the bootstraping of the ORB_Core, not for general + /// consumption. + friend class TAO_ORB_Core; + Environment (TAO_ORB_Core *orb_core); - /// Pointer to the exception object contained in the environment. - CORBA_Exception *exception_; + /// Pointer to the exception object contained in the environment. + CORBA::Exception *exception_; - /// The previous environment on the "default environment stack". - CORBA_Environment *previous_; -}; + /// The previous environment on the "default environment stack". + Environment *previous_; + }; -/** - * @class CORBA_Environment_var - * - * @brief CORBA_Environment_var - * - * Provide for automatic storage deallocation on going out of - * scope. - */ -class TAO_Export CORBA_Environment_var -{ -public: /** - * default constructor - * copy constructor - * destructor + * @class Environment_var + * + * @brief Environment_var + * + * Provide for automatic storage deallocation on going out of + * scope. */ - CORBA_Environment_var (void); - CORBA_Environment_var (CORBA_Environment_ptr); - CORBA_Environment_var (const CORBA_Environment_var &); - ~CORBA_Environment_var (void); - - CORBA_Environment_var &operator= (CORBA_Environment_ptr); - CORBA_Environment_var &operator= (const CORBA_Environment_var &); - CORBA_Environment_ptr operator-> (void) const; - - /// in, inout, out, _retn - operator const CORBA_Environment_ptr &() const; - operator CORBA_Environment_ptr &(); - CORBA_Environment_ptr in (void) const; - CORBA_Environment_ptr &inout (void); - CORBA_Environment_ptr &out (void); - CORBA_Environment_ptr _retn (void); - CORBA_Environment_ptr ptr (void) const; - -private: - CORBA_Environment_ptr ptr_; -}; + class TAO_Export Environment_var + { + public: + /** + * default constructor + * copy constructor + * destructor + */ + Environment_var (void); + Environment_var (CORBA::Environment_ptr); + Environment_var (const Environment_var &); + ~Environment_var (void); + + Environment_var &operator= (CORBA::Environment_ptr); + Environment_var &operator= (const Environment_var &); + CORBA::Environment_ptr operator-> (void) const; + + /// in, inout, out, _retn + operator const CORBA::Environment_ptr &() const; + operator CORBA::Environment_ptr &(); + CORBA::Environment_ptr in (void) const; + CORBA::Environment_ptr &inout (void); + CORBA::Environment_ptr &out (void); + CORBA::Environment_ptr _retn (void); + CORBA::Environment_ptr ptr (void) const; + + private: + CORBA::Environment_ptr ptr_; + }; -/** - * @class CORBA_Environment_out - * - * @brief CORBA_Environment_out - * - * The _out class for CORBA_Environment. This is used to help in - * managing the out parameters. - */ -class TAO_Export CORBA_Environment_out -{ -public: - CORBA_Environment_out (CORBA_Environment_ptr &); - CORBA_Environment_out (CORBA_Environment_var &); - CORBA_Environment_out (const CORBA_Environment_out &); - CORBA_Environment_out &operator= (const CORBA_Environment_out &); - CORBA_Environment_out &operator= (CORBA_Environment_ptr); - operator CORBA_Environment_ptr &(); - CORBA_Environment_ptr &ptr (void); - CORBA_Environment_ptr operator-> (void); - -private: - CORBA_Environment_ptr &ptr_; - - /// Assignment from _var not allowed. - CORBA_Environment_out &operator= (const CORBA_Environment_var &); -}; + /** + * @class Environment_out + * + * @brief Environment_out + * + * The _out class for CORBA::Environment. This is used to help in + * managing the out parameters. + */ + class TAO_Export Environment_out + { + public: + Environment_out (Environment_ptr &); + Environment_out (Environment_var &); + Environment_out (const Environment_out &); + Environment_out &operator= (const Environment_out &); + Environment_out &operator= (CORBA::Environment_ptr); + operator CORBA::Environment_ptr &(); + CORBA::Environment_ptr &ptr (void); + CORBA::Environment_ptr operator-> (void); + + private: + Environment_ptr &ptr_; + + /// Assignment from _var not allowed. + Environment_out &operator= (const CORBA::Environment_var &); + }; +} // End CORBA namespace #if defined (__ACE_INLINE__) # include "tao/Environment.i" |