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
SOT_CORE_EXPORT DebugTrace sotERRORFLOW
static const char * DEBUG_FILENAME_DEFAULT
Definition: debug.cpp:21
static void openFile(const char *filename=DEBUG_FILENAME_DEFAULT)
static void closeFile(const char *filename=DEBUG_FILENAME_DEFAULT)
__sotDebug_init __sotDebug_initialisator
Definition: debug.cpp:40
std::ofstream debugfile
Definition: debug.cpp:34
SOT_CORE_EXPORT DebugTrace sotDEBUGFLOW


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26