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

wefts_error.h

Go to the documentation of this file.
00001 /*
00002    wefts_error.h
00003    Error classes - for trhow statements.
00004 
00005    $Id: wefts_error.h,v 1.3 2003/12/14 09:07:55 jonnymind Exp $
00006 ---------------------------------------------
00007    Begin      : 2003-08-15 17:13
00008    Author     : Giancarlo Niccolai
00009 
00010    Last modified because:
00011 
00012 */
00013 
00014 /**************************************************************************
00015 *   This program is free software; you can redistribute it and/or modify  *
00016 *   it under the terms of the GNU Library General Public License as       *
00017 *   published by the Free Software Foundation; either version 2.1 of the  *
00018 *   License, or (at your option) any later version.                       *
00019 ***************************************************************************/
00020 
00021 
00022 #ifndef WT_ERROR_H
00023 #define WT_ERROR_H
00024 
00025 #include <string>
00026 #include <iostream>
00027 
00035 namespace Wefts {
00036 
00044 class Error
00045 {
00046 private:
00047    int m_osCode;
00048    std::string m_descr;
00049 
00050 public:
00054    Error( int code=0, std::string descr="Generic low-level error" ) { 
00055       m_osCode = code;
00056       m_descr = descr;
00057    }
00058 
00063    int osCode() const { return m_osCode; }
00064 
00066    virtual const std::string &description() const { return m_descr; }
00067 
00069    virtual const std::string className() const { return "Wefts::Error"; }
00070 
00074    friend std::ostream& operator<<( std::ostream &stream, Error &err );
00075 };
00076 
00077 
00079 class NotJoinableError: public Error
00080 {
00081 public:
00085    NotJoinableError( int code=0, std::string descr = "Can't join target thread" ): 
00086          Error( code, descr ) {}
00087 
00089    virtual const std::string className() const { return "Wefts::NotJoinableError"; }
00090 
00091 };
00092 
00094 class InvalidError: public Error
00095 {
00096 public:
00100    InvalidError( int code=0, std::string descr="Using an object in an invalid state" ): 
00101       Error( code, descr ) {}
00102 
00104    virtual const std::string className() const { return "Wefts::InvalidError"; }
00105 
00106 };
00107 
00109 class InitError: public Error
00110 {
00111 public:
00115    InitError( int code=0, std::string descr="Object cannot be initialized" ): 
00116       Error( code, descr ) {}
00117 
00119    virtual const std::string className() const { return "Wefts::InitError"; }
00120 
00121 };
00122 
00124 class StartError: public Error
00125 {
00126 public:
00130    StartError( int code=0, std::string descr="Can't start OS thread" ): 
00131       Error( code, descr ) {}
00132 
00134    virtual const std::string className() const { return "Wefts::StartError"; }
00135 
00136 };
00137 
00142 }
00143 
00144 #endif
00145 
00146 /* end of wefts_error.h */

Generated on Mon Dec 22 04:12:30 2003 for Wefts by doxygen1.2.18