logger
Logger.hpp
Go to the documentation of this file.
1 #ifndef LOGGER_LOGGER_TASK_HPP
2 #define LOGGER_LOGGER_TASK_HPP
3 
4 #include "logger/LoggerBase.hpp"
5 #include <rtt/os/MutexLock.hpp>
6 
7 namespace orogen_transports {
8  class TypelibMarshallerBase;
9 }
10 namespace Logging {
11  class StreamLogger;
12  class Logfile;
13 }
14 namespace Typelib {
15  class Registry;
16 }
17 namespace RTT {
18  namespace base {
19  class InputPortInterface;
20  }
21 }
22 
23 namespace logger {
24  class Logger : public LoggerBase
25  {
26  friend class LoggerBase;
27 
28  protected:
29 
30  Typelib::Registry* m_registry;
31  std::ofstream* m_io;
33 
34  bool startHook();
35  void updateHook();
36  void stopHook();
37 
38  public:
39  Logger(std::string const& name = "logger::Logger", TaskCore::TaskState initial_state = Stopped);
40  ~Logger();
41 
42  /* Handler for the createLoggingPort operation
43  */
44  virtual bool createLoggingPort(::std::string const & port_name,
45  ::std::string const & type_name,
46  ::std::vector< ::logger::StreamMetadata > const & metadata);
47 
51  bool reportComponent( const std::string& component );
52 
56  bool unreportComponent( const std::string& component );
57 
61  bool reportPort(const std::string& component, const std::string& port );
62 
66  bool unreportPort(const std::string& component, const std::string& port );
67 
72  void snapshot();
73 
75  void clear();
76 
77  bool removeLoggingPort(std::string const& stream_name);
78 
79  private:
80  typedef RTT::DataFlowInterface::Ports Ports;
81 
82  struct ReportDescription;
83  void deleteReport(ReportDescription& report);
84 
85  bool addLoggingPort(RTT::base::InputPortInterface* reader, std::string const& stream_name);
86  bool addLoggingPort(RTT::base::InputPortInterface* reader, std::string const& stream_name, std::vector<logger::StreamMetadata> const& metadata);
87 
91  typedef std::vector<ReportDescription> Reports;
92  Reports root;
93  };
94 }
95 
96 #endif
97 
Definition: Logfile.cpp:63
Typelib::Registry * m_registry
Definition: Logger.hpp:30
Definition: Logger.hpp:7
Definition: Logfile.hpp:43
Definition: LoggerTypes.hpp:6
std::ofstream * m_io
Definition: Logger.hpp:31
Definition: Logger.cpp:25
Definition: Logger.hpp:24
Definition: Logger.hpp:17
Logging::Logfile * m_file
Definition: Logger.hpp:32
Definition: Logfile.hpp:48