source: pacpusframework/branches/0.0.x/include/Pacpus/DbitePlayer/DbtPlyFileManager.h

Last change on this file was 91, checked in by DHERBOMEZ Gérald, 11 years ago

Improvement of the build system to avoid some workarounds

  • Property svn:keywords set to Id
File size: 5.1 KB
Line 
1// %pacpus:license{
2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
4// %pacpus:license}
5/// @file
6/// @author Gerald Dherbomez <firstname.surname@utc.fr>
7/// @date April, 2007
8/// @version $Id: DbtPlyFileManager.h 91 2013-05-19 10:32:48Z gdherbom $
9/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
10/// @brief DbitePlayer file manager.
11///
12/// Detailed description.
13///
14/// @todo Manage a vector of dbite files and update the functions
15/// playModen and configureComponent to support this funtionnality.
16/// Put the type of data that has just been replayed in a protected
17/// variable of the abstract class in order to the derived class can
18/// know what to do.
19/// @todo Complete the function playMode2.
20/// @todo Make the variable kMaxPendingTimeFromEngineMicrosecs a property.
21
22#ifndef DEF_PACPUS_DBTPLYFILEMANAGER_H
23#define DEF_PACPUS_DBTPLYFILEMANAGER_H
24
25#include <Pacpus/DbitePlayer/DbitePlayerConfig.h>
26#include <Pacpus/DbitePlayer/DbtPlyEngine.h>
27#include <Pacpus/kernel/road_time.h>
28#include <Pacpus/kernel/ComponentBase.h>
29#include <Pacpus/kernel/DbiteFile.h>
30
31#include <QThread>
32
33class QSemaphore;
34
35namespace pacpus {
36
37class DbtPlyEngine;
38
39/// XML config properties:
40/// dbt PATH(S) path to DBT data file(s), separated by pipe symbol '|', relative to datadir property of DbtPlyEngine
41/// e.g. dbt="gps/ublox.dbt|gps/ublox2.dbt"
42/// ui INT graphical user interface (GUI) window number
43/// e.g. ui="0"
44/// verbose INT verbosity level
45/// e.g. verbose="1"
46/// @see DbtPlyEngine
47class DBITE_PLAYER_API DbtPlyFileManager
48 : public QThread
49 , public ComponentBase
50{
51 Q_OBJECT
52
53public:
54 /// constructor
55 DbtPlyFileManager(QString name);
56 /// destructor
57 virtual ~DbtPlyFileManager();
58
59 /// the player replays only the last data that has not been yet replayed
60 /// @todo Rename
61 void playMode1 (road_time_t tDbt, bool reverse);
62 /// the player replays all the data that have not been yet replayed
63 /// @todo Rename
64 void playMode2 (road_time_t tDbt, bool reverse);
65
66 /// virtual method: call when new DBT data are replayed
67 virtual void processData(road_time_t time, road_timerange_t timeRange, void * data) = 0;
68 /// @todo Documentation
69 virtual void displayUI();
70
71 /// 3 Virtual methods relative to the ComponentBase inheritance
72 virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
73 /// @todo Documentation
74 virtual void startActivity();
75 /// @todo Documentation
76 virtual void stopActivity();
77
78 /// The loop of the thread
79 virtual void run();
80
81public Q_SLOTS:
82 /// slot activated by the engine when it computes new DBT time
83 void playData(road_time_t tDbt,road_time_t tNow, bool reverse);
84
85 /// put the file descriptor to the beginning of the file
86 void beginfile();
87
88Q_SIGNALS:
89 /// signal sent to the engine to provide to it the tmin and tmax of the file
90 void tMinMaxIs(road_time_t tmin, road_time_t tmax);
91
92protected:
93 /// Verbosity level
94 int mVerbose;
95
96 /// a pointer on the player engine
97 DbtPlyEngine * mEngine;
98
99 /// the absolute path of the DBT file
100 QString dbtProperty_;
101 /// @todo Documentation
102 QStringList mDbtFilenameList;
103
104 /// The directory where the DBT file is located
105 QString mDbtDataPath;
106
107 /// Display or not the graphical interface
108 bool mShowGui;
109
110 /// @todo Documentation
111 struct dbtStruct
112 {
113 /// Data buffer
114 char * buffer;
115 /// Acquisition time
116 road_time_t t;
117 /// Acquisition timerange
118 road_timerange_t tr;
119 };
120
121 /// @todo Documentation
122 struct dbtStructFile
123 {
124 /// the DBT file descriptor
125 pacpus::DbiteFile * pfile;
126 /// the buffer where the data are stored after the reading and the associated time, timerange and file descriptor
127 dbtStruct cur;
128 /// the previous DBT data, these ones that must be processed
129 dbtStruct toProcess;
130 };
131
132 /// @todo Documentation
133 QList<dbtStructFile> dbt_;
134 /// @todo Documentation
135 int dbtIndex_;
136
137private:
138 /// @todo Documentation
139 bool processDbtFileHdfile(dbtStructFile & dbtFile, pacpus::DbiteFile::ReadDirection direction);
140
141private:
142 // reading backward?
143 bool reverse_;
144
145 /// the estimated DBT time sent by the engine and computed relatively to the state of the player
146 road_time_t timeToRead_;
147
148 /// The mode of replay
149 /// @see playMode1, playMode2 methods
150 int mode_;
151
152 /// The minimum and maximum time of the data contained in the file
153 road_time_t tMin_, tMax_;
154
155 /// the synchronization semaphore with the engine
156 QSemaphore * sync_;
157
158 /// For statistics purpose - delta time between the instant when the tDbt is computed and the instant when it is
159 /// taken into account by the file manager
160 int deltaTDbtTab_[1000];
161 int deltaTDbtTabLoop_;
162};
163
164} // namespace pacpus
165
166#endif // DEF_PACPUS_DBTPLYFILEMANAGER_H
Note: See TracBrowser for help on using the repository browser.