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

Last change on this file since 61 was 61, checked in by Marek Kurdej, 12 years ago

Added: some documentation and doc todo comments.

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