00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _CPP_C_DATALOGCONTROL_H_
00021 #define _CPP_C_DATALOGCONTROL_H_
00022
00023 #include "list_t.hpp"
00024 #include "fstream_t.hpp"
00025 #include <sys/time.h>
00026
00027 #include "C_TaskControl.hpp"
00028 #include "C_LogValue.hpp"
00029 #include "C_SemaphoreTimed.hpp"
00030
00031 class C_DataLogControl : public C_TaskControl {
00032
00033 public:
00034
00035 C_DataLogControl(size_t P_max_data,
00036 size_t P_max_data_log,
00037 char *P_file_name,
00038 unsigned long P_period);
00039 ~C_DataLogControl();
00040
00041 int data (char *P_data);
00042 virtual void do_log () ;
00043 virtual void do_log_cumul () ;
00044
00045 virtual int data (double P_time, double P_data);
00046
00047 int time_data (struct timeval *P_begin, struct timeval *P_end);
00048
00049
00050 protected:
00051
00052 typedef list_t<C_LogValue *> T_LogValuePList, *T_pLogValuePList ;
00053
00054 T_GeneratorError TaskProcedure () ;
00055 T_GeneratorError InitProcedure () ;
00056 T_GeneratorError EndProcedure () ;
00057 T_GeneratorError StoppingProcedure () ;
00058 T_GeneratorError ForcedStoppingProcedure () ;
00059
00060
00061
00062 C_SemaphoreTimed *m_sem ;
00063 C_Semaphore *m_available_sem, *m_values_sem ;
00064 size_t m_size, m_size_log ;
00065 double m_time_ref ;
00066
00067 C_LogValue **m_data_values ;
00068
00069 T_pLogValuePList m_values, m_available, m_log ;
00070 fstream_output *m_output_stream ;
00071
00072 } ;
00073
00074
00075 #endif // _CPP_C_DATALOGCONTROL_H_
00076
00077
00078
00079
00080
00081