ViSP  2.9.0
vpException.h
1 /****************************************************************************
2  *
3  * $Id: vpException.h 4632 2014-02-03 17:06:40Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Exception handling.
36  *
37  * Authors:
38  * Nicolas Mansard
39  *
40  *****************************************************************************/
41 
42 
43 /* \file vpException.h
44  \brief error that can be emited by the vp class and its derivates
45  */
46 
47 #ifndef __vpException_H
48 #define __vpException_H
49 
50 
51 /* --------------------------------------------------------------------- */
52 /* --- INCLUDE --------------------------------------------------------- */
53 /* --------------------------------------------------------------------- */
54 
55 #include <visp/vpConfig.h>
56 
57 /* Classes standards. */
58 #include <iostream> /* Classe std::ostream. */
59 #include <string> /* Classe string. */
60 #include <stdarg.h>
61 
62 /* --------------------------------------------------------------------- */
63 /* --- CLASS ----------------------------------------------------------- */
64 /* --------------------------------------------------------------------- */
65 
66 
76 class VISP_EXPORT vpException : public std::exception
77 {
78  protected:
79 
81  int code;
82 
84  std::string message;
85 
87  void setMessage(const char* format, va_list args);
88 
90  vpException(): code(notInitialized), message("") { };
91 
92  public:
93 
95  {
106  notInitialized
107  } ;
108 
109  vpException (const int code, const char* format, va_list args);
110  vpException (const int code, const char* format, ...);
111  vpException (const int code, const std::string & msg);
112  vpException (const int code);
113 
118  virtual ~vpException() throw() {}
119 
121  int getCode (void);
122 
124  const std::string &getStringMessage (void);
127  const char *getMessage (void);
128 
130  friend VISP_EXPORT std::ostream & operator << (std::ostream & os, const vpException & art);
131 
132  const char* what () const throw();
133 
134 };
135 
136 #endif /* #ifndef __vpException_H */
error that can be emited by ViSP classes.
Definition: vpException.h:76
std::string message
Contains an error message (can be empty)
Definition: vpException.h:84
int code
Contains the error code, see the errorCodeEnum table for details.
Definition: vpException.h:81
vpException()
forbid the empty constructor (protected)
Definition: vpException.h:90
virtual ~vpException()
Definition: vpException.h:118