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

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

Modified property: added svn:keywords=Id.

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