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

Last change on this file since 162 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
RevLine 
[76]1// %pacpus:license{
[62]2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
[76]4// %pacpus:license}
[66]5/// @file
[62]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.
[3]21
[31]22#ifndef DEF_PACPUS_DBTPLYFILEMANAGER_H
23#define DEF_PACPUS_DBTPLYFILEMANAGER_H
[3]24
[31]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>
[3]30
[67]31#include <QThread>
32
[3]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:
[61]54 /// constructor
[3]55 DbtPlyFileManager(QString name);
[61]56 /// destructor
[3]57 virtual ~DbtPlyFileManager();
58
[61]59 /// the player replays only the last data that has not been yet replayed
60 /// @todo Rename
[3]61 void playMode1 (road_time_t tDbt, bool reverse);
[61]62 /// the player replays all the data that have not been yet replayed
63 /// @todo Rename
[3]64 void playMode2 (road_time_t tDbt, bool reverse);
65
[61]66 /// virtual method: call when new DBT data are replayed
[3]67 virtual void processData(road_time_t time, road_timerange_t timeRange, void * data) = 0;
[67]68 /// @todo Documentation
[3]69 virtual void displayUI();
70
[61]71 /// 3 Virtual methods relative to the ComponentBase inheritance
[3]72 virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
[61]73 /// @todo Documentation
[3]74 virtual void startActivity();
[61]75 /// @todo Documentation
[3]76 virtual void stopActivity();
77
[61]78 /// The loop of the thread
[3]79 virtual void run();
80
81public Q_SLOTS:
[61]82 /// slot activated by the engine when it computes new DBT time
[3]83 void playData(road_time_t tDbt,road_time_t tNow, bool reverse);
84
[61]85 /// put the file descriptor to the beginning of the file
[3]86 void beginfile();
87
88Q_SIGNALS:
[61]89 /// signal sent to the engine to provide to it the tmin and tmax of the file
[3]90 void tMinMaxIs(road_time_t tmin, road_time_t tmax);
91
92protected:
93 /// Verbosity level
94 int mVerbose;
95
[61]96 /// a pointer on the player engine
[3]97 DbtPlyEngine * mEngine;
98
[61]99 /// the absolute path of the DBT file
[3]100 QString dbtProperty_;
[67]101 /// @todo Documentation
[3]102 QStringList mDbtFilenameList;
103
[61]104 /// The directory where the DBT file is located
[3]105 QString mDbtDataPath;
106
[61]107 /// Display or not the graphical interface
[3]108 bool mShowGui;
109
[61]110 /// @todo Documentation
[3]111 struct dbtStruct
112 {
[67]113 /// Data buffer
[3]114 char * buffer;
[67]115 /// Acquisition time
[3]116 road_time_t t;
[67]117 /// Acquisition timerange
[3]118 road_timerange_t tr;
119 };
120
[61]121 /// @todo Documentation
[3]122 struct dbtStructFile
123 {
[67]124 /// the DBT file descriptor
[3]125 pacpus::DbiteFile * pfile;
[67]126 /// the buffer where the data are stored after the reading and the associated time, timerange and file descriptor
[3]127 dbtStruct cur;
[67]128 /// the previous DBT data, these ones that must be processed
[3]129 dbtStruct toProcess;
130 };
131
[67]132 /// @todo Documentation
[3]133 QList<dbtStructFile> dbt_;
[67]134 /// @todo Documentation
[3]135 int dbtIndex_;
136
137private:
[61]138 /// @todo Documentation
[3]139 bool processDbtFileHdfile(dbtStructFile & dbtFile, pacpus::DbiteFile::ReadDirection direction);
140
141private:
142 // reading backward?
143 bool reverse_;
144
[61]145 /// the estimated DBT time sent by the engine and computed relatively to the state of the player
[3]146 road_time_t timeToRead_;
147
[61]148 /// The mode of replay
149 /// @see playMode1, playMode2 methods
[3]150 int mode_;
151
[61]152 /// The minimum and maximum time of the data contained in the file
[3]153 road_time_t tMin_, tMax_;
154
[61]155 /// the synchronization semaphore with the engine
[3]156 QSemaphore * sync_;
157
[61]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
[3]160 int deltaTDbtTab_[1000];
161 int deltaTDbtTabLoop_;
162};
163
164} // namespace pacpus
165
[31]166#endif // DEF_PACPUS_DBTPLYFILEMANAGER_H
Note: See TracBrowser for help on using the repository browser.