libFAUDES

Sections

Index

exception.h

Go to the documentation of this file.
00001 /** @file exception.h Class Exception */
00002 
00003 /* FAU Discrete Event Systems Library (libfaudes)
00004 
00005    Copyright (C) 2006  Bernd Opitz
00006    Exclusive copyright is granted to Klaus Schmidt
00007 
00008    This library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Lesser General Public
00010    License as published by the Free Software Foundation; either
00011    version 2.1 of the License, or (at your option) any later version.
00012 
00013    This library is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Lesser General Public License for more details.
00017 
00018    You should have received a copy of the GNU Lesser General Public
00019    License along with this library; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00021 
00022 
00023 #ifndef FAUDES_EXCEPTION_H
00024 #define FAUDES_EXCEPTION_H
00025 
00026 #include "definitions.h"
00027 #include "helper.h"
00028 #include <exception>
00029 #include <string>
00030 
00031 namespace faudes {
00032 
00033 /**
00034  * Faudes exception class. libFAUDES uses the C++ exception mechanism to
00035  * report errors on file IO and all sorts of invalid arguments. Members are
00036  *
00037  * @param Function
00038  *   Function name (where did the exception happen)
00039  * @param Description
00040  *   Detailed description (human readable comment)
00041  * @param ErrorId
00042  *   Error id (numeric id, see below)
00043 
00044  * Define the compiletime option FAUDES_DEBUG_EXCEPTIONS  
00045  * to enable verbose output when exceptions are thrown, including those that are catched
00046  * on another level. Define the compiletime option FAUDES_CHECKED to turn
00047  * on argument validation on both internal and user functions.   
00048  *
00049  *
00050  *
00051  * (File-) System Errors
00052  *
00053  *    - 0: Error not defined or no error id given
00054  *    - 1: ios::failure thrown while opening/reading/seeking file
00055  *    - 2: ios::failure thrown while opening/writing file
00056  *    - 3: error on in systemcall (eg dot)
00057  *
00058  * Symboltable Errors
00059  *
00060  *   - 40: SymbolTable - overflow
00061  *   - 41: SymbolTable - attempt to insert or set name which already exists
00062  *   - 42: SymbolTable - attempt to insert or set index which already exists
00063  *   - 43: SymbolTable - attempt to insert or set invalid name 
00064  *
00065  * Runtime interface error
00066  *
00067  *   - 45: Registry - attempt to insert invalid entry
00068  *   - 46: Registry - attempt to access non existent entry
00069  *   - 47: Registry - parameter index out of range
00070  *   - 48: Registry - type check error
00071  *   - 49: Registry - function execution error
00072  *
00073  * Token IO Errors
00074  *
00075  *   - 50: TokenReader: token mismatch 
00076  *   - 51: TokenReader: label not found
00077  *   - 52: TokenReader: unbalanced SeekEnd() 
00078  *
00079  * Container Classes Errors
00080  *
00081  *   - 60: IndexSet:   index not found (eg. when accessing attribute)
00082  *   - 61: IndexSet:   attempt to insert invalid index 0
00083  *   - 62: BaseSet:    invalid iterator
00084  *   - 63: BaseSet:    invalid attribute access
00085  *   - 65: NameSet:    referring to index with no symbolic name
00086  *   - 66: NameSet:    referring unknown symbolic name
00087  *   - 67: NameSet:    symboltable mismatch
00088  *   - 68: TransSet:   order mismatch
00089  *   - 69: BaseVector: invalid index
00090  *
00091  * Core Generator Classes Errors
00092  *
00093  *   - 80: Generator: reading invalid stateset 
00094  *   - 85: Generator: reading invalid transition set 
00095  *   - 88: Generator: symbol table mismatch
00096  *   - 89: Generator: referring to unkown event name
00097  *   - 90: Generator: referring to unkown state name
00098  *   - 91: Generator: setting transition/initial/marked property for unkown state
00099  *   - 92: Generator: initial state does not exist uniquely
00100  *   - 95: Generator: transition referring to unknown states/event
00101  *   - 96: Generator: source must not match destination
00102  *   - 99: Generator: internal validity check failed
00103  *
00104  *  
00105  * Generator Operation Errors
00106  *
00107  *   - 100: Alphabet mismatch
00108  *   - 101: Nondeterministic argument
00109  *   - 1xx  See respective functions
00110  *   - 2xx  See respective functions
00111  *
00112  * Exception ids between 300 and 999 are used by LRT plugins. 
00113  *
00114  *   - 55x IODevice
00115  *
00116  */
00117 class Exception : public std::exception {
00118   public:
00119     /**
00120      * Constructor
00121      *
00122      * Writes an error message on stderr.
00123      * 
00124      * @param rFunctionName
00125      *   Function name (where did the exception happen)
00126      * @param rDescription
00127      *   Detailed error description
00128      * @param errorId
00129      *   Error id
00130      */
00131     explicit Exception(const std::string& rFunctionName, 
00132         const std::string& rDescription, unsigned int errorId);
00133 
00134     /** Destructor */
00135     virtual ~Exception() throw();
00136 
00137     /** Returns Function */
00138     virtual const char* Where() const throw();
00139 
00140     /** Returns error description */
00141     virtual const char* What() const throw();
00142 
00143     /** Returns error description */
00144     virtual const char* Message() const throw();
00145 
00146     /** Returns error id */
00147     virtual unsigned int Id() const throw();
00148 
00149   private:
00150     /** Function name */
00151     std::string mFunctionName;
00152 
00153     /** Error description */
00154     std::string mDescription;
00155 
00156     /** Error message */
00157     std::string mMessage;
00158 
00159     /** Error id */
00160     unsigned int mErrorId;
00161 };
00162     
00163 } // namespace faudes
00164 
00165 #endif 

libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6