source: pacpusframework/trunk/include/Pacpus/DbitePlayer/DbtPlyFileManager.h@ 338

Last change on this file since 338 was 290, checked in by Marek Kurdej, 11 years ago

Some clean-up.

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