tracer-real-time.h
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 // Copyright 2010, François Bleibel, Thomas Moulard, Olivier Stasse,
3 // JRL, CNRS/AIST.
4 //
5 
6 #ifndef DYNAMIC_GRAPH_TRACER_REAL_TIME_H
7 #define DYNAMIC_GRAPH_TRACER_REAL_TIME_H
8 #include <dynamic-graph/tracer.h>
9 
10 #include <dynamic-graph/config-tracer-real-time.hh>
11 #include <dynamic-graph/fwd.hh>
12 #include <sstream>
13 
14 namespace dynamicgraph {
18 class DG_TRACERREALTIME_DLLAPI OutStringStream : public std::ostringstream {
19  public:
20  char *buffer;
21  std::streamsize index;
22  std::streamsize bufferSize;
23  bool full;
24  std::string givenname;
25 
26  public:
28  ~OutStringStream();
29 
30  void resize(const std::streamsize &size);
31  bool addData(const char *data, const std::streamoff &size);
32  void dump(std::ostream &os);
33  void empty();
34 };
35 
39 class DG_TRACERREALTIME_DLLAPI TracerRealTime : public Tracer {
41 
42  public:
43  TracerRealTime(const std::string &n);
44  virtual ~TracerRealTime() {}
45 
46  virtual void closeFiles();
47  virtual void trace();
48 
49  void display(std::ostream &os) const;
50  DG_TRACERREALTIME_DLLAPI friend std::ostream &operator<<(
51  std::ostream &os, const TracerRealTime &t);
52 
53  void emptyBuffers();
54 
55  void setBufferSize(const int &SIZE) { bufferSize = SIZE; }
56 
57  const int &getBufferSize() { return bufferSize; }
58 
59  protected:
60  virtual void openFile(const SignalBase<sigtime_t> &sig,
61  const std::string &filename);
62 
63  virtual void recordSignal(std::ostream &os, const SignalBase<sigtime_t> &sig);
64 
65  typedef std::list<std::ofstream *> HardFileList;
66  static const int BUFFER_SIZE_DEFAULT = 1048576; // 1Mo
67 
70 };
71 } // end of namespace dynamicgraph
72 
73 #endif
dynamicgraph::operator<<
DYNAMIC_GRAPH_DLLAPI std::ostream & operator<<(std::ostream &os, const dynamicgraph::Entity &ent)
Definition: src/dgraph/entity.cpp:174
dynamicgraph::OutStringStream::givenname
std::string givenname
Definition: tracer-real-time.h:24
dynamicgraph
dynamicgraph::OutStringStream::bufferSize
std::streamsize bufferSize
Definition: tracer-real-time.h:22
dynamicgraph::TracerRealTime::HardFileList
std::list< std::ofstream * > HardFileList
Definition: tracer-real-time.h:65
setup.data
data
Definition: setup.in.py:48
dynamicgraph::OutStringStream::buffer
char * buffer
Definition: tracer-real-time.h:20
dynamicgraph::TracerRealTime::hardFiles
HardFileList hardFiles
Definition: tracer-real-time.h:69
dynamicgraph::TracerRealTime::bufferSize
int bufferSize
Definition: tracer-real-time.h:68
dynamicgraph::TracerRealTime::setBufferSize
void setBufferSize(const int &SIZE)
Definition: tracer-real-time.h:55
dynamicgraph::OutStringStream
Stream for the tracer real-time.
Definition: tracer-real-time.h:18
fwd.hh
DYNAMIC_GRAPH_ENTITY_DECL
#define DYNAMIC_GRAPH_ENTITY_DECL()
Helper macro for entity declaration.
Definition: include/dynamic-graph/entity.h:38
tracer.h
sig
dynamicgraph::SignalArray_const< double > sig
Definition: signal-all.cpp:25
dynamicgraph::TracerRealTime::getBufferSize
const int & getBufferSize()
Definition: tracer-real-time.h:57
dynamicgraph::OutStringStream::index
std::streamsize index
Definition: tracer-real-time.h:21
dynamicgraph::TracerRealTime::~TracerRealTime
virtual ~TracerRealTime()
Definition: tracer-real-time.h:44
dynamicgraph::SignalBase< sigtime_t >
dynamicgraph::Tracer
Tracer plug-in main class.
Definition: tracer.h:24
dynamicgraph::TracerRealTime
Main class of the tracer real-time plug-in.
Definition: tracer-real-time.h:39
dynamicgraph::OutStringStream::full
bool full
Definition: tracer-real-time.h:23


dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Fri Aug 2 2024 08:36:38