Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

acserrACSbaseExImpl.h

Go to the documentation of this file.
00001 #ifndef _ACS_BASE_EX_IML_H_ 00002 #define _ACS_BASE_EX_IML_H_ 00003 /******************************************************************************* 00004 * ALMA - Atacama Large Millimiter Array 00005 * (c) European Southern Observatory, 2004 00006 * 00007 *This library is free software; you can redistribute it and/or 00008 *modify it under the terms of the GNU Lesser General Public 00009 *License as published by the Free Software Foundation; either 00010 *version 2.1 of the License, or (at your option) any later version. 00011 * 00012 *This library is distributed in the hope that it will be useful, 00013 *but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 *Lesser General Public License for more details. 00016 * 00017 *You should have received a copy of the GNU Lesser General Public 00018 *License along with this library; if not, write to the Free Software 00019 *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * "@(#) $Id: acserrACSbaseExImpl.h,v 1.9 2006/08/08 11:15:22 bjeram Exp $" 00022 * 00023 * who when what 00024 * -------- -------- ---------------------------------------------- 00025 * bjeram 2004-02-13 created 00026 */ 00027 00028 /************************************************************************ 00029 * 00030 *---------------------------------------------------------------------- 00031 */ 00032 00033 #ifndef __cplusplus 00034 #error This is a C++ include file and cannot be used from plain C 00035 #endif 00036 00037 #include "acserr.h" 00038 00039 namespace ACSErr 00040 { 00041 00042 /* 00043 class ErrorTraceForBaseEx 00044 is just continer for errotrace. It is here because errotrace of baseX has to beinitalized before its referenc is sent to ErrorTraceHelper 00045 */ 00046 00047 class ErrorTraceForBaseEx 00048 { 00049 protected: 00050 ErrorTraceForBaseEx(); 00051 ErrorTraceForBaseEx(ACSErr::ErrorTrace &errortrace) : 00052 m_errorTrace (errortrace){} // ??? can be removed when errotrace is just in baseEx !!! 00053 ErrorTraceForBaseEx(const ACSErr::ErrorTrace &errortrace) : 00054 m_errorTrace (errortrace){} 00055 00056 ErrorTrace m_errorTrace; 00057 }; 00058 00059 /* 00060 this class shall not be instantiated by user but only bt the derived classes 00061 */ 00062 00063 class ACSbaseExImpl : public ErrorTraceForBaseEx, public ErrorTraceHelper 00064 { 00065 protected: 00066 00067 // create new error trace 00068 ACSbaseExImpl (ACSErr::ACSErrType et, ACSErr::ErrorCode ec, 00069 const char* file, int line, const char* routine, const char* sd, 00070 ACSErr::Severity severity); 00071 00072 // adding previos error trace 00073 ACSbaseExImpl (const ACSErr::ErrorTrace &pet, 00074 ACSErr::ACSErrType et, ACSErr::ErrorCode ec, 00075 const char* file, int line, const char* routine, const char* sd, 00076 ACSErr::Severity severity); 00077 00078 00079 // for remote exceptions 00080 ACSbaseExImpl(const ACSErr::ErrorTrace &et); 00081 00082 ACSbaseExImpl(ACSErr::ErrorTrace &et); 00083 00084 // for OK cases and wrapping completion 00085 ACSbaseExImpl(ACSErr::ErrorTrace &et, int depth); 00086 00087 public: 00088 00092 ACSbaseEx getACSbaseEx() { return ACSbaseEx(m_errorTrace); } 00093 00097 ACSbaseExImpl (const ACSbaseExImpl &t); 00098 00102 ACSbaseExImpl& operator=(const ACSbaseExImpl &t); 00103 00104 }; 00105 00106 }; //namespace ACSErr 00107 00108 template <class T> 00109 class ETHolder 00110 { 00111 public: 00112 ETHolder(const CORBA::UserException &ex) : 00113 m_errorTrace (((T&)ex).errorTrace) {} 00114 00115 00116 ETHolder(const CompletionImpl &c) : 00117 m_errorTrace( const_cast<CompletionImpl&>(c).isErrorFree() ? this->emptyErrorTrace : const_cast<ACSErr::ErrorTrace&>(c.previousError[0])) {} 00118 /*const_cast<CompletionImpl&>(c).getErrorTraceHelper()->getErrorTrace()*/ 00119 00120 00121 /* this will be used later */ 00122 00123 ETHolder(const ACSErr::ACSbaseExImpl &ex) : 00124 m_errorTrace( const_cast<ACSErr::ACSbaseExImpl&>(ex).getErrorTrace() ) {} 00125 00126 ETHolder(ACSErr::ACSbaseExImpl &ex) : 00127 m_errorTrace( ex.getErrorTrace() ) {} 00128 00129 ACSErr::ErrorTrace& getErrorTrace() const { return m_errorTrace; } 00130 00131 private: 00132 ETHolder(const ETHolder<T>&) {} 00133 00134 ACSErr::ErrorTrace &m_errorTrace; 00135 ACSErr::ErrorTrace emptyErrorTrace; 00136 }; 00137 00138 #endif

Generated on Thu Apr 30 02:30:48 2009 for ACS C++ API by doxygen 1.3.8