cfl_exception.cpp
Go to the documentation of this file.
1 /** @file cfl_exception.cpp Class Exception */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5  Copyright (C) 2006 Bernd Opitz
6  Exclusive copyright is granted to Klaus Schmidt
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
21 
22 
23 #include "cfl_exception.h"
24 
25 namespace faudes {
26 
27 Exception::Exception(const std::string& rFunctionName,
28  const std::string& rDescription, unsigned int errorId, bool mute)
29  : exception(), mFunctionName(rFunctionName),
30  mDescription(rDescription), mErrorId(errorId) {
31  mMessage="libFAUDES Exception: " + rFunctionName + ": " +rDescription;
32 #ifdef FAUDES_DEBUG_EXCEPTIONS
33  if(!mute) {
34  FAUDES_WRITE_CONSOLE("FAUDES_EXCEPTION: " + rFunctionName + ": " +rDescription);
35  }
36 #endif
37 }
38 
39 Exception::~Exception() throw() { }
40 
41 const char* Exception::Where() const throw() {
42  return mFunctionName.c_str();
43 }
44 
45 const char* Exception::What() const throw() {
46  return mDescription.c_str();
47 }
48 
49 unsigned int Exception::Id() const throw() {
50  return mErrorId;
51 }
52 
53 const char* Exception::Message() const throw() {
54  return mMessage.c_str();
55 }
56 
57 } // namespace faudes
#define FAUDES_WRITE_CONSOLE(message)
Debug: output macro for optional redirection of all console output.
Class Exception.
virtual ~Exception()
Destructor.
virtual const char * What() const
Returns error description.
std::string mDescription
Error description.
unsigned int mErrorId
Error id.
std::string mFunctionName
Function name.
virtual unsigned int Id() const
Returns error id.
virtual const char * Message() const
Returns error description.
Exception(const std::string &rFunctionName, const std::string &rDescription, unsigned int errorId, bool mute=false)
Constructor.
virtual const char * Where() const
Returns Function.
std::string mMessage
Error message.
libFAUDES resides within the namespace faudes.

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen