MatLogger2  1.0.0
Library for logging of numeric data to HDF5 MAT-files, which is RT-safe and multithreaded.
mat_appender.h
Go to the documentation of this file.
1 #ifndef __XBOT_MATLOGGER2_APPENDER_H__
2 #define __XBOT_MATLOGGER2_APPENDER_H__
3 
4 #include <memory>
5 
6 
7 namespace XBot
8 {
9  class MatLogger2;
10 
24  class MatAppender : public std::enable_shared_from_this<MatAppender>
25  {
26 
27  public:
28 
29  typedef std::weak_ptr<MatAppender> WeakPtr;
30  typedef std::shared_ptr<MatAppender> Ptr;
31 
35  static Ptr MakeInstance();
36 
45  bool add_logger(std::shared_ptr<MatLogger2> logger);
46 
54 
59  void start_flush_thread();
60 
65  ~MatAppender();
66 
67  private:
68 
69  MatAppender();
70 
71  struct Impl;
72 
73  Impl& impl();
74 
75  std::unique_ptr<Impl> _impl;
76 
77  };
78 }
79 
80 #endif
~MatAppender()
Destructor will join with the flusher thread if it was spawned by the user.
The MatAppender class allows to flush data to disk from multiple MatLogger2 loggers at once...
Definition: mat_appender.h:24
bool add_logger(std::shared_ptr< MatLogger2 > logger)
Register a MAT-logger to the appender.
std::weak_ptr< MatAppender > WeakPtr
Definition: mat_appender.h:29
static Ptr MakeInstance()
Returns a shared pointer to a new MatAppender object.
std::shared_ptr< MatAppender > Ptr
Definition: mat_appender.h:30
int flush_available_data()
Flush buffers from all registered loggers to disk.
void start_flush_thread()
Spawn a thread that will automatically flush data to disk whenever enough data is available...