debug.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * Fran├žois Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #include <dynamic-graph/debug.h>
11 
12 #include <fstream>
13 #include <ios>
14 
15 using namespace dynamicgraph;
16 
17 #ifdef WIN32
19  "c:/tmp/dynamic-graph-traces.txt";
20 #else /*WIN32*/
22  "/tmp/dynamic-graph-traces.txt";
23 #endif /*WIN32*/
24 
25 #ifdef VP_DEBUG
26 #ifdef WIN32
27 std::ofstream dg_debugfile("C:/tmp/dynamic-graph-traces.txt",
28  std::ios::trunc &std::ios::out);
29 #else /*WIN32*/
30 std::ofstream dg_debugfile("/tmp/dynamic-graph-traces.txt",
31  std::ios::trunc &std::ios::out);
32 #endif /*WIN32*/
33 #else
34 std::ofstream dg_debugfile;
35 class dgDebug_init {
36  public:
37  dgDebug_init() { dg_debugfile.setstate(std::ios::failbit); }
38 };
40 
41 #endif
42 
43 namespace dynamicgraph {
46 } // namespace dynamicgraph
47 
48 void DebugTrace::openFile(const char *filename) {
49  if (dg_debugfile.good() && dg_debugfile.is_open()) dg_debugfile.close();
50  dg_debugfile.clear();
51  dg_debugfile.open(filename, std::ios::trunc & std::ios::out);
52 }
53 
54 void DebugTrace::closeFile(const char *) {
55  if (dg_debugfile.good() && dg_debugfile.is_open()) {
56  dg_debugfile.close();
57  }
58  dg_debugfile.setstate(std::ios::failbit);
59 }
dgDebug_init dgDebug_initialisator
Definition: debug.cpp:39
Logging class.
Definition: debug.h:40
static const char * DEBUG_FILENAME_DEFAULT
Definition: debug.h:86
std::ofstream dg_debugfile
Definition: debug.cpp:34
static void openFile(const char *filename=DEBUG_FILENAME_DEFAULT)
Definition: debug.cpp:48
dgDebug_init()
Definition: debug.cpp:37
static void closeFile(const char *filename=DEBUG_FILENAME_DEFAULT)
Definition: debug.cpp:54
DYNAMIC_GRAPH_DLLAPI DebugTrace dgERRORFLOW
DYNAMIC_GRAPH_DLLAPI DebugTrace dgDEBUGFLOW


dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Sun Jun 25 2023 02:06:03