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

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

Documentation: file info.

  • Property svn:keywords set to Id
File size: 4.9 KB
Line 
1// This file is part of the PACPUS framework distributed under the
2// CECILL-C License, Version 1.0.
3//
4/// @file
5/// @author Elie Al Alam <firstname.surname@utc.fr>
6/// @author Gerald Dherbomez <firstname.surname@utc.fr>
7/// @date April, 2007
8/// @version $Id: DbtPlyFileManager.h 66 2013-01-09 16:54:11Z kurdejma $
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 <QThread>
26
27#include <Pacpus/DbitePlayer/DbitePlayerConfig.h>
28#include <Pacpus/DbitePlayer/DbtPlyEngine.h>
29#include <Pacpus/kernel/road_time.h>
30#include <Pacpus/kernel/ComponentBase.h>
31#include <Pacpus/kernel/DbiteFile.h>
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 virtual void displayUI();
69
70 /// 3 Virtual methods relative to the ComponentBase inheritance
71 virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
72 /// @todo Documentation
73 virtual void startActivity();
74 /// @todo Documentation
75 virtual void stopActivity();
76
77 /// The loop of the thread
78 virtual void run();
79
80public Q_SLOTS:
81 /// slot activated by the engine when it computes new DBT time
82 void playData(road_time_t tDbt,road_time_t tNow, bool reverse);
83
84 /// put the file descriptor to the beginning of the file
85 void beginfile();
86
87Q_SIGNALS:
88 /// signal sent to the engine to provide to it the tmin and tmax of the file
89 void tMinMaxIs(road_time_t tmin, road_time_t tmax);
90
91protected:
92 /// Verbosity level
93 int mVerbose;
94
95 /// a pointer on the player engine
96 DbtPlyEngine * mEngine;
97
98 /// the absolute path of the DBT file
99 QString dbtProperty_;
100 QStringList mDbtFilenameList;
101
102 /// The directory where the DBT file is located
103 QString mDbtDataPath;
104
105 /// Display or not the graphical interface
106 bool mShowGui;
107
108 /// @todo Documentation
109 struct dbtStruct
110 {
111 char * buffer;
112 road_time_t t;
113 road_timerange_t tr;
114 };
115
116 /// @todo Documentation
117 struct dbtStructFile
118 {
119 // the DBT file descriptor
120 pacpus::DbiteFile * pfile;
121 // the buffer where the data are stored after the reading and the associated time, timerange and file descriptor
122 dbtStruct cur;
123 // the previous DBT data, these ones that must be processed
124 dbtStruct toProcess;
125 };
126
127 QList<dbtStructFile> dbt_;
128 int dbtIndex_;
129
130private:
131 /// @todo Documentation
132 bool processDbtFileHdfile(dbtStructFile & dbtFile, pacpus::DbiteFile::ReadDirection direction);
133
134private:
135 // reading backward?
136 bool reverse_;
137
138 /// the estimated DBT time sent by the engine and computed relatively to the state of the player
139 road_time_t timeToRead_;
140
141 /// The mode of replay
142 /// @see playMode1, playMode2 methods
143 int mode_;
144
145 /// The minimum and maximum time of the data contained in the file
146 road_time_t tMin_, tMax_;
147
148 /// the synchronization semaphore with the engine
149 QSemaphore * sync_;
150
151 /// For statistics purpose - delta time between the instant when the tDbt is computed and the instant when it is
152 /// taken into account by the file manager
153 int deltaTDbtTab_[1000];
154 int deltaTDbtTabLoop_;
155};
156
157} // namespace pacpus
158
159#endif // DEF_PACPUS_DBTPLYFILEMANAGER_H
Note: See TracBrowser for help on using the repository browser.