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 <fstream>
11 #include <ios>
12 #include <sot/core/debug.hh>
13 
14 using namespace dynamicgraph::sot;
15 
16 namespace dynamicgraph {
17 namespace sot {
18 #ifdef WIN32
19 const char *DebugTrace::DEBUG_FILENAME_DEFAULT = "c:/tmp/sot-core-traces.txt";
20 #else // WIN32
21 const char *DebugTrace::DEBUG_FILENAME_DEFAULT = "/tmp/sot-core-traces.txt";
22 #endif // WIN32
23 
24 #ifdef VP_DEBUG
25 #ifdef WIN32
26 std::ofstream debugfile("C:/tmp/sot-core-traces.txt",
27  std::ios::trunc &std::ios::out);
28 #else // WIN32
29 std::ofstream debugfile("/tmp/sot-core-traces.txt",
30  std::ios::trunc &std::ios::out);
31 #endif // WIN32
32 #else // VP_DEBUG
33 
34 std::ofstream debugfile;
35 
37  public:
38  __sotDebug_init() { debugfile.setstate(std::ios::failbit); }
39 };
41 
42 #endif // VP_DEBUG
43 
44 } /* namespace sot */
45 } /* namespace dynamicgraph */
46 
47 void DebugTrace::openFile(const char *filename) {
48  if (debugfile.good() && debugfile.is_open()) debugfile.close();
49  debugfile.clear();
50  debugfile.open(filename, std::ios::trunc & std::ios::out);
51 }
52 
53 void DebugTrace::closeFile(const char *) {
54  if (debugfile.good() && debugfile.is_open()) debugfile.close();
55  debugfile.setstate(std::ios::failbit);
56 }
57 
58 namespace dynamicgraph {
59 namespace sot {
62 } // namespace sot.
63 } // namespace dynamicgraph
dynamicgraph::sot::sotDEBUGFLOW
SOT_CORE_EXPORT DebugTrace sotDEBUGFLOW
dynamicgraph::sot::sotERRORFLOW
SOT_CORE_EXPORT DebugTrace sotERRORFLOW
dynamicgraph
dynamicgraph::DebugTrace::closeFile
static void closeFile(const char *filename=DEBUG_FILENAME_DEFAULT)
debug.hh
filename
filename
dynamicgraph::sot::__sotDebug_init
Definition: debug.cpp:36
dynamicgraph::sot::__sotDebug_init::__sotDebug_init
__sotDebug_init()
Definition: debug.cpp:38
dynamicgraph::DebugTrace
dynamicgraph::DebugTrace::DEBUG_FILENAME_DEFAULT
static const char * DEBUG_FILENAME_DEFAULT
Definition: debug.cpp:21
dynamicgraph::sot::__sotDebug_initialisator
__sotDebug_init __sotDebug_initialisator
Definition: debug.cpp:40
dynamicgraph::sot
dynamicgraph::DebugTrace::openFile
static void openFile(const char *filename=DEBUG_FILENAME_DEFAULT)
dynamicgraph::sot::debugfile
std::ofstream debugfile
Definition: debug.cpp:34


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31