]> sigrok.org Git - pulseview.git/blame_incremental - pv/storesession.hpp
Remove unused "using" declarations.
[pulseview.git] / pv / storesession.hpp
... / ...
CommitLineData
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PULSEVIEW_PV_STORESESSION_HPP
21#define PULSEVIEW_PV_STORESESSION_HPP
22
23#include <stdint.h>
24
25#include <atomic>
26#include <fstream>
27#include <map>
28#include <memory>
29#include <mutex>
30#include <string>
31#include <thread>
32
33#include <glibmm/variant.h>
34
35#include <QObject>
36
37using std::atomic;
38using std::string;
39using std::shared_ptr;
40using std::pair;
41using std::map;
42using std::vector;
43using std::thread;
44using std::mutex;
45using std::ofstream;
46
47namespace sigrok {
48class Output;
49class OutputFormat;
50}
51
52namespace pv {
53
54class Session;
55
56namespace data {
57class SignalBase;
58class AnalogSegment;
59class LogicSegment;
60}
61
62class StoreSession : public QObject
63{
64 Q_OBJECT
65
66private:
67 static const size_t BlockSize;
68
69public:
70 StoreSession(const string &file_name,
71 const shared_ptr<sigrok::OutputFormat> &output_format,
72 const map<string, Glib::VariantBase> &options,
73 const pair<uint64_t, uint64_t> sample_range,
74 const Session &session);
75
76 ~StoreSession();
77
78 pair<int, int> progress() const;
79
80 const QString& error() const;
81
82 bool start();
83
84 void wait();
85
86 void cancel();
87
88private:
89 void store_proc(vector< shared_ptr<data::SignalBase> > achannel_list,
90 vector< shared_ptr<pv::data::AnalogSegment> > asegment_list,
91 shared_ptr<pv::data::LogicSegment> lsegment);
92
93Q_SIGNALS:
94 void progress_updated();
95
96 void store_successful();
97
98private:
99 const string file_name_;
100 const shared_ptr<sigrok::OutputFormat> output_format_;
101 const map<string, Glib::VariantBase> options_;
102 const pair<uint64_t, uint64_t> sample_range_;
103 const Session &session_;
104
105 shared_ptr<sigrok::Output> output_;
106 ofstream output_stream_;
107
108 std::thread thread_;
109
110 atomic<bool> interrupt_;
111
112 atomic<int> units_stored_, unit_count_;
113
114 mutable mutex mutex_;
115 QString error_;
116
117 uint64_t start_sample_, sample_count_;
118};
119
120} // pv
121
122#endif // PULSEVIEW_PV_STORESESSION_HPP