4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program 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
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief Exception public header */
27 #define HH_Exception_ 1
33 //#include "Exception.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
38 /** \brief Exception handling standard UNIX errors (errno)
40 This exception is thrown to signal generic errno failures.
42 \todo make where and err accessors and make the member vars private
44 \idea Add a template class derived from SystemException which
45 takes the error number as a numeric argument. This allows
46 catching specific errno conditions: ErrnoException<EPIPE> etc.
48 \idea Add a generic error thrower which takes the origin
49 string and errno value as an argument and will throw a
50 corresponding template class instance. This would just be a
51 big switch statement containing all possible errno values,
52 probably created using some macro metaprogramming.
54 class SystemException : public std::exception
57 explicit SystemException(int err); ///< SystemException without error lokus info
58 /**< \param[in] err error number (the errno value) */
59 SystemException(char const * where, int err); ///< SystemException with error location info
60 /**< \param[in] where description of error origin
61 \param[in] err error number (the errno value) */
63 virtual char const * what() const throw(); ///< Return verbose error description
65 char const * where; ///< Error origin
66 int err; ///< Error number
68 virtual ~SystemException() throw();
74 enum NoThrow_t { nothrow };
78 ///////////////////////////////hh.e////////////////////////////////////////
79 #include "Exception.cci"
80 //#include "Exception.ct"
81 //#include "Exception.cti"
88 // c-file-style: "senf"
89 // indent-tabs-mode: nil
90 // ispell-local-dictionary: "american"
91 // compile-command: "scons -u test"