File: PBoRiError.h

package info (click to toggle)
brial 1.2.12-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,404 kB
  • sloc: cpp: 219,610; ansic: 43,783; python: 4,172; makefile: 336; sh: 5
file content (68 lines) | stat: -rw-r--r-- 1,536 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// -*- c++ -*-
//*****************************************************************************
/** @file PBoRiError.h 
 *
 * @author Alexander Dreyer
 * @date 2006-03-06
 *
 * This file defines the class PBoriError, which is used for polybori's
 * exception handling.
 *
 * @par Copyright:
 *   (c) 2006 by The PolyBoRi Team
**/
//*****************************************************************************

#ifndef polybori_error_PBoRiError_h_
#define polybori_error_PBoRiError_h_

// load PolyBoRi settings
#include <polybori/pbori_defs.h>
#include <exception>

BEGIN_NAMESPACE_PBORI

/** @class PBoRiError
 * @brief This class is used for polybori's exception handling.
 *
 * It's mainly a class wrapper for CTypes::errorcode.
 * 
 **/
class PBoRiError:
  public std::exception, public CTypes {

public:
  /// adopt global error code enumeration
  typedef CTypes::errornum_type errornum_type;

  /// adopt global error text type
  typedef CTypes::errortext_type errortext_type;

  /// generic access to type of @c *this
  typedef PBoRiError self;

  /// construct instance from error code
  PBoRiError(errornum_type err = CTypes::alright);

  /// copy constructor
  PBoRiError(const self&);

  /// destructor
  ~PBoRiError() throw();

  /// get error code
  errornum_type code() const;

  /// get error text
  errortext_type text() const;

  /// std::exception compatible interface
  const char* what() const throw() { return text(); }

protected:
  errornum_type error;
};

END_NAMESPACE_PBORI

#endif // of #ifndef PBoRiError_h_