1 |
|
|
// -*- mode: c++ -*- |
2 |
|
|
// Copyright 2010, François Bleibel, Thomas Moulard, Olivier Stasse, |
3 |
|
|
// JRL, CNRS/AIST. |
4 |
|
|
// |
5 |
|
|
|
6 |
|
|
#ifndef DYNAMIC_GRAPH_EXCEPTION_FACTORY_H |
7 |
|
|
#define DYNAMIC_GRAPH_EXCEPTION_FACTORY_H |
8 |
|
|
#include <dynamic-graph/dynamic-graph-api.h> |
9 |
|
|
#include <dynamic-graph/exception-abstract.h> |
10 |
|
|
|
11 |
|
|
#include <dynamic-graph/fwd.hh> |
12 |
|
|
#include <string> |
13 |
|
|
|
14 |
|
|
namespace dynamicgraph { |
15 |
|
|
/// \ingroup error |
16 |
|
|
/// |
17 |
|
|
/// \brief Generic error class. |
18 |
|
|
class DYNAMIC_GRAPH_DLLAPI ExceptionFactory : public ExceptionAbstract { |
19 |
|
|
public: |
20 |
|
|
enum ErrorCodeEnum { |
21 |
|
|
GENERIC = ExceptionAbstract::FACTORY, |
22 |
|
|
UNREFERED_OBJECT, |
23 |
|
|
UNREFERED_SIGNAL, |
24 |
|
|
UNREFERED_FUNCTION, |
25 |
|
|
DYNAMIC_LOADING, |
26 |
|
|
SIGNAL_CONFLICT, |
27 |
|
|
FUNCTION_CONFLICT, |
28 |
|
|
OBJECT_CONFLICT, |
29 |
|
|
SYNTAX_ERROR, |
30 |
|
|
READ_FILE |
31 |
|
|
}; |
32 |
|
|
|
33 |
|
|
static const std::string EXCEPTION_NAME; |
34 |
|
|
|
35 |
|
|
explicit ExceptionFactory(const ExceptionFactory::ErrorCodeEnum &errcode, |
36 |
|
|
const std::string &msg = ""); |
37 |
|
|
|
38 |
|
|
ExceptionFactory(const ExceptionFactory::ErrorCodeEnum &errcode, |
39 |
|
|
const std::string &msg, const char *format, ...); |
40 |
|
|
|
41 |
|
30 |
virtual ~ExceptionFactory() throw() {} |
42 |
|
|
|
43 |
|
|
virtual const std::string &getExceptionName() const { |
44 |
|
|
return ExceptionFactory::EXCEPTION_NAME; |
45 |
|
|
} |
46 |
|
|
}; |
47 |
|
|
} // end of namespace dynamicgraph |
48 |
|
|
|
49 |
|
|
#endif //! DYNAMIC_GRAPH_EXCEPTION_FACTORY_H |