1 |
|
|
/* |
2 |
|
|
* Copyright 2010, |
3 |
|
|
* François Bleibel, |
4 |
|
|
* Olivier Stasse, |
5 |
|
|
* |
6 |
|
|
* CNRS/AIST |
7 |
|
|
* |
8 |
|
|
*/ |
9 |
|
|
|
10 |
|
|
#include <dynamic-graph/exception-traces.h> |
11 |
|
|
#include <stdarg.h> |
12 |
|
|
|
13 |
|
|
#include <cstdio> |
14 |
|
|
|
15 |
|
|
using namespace dynamicgraph; |
16 |
|
|
/* --------------------------------------------------------------------- */ |
17 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
18 |
|
|
/* --------------------------------------------------------------------- */ |
19 |
|
|
|
20 |
|
|
const std::string ExceptionTraces::EXCEPTION_NAME = "Traces"; |
21 |
|
|
|
22 |
|
1 |
ExceptionTraces::ExceptionTraces(const ExceptionTraces::ErrorCodeEnum &errcode, |
23 |
|
1 |
const std::string &msg) |
24 |
✓✗ |
1 |
: ExceptionAbstract(errcode, msg) {} |
25 |
|
|
|
26 |
|
2 |
ExceptionTraces::ExceptionTraces(const ExceptionTraces::ErrorCodeEnum &errcode, |
27 |
|
|
const std::string &msg, const char *format, |
28 |
|
2 |
...) |
29 |
✓✗ |
2 |
: ExceptionAbstract(errcode, msg) { |
30 |
|
|
va_list args; |
31 |
|
2 |
va_start(args, format); |
32 |
|
|
|
33 |
|
2 |
const unsigned int SIZE = 256; |
34 |
|
|
char buffer[SIZE]; |
35 |
|
2 |
vsnprintf(buffer, SIZE, format, args); |
36 |
|
|
|
37 |
✓✗ |
2 |
message += buffer; |
38 |
|
|
|
39 |
|
2 |
va_end(args); |
40 |
|
2 |
} |
41 |
|
|
|
42 |
|
|
/* |
43 |
|
|
* Local variables: |
44 |
|
|
* c-basic-offset: 2 |
45 |
|
|
* End: |
46 |
|
|
*/ |