1 |
|
|
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 |
|
|
* Copyright Projet JRL-Japan, 2008 |
3 |
|
|
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 |
|
|
* |
5 |
|
|
* File: ExceptionPatternGenerator.cpp |
6 |
|
|
* Project: SOT |
7 |
|
|
* Author: Olivier Stasse |
8 |
|
|
* |
9 |
|
|
* Version control |
10 |
|
|
* =============== |
11 |
|
|
* |
12 |
|
|
* $Id$ |
13 |
|
|
* |
14 |
|
|
* Description |
15 |
|
|
* ============ |
16 |
|
|
* |
17 |
|
|
* |
18 |
|
|
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
19 |
|
|
|
20 |
|
|
#include <sot/pattern-generator/exception-pg.h> |
21 |
|
|
#include <stdarg.h> |
22 |
|
|
|
23 |
|
|
#include <cstdio> |
24 |
|
|
|
25 |
|
|
namespace dynamicgraph { |
26 |
|
|
namespace sot { |
27 |
|
|
|
28 |
|
|
/* --------------------------------------------------------------------- */ |
29 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
30 |
|
|
/* --------------------------------------------------------------------- */ |
31 |
|
|
|
32 |
|
|
const std::string ExceptionPatternGenerator::EXCEPTION_NAME = |
33 |
|
|
"PatternGenerator"; |
34 |
|
|
|
35 |
|
|
ExceptionPatternGenerator::ExceptionPatternGenerator( |
36 |
|
|
const ExceptionPatternGenerator::ErrorCodeEnum &errcode, |
37 |
|
|
const std::string &msg) |
38 |
|
|
: ExceptionAbstract(errcode, msg) {} |
39 |
|
|
|
40 |
|
|
ExceptionPatternGenerator::ExceptionPatternGenerator( |
41 |
|
|
const ExceptionPatternGenerator::ErrorCodeEnum &errcode, |
42 |
|
|
const std::string &msg, const char *format, ...) |
43 |
|
|
: ExceptionAbstract(errcode, msg) { |
44 |
|
|
va_list args; |
45 |
|
|
va_start(args, format); |
46 |
|
|
|
47 |
|
|
const unsigned int SIZE = 256; |
48 |
|
|
char buffer[SIZE]; |
49 |
|
|
vsnprintf(buffer, SIZE, format, args); |
50 |
|
|
|
51 |
|
|
message += buffer; |
52 |
|
|
|
53 |
|
|
va_end(args); |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
} // namespace sot |
57 |
|
|
} // namespace dynamicgraph |
58 |
|
|
|
59 |
|
|
/* |
60 |
|
|
* Local variables: |
61 |
|
|
* c-basic-offset: 2 |
62 |
|
|
* End: |
63 |
|
|
*/ |