src
dynamic_graph
debug-py.cc
Go to the documentation of this file.
1
// Copyright 2019, Olivier Stasse, LAAS-CNRS.
2
//
3
// See LICENSE
4
5
#include <iostream>
6
7
#define ENABLE_RT_LOG
8
#include <dynamic-graph/entity.h>
9
#include <dynamic-graph/pool.h>
10
#include <
dynamic-graph/real-time-logger.h
>
11
12
#include <boost/shared_ptr.hpp>
13
#include <map>
14
#include <vector>
15
16
#include "
dynamic-graph/python/dynamic-graph-py.hh
"
17
18
typedef
boost::shared_ptr<std::ofstream>
ofstreamShrPtr
;
19
20
namespace
dynamicgraph
{
21
namespace
python
{
22
23
namespace
debug {
24
25
std::map<std::string, ofstreamShrPtr>
mapOfFiles_
;
26
27
void
addLoggerFileOutputStream
(
const
char
* filename) {
28
std::ofstream* aofs =
new
std::ofstream;
29
ofstreamShrPtr
ofs_shrptr = boost::shared_ptr<std::ofstream>(aofs);
30
aofs->open(filename, std::ofstream::out);
31
dynamicgraph::RealTimeLogger::instance
();
32
dgADD_OSTREAM_TO_RTLOG
(*aofs);
33
dgRTLOG
() <<
"Added "
<< filename <<
" as an output stream \n"
;
34
mapOfFiles_
[filename] = ofs_shrptr;
35
}
36
37
void
closeLoggerFileOutputStream
() {
38
for
(
const
auto
& el :
mapOfFiles_
) el.second->close();
39
}
40
41
void
addLoggerCoutOutputStream
() {
dgADD_OSTREAM_TO_RTLOG
(std::cout); }
42
43
void
realTimeLoggerDestroy
() {
RealTimeLogger::destroy
(); }
44
45
void
realTimeLoggerSpinOnce
() {
RealTimeLogger::instance
().
spinOnce
(); }
46
47
void
realTimeLoggerInstance
() {
RealTimeLogger::instance
(); }
48
49
}
// namespace debug
50
}
// namespace python
51
}
// namespace dynamicgraph
ofstreamShrPtr
boost::shared_ptr< std::ofstream > ofstreamShrPtr
Definition:
debug-py.cc:18
dynamicgraph::python::debug::realTimeLoggerSpinOnce
void realTimeLoggerSpinOnce()
Definition:
debug-py.cc:45
dynamicgraph::python::debug::closeLoggerFileOutputStream
void closeLoggerFileOutputStream()
Definition:
debug-py.cc:37
dynamicgraph
dynamicgraph::RealTimeLogger::spinOnce
bool spinOnce()
dynamicgraph::python::debug::addLoggerCoutOutputStream
void addLoggerCoutOutputStream()
Definition:
debug-py.cc:41
dynamicgraph::python::debug::addLoggerFileOutputStream
void addLoggerFileOutputStream(const char *filename)
Definition:
debug-py.cc:27
dynamicgraph::python::debug::mapOfFiles_
std::map< std::string, ofstreamShrPtr > mapOfFiles_
Definition:
debug-py.cc:25
dynamic-graph-py.hh
python
dgRTLOG
#define dgRTLOG()
dynamicgraph::python::debug::realTimeLoggerDestroy
void realTimeLoggerDestroy()
Definition:
debug-py.cc:43
real-time-logger.h
dynamicgraph::RealTimeLogger::destroy
static void destroy()
dynamicgraph::python::debug::realTimeLoggerInstance
void realTimeLoggerInstance()
Definition:
debug-py.cc:47
dgADD_OSTREAM_TO_RTLOG
#define dgADD_OSTREAM_TO_RTLOG(ostr)
dynamicgraph::RealTimeLogger::instance
static RealTimeLogger & instance()
dynamic-graph-python
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Fri Oct 27 2023 02:16:36