exception-python.hh 2.04 KB
Newer Older
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- mode: c++ -*-
// Copyright 2010, François Bleibel, Thomas Moulard, Olivier Stasse,
// JRL, CNRS/AIST.
//
// This file is part of dynamic-graph.
// dynamic-graph is free software: you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// dynamic-graph is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Lesser Public License for more details.  You should have
// received a copy of the GNU Lesser General Public License along with
// dynamic-graph. If not, see <http://www.gnu.org/licenses/>.

#ifndef DYNAMIC_GRAPH_PYTHON_EXCEPTION_PYTHON_H
Guilhem Saurel's avatar
format    
Guilhem Saurel committed
19
20
#define DYNAMIC_GRAPH_PYTHON_EXCEPTION_PYTHON_H
#include <string>
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
21

Guilhem Saurel's avatar
format    
Guilhem Saurel committed
22
23
#include <dynamic-graph/fwd.hh>
#include <dynamic-graph/exception-abstract.h>
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
24

25
26
// Depending on whether one is building or using the
// library define DLLAPI to import or export.
Guilhem Saurel's avatar
format    
Guilhem Saurel committed
27
28
29
30
31
32
33
34
35
#if defined(WIN32)
#if defined(wrap_EXPORTS)
#define WRAP_DLLAPI __declspec(dllexport)
#else
#define WRAP_DLLAPI __declspec(dllimport)
#endif
#else
#define WRAP_DLLAPI
#endif
36

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
37
namespace dynamicgraph {
Guilhem Saurel's avatar
format    
Guilhem Saurel committed
38
namespace python {
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
39

Guilhem Saurel's avatar
format    
Guilhem Saurel committed
40
41
42
43
44
45
/// \ingroup error
///
/// \brief Generic error class.
class WRAP_DLLAPI ExceptionPython : public ExceptionAbstract {
 public:
  enum ErrorCodeEnum { GENERIC, VALUE_PARSING, VECTOR_PARSING, MATRIX_PARSING, CLASS_INCONSISTENT };
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
46

Guilhem Saurel's avatar
format    
Guilhem Saurel committed
47
  static const std::string EXCEPTION_NAME;
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
48

Guilhem Saurel's avatar
format    
Guilhem Saurel committed
49
  explicit ExceptionPython(const ExceptionPython::ErrorCodeEnum& errcode, const std::string& msg = "");
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
50

Guilhem Saurel's avatar
format    
Guilhem Saurel committed
51
  ExceptionPython(const ExceptionPython::ErrorCodeEnum& errcode, const std::string& msg, const char* format, ...);
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
52

Guilhem Saurel's avatar
format    
Guilhem Saurel committed
53
  virtual ~ExceptionPython() throw() {}
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
54

Guilhem Saurel's avatar
format    
Guilhem Saurel committed
55
56
57
58
  virtual const std::string& getExceptionName() const { return ExceptionPython::EXCEPTION_NAME; }
};
}  // end of namespace python
}  // end of namespace dynamicgraph
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
59

Guilhem Saurel's avatar
format    
Guilhem Saurel committed
60
#endif  //! DYNAMIC_GRAPH_PYTHON_EXCEPTION_PYTHON_H