DataLogger.h
Go to the documentation of this file.
1 // -*- C++ -*-
10 #ifndef DATA_LOGGER_H
11 #define DATA_LOGGER_H
12 
13 #include <deque>
14 #include <iomanip>
15 
16 #include <rtm/idl/BasicDataType.hh>
17 #include <rtm/idl/ExtendedDataTypes.hh>
18 #include "hrpsys/idl/HRPDataTypes.hh"
19 #include <rtm/Manager.h>
20 #include <rtm/DataFlowComponentBase.h>
21 #include <rtm/CorbaPort.h>
22 #include <rtm/DataInPort.h>
23 #include <rtm/DataOutPort.h>
24 #include <rtm/idl/BasicDataTypeSkel.h>
25 #include <rtm/idl/ExtendedDataTypesSkel.h>
26 
27 // Service implementation headers
28 // <rtc-template block="service_impl_h">
29 #include "DataLoggerService_impl.h"
30 
31 // </rtc-template>
32 
33 // Service Consumer stub headers
34 // <rtc-template block="consumer_stub_h">
35 
36 // </rtc-template>
37 
38 using namespace RTC;
39 
40 #define DEFAULT_MAX_LOG_LENGTH (200*20)
41 
43 {
44 public:
46  virtual const char *name() = 0;
47  virtual void clear() = 0;
48  virtual void dumpLog(std::ostream& os, unsigned int precision = 0) = 0;
49  virtual void log() = 0;
50  void maxLength(unsigned int len) { m_maxLength = len; }
51 protected:
52  unsigned int m_maxLength;
53 };
54 
60 {
61  public:
70  virtual ~DataLogger();
71 
72  // The initialize action (on CREATED->ALIVE transition)
73  // formaer rtc_init_entry()
74  virtual RTC::ReturnCode_t onInitialize();
75 
76  // The finalize action (on ALIVE->END transition)
77  // formaer rtc_exiting_entry()
78  // virtual RTC::ReturnCode_t onFinalize();
79 
80  // The startup action when ExecutionContext startup
81  // former rtc_starting_entry()
82  // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
83 
84  // The shutdown action when ExecutionContext stop
85  // former rtc_stopping_entry()
86  // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
87 
88  // The activated action (Active state entry action)
89  // former rtc_active_entry()
90  virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
91 
92  // The deactivated action (Active state exit action)
93  // former rtc_active_exit()
94  virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
95 
96  // The execution action that is invoked periodically
97  // former rtc_active_do()
98  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
99 
100  // The aborting action when main logic error occurred.
101  // former rtc_aborting_entry()
102  // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
103 
104  // The error action in ERROR state
105  // former rtc_error_do()
106  // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
107 
108  // The reset action that is invoked resetting
109  // This is same but different the former rtc_init_entry()
110  // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
111 
112  // The state update action that is invoked after onExecute() action
113  // no corresponding operation exists in OpenRTm-aist-0.2.0
114  // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
115 
116  // The action that is invoked when execution context's rate is changed
117  // no corresponding operation exists in OpenRTm-aist-0.2.0
118  // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
119  bool add(const char *i_type, const char *i_name);
120  bool save(const char *i_basename);
121  bool clear();
122  void suspendLogging();
123  void resumeLogging();
124  void maxLength(unsigned int len);
125 
126  std::vector<LoggerPortBase *> m_ports;
127 
128  protected:
129  // Configuration variable declaration
130  // <rtc-template block="config_declare">
131 
132  // </rtc-template>
133 
134  TimedLong m_emergencySignal;
135 
136  // DataInPort declaration
137  // <rtc-template block="inport_declare">
139 
140  // </rtc-template>
141 
142  // DataOutPort declaration
143  // <rtc-template block="outport_declare">
144 
145  // </rtc-template>
146 
147  // CORBA Port declaration
148  // <rtc-template block="corbaport_declare">
150 
151  // </rtc-template>
152 
153  // Service declaration
154  // <rtc-template block="service_declare">
156 
157  // </rtc-template>
158 
159  // Consumer declaration
160  // <rtc-template block="consumer_declare">
161 
162  // </rtc-template>
163 
164  private:
167  unsigned int m_log_precision;
168  int dummy;
169 };
170 
171 
172 extern "C"
173 {
175 };
176 
177 #endif // DATA_LOGGER_H
ec_id
void save(int w, int h, const char *i_fname)
#define DEFAULT_MAX_LOG_LENGTH
Definition: DataLogger.h:40
void clear(CorbaSequence &seq)
RTC::CorbaPort m_DataLoggerServicePort
Definition: DataLogger.h:149
png_infop png_charpp name
manager
sample RT component which has one data input port and one data output port
Definition: DataLogger.h:58
void DataLoggerInit(RTC::Manager *manager)
Definition: DataLogger.cpp:560
bool m_suspendFlag
Definition: DataLogger.h:165
TimedLong m_emergencySignal
Definition: DataLogger.h:134
unsigned int m_maxLength
Definition: DataLogger.h:52
ExecutionContextHandle_t UniqueId
coil::Mutex m_suspendFlagMutex
Definition: DataLogger.h:166
unsigned int m_log_precision
Definition: DataLogger.h:167
DataLoggerService_impl m_service0
Definition: DataLogger.h:155
InPort< TimedLong > m_emergencySignalIn
Definition: DataLogger.h:138
std::vector< LoggerPortBase * > m_ports
Definition: DataLogger.h:126
void maxLength(unsigned int len)
Definition: DataLogger.h:50


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:49