* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PULSEVIEW_PV_STORESESSION_HPP
#define PULSEVIEW_PV_STORESESSION_HPP
-#include <stdint.h>
-
#include <atomic>
+#include <cstdint>
#include <fstream>
#include <map>
#include <memory>
#include <QObject>
+using std::atomic;
+using std::string;
+using std::shared_ptr;
+using std::pair;
+using std::map;
+using std::vector;
+using std::thread;
+using std::mutex;
+using std::ofstream;
+
namespace sigrok {
class Output;
class OutputFormat;
static const size_t BlockSize;
public:
- StoreSession(const std::string &file_name,
- const std::shared_ptr<sigrok::OutputFormat> &output_format,
- const std::map<std::string, Glib::VariantBase> &options,
- const std::pair<uint64_t, uint64_t> sample_range,
+ StoreSession(const string &file_name,
+ const shared_ptr<sigrok::OutputFormat> &output_format,
+ const map<string, Glib::VariantBase> &options,
+ const pair<uint64_t, uint64_t> sample_range,
const Session &session);
~StoreSession();
- std::pair<int, int> progress() const;
+ pair<int, int> progress() const;
const QString& error() const;
void cancel();
private:
- void store_proc(std::vector< std::shared_ptr<data::SignalBase> > achannel_list,
- std::vector< std::shared_ptr<pv::data::AnalogSegment> > asegment_list,
- std::shared_ptr<pv::data::LogicSegment> lsegment);
+ void store_proc(vector< shared_ptr<data::SignalBase> > achannel_list,
+ vector< shared_ptr<pv::data::AnalogSegment> > asegment_list,
+ shared_ptr<pv::data::LogicSegment> lsegment);
Q_SIGNALS:
void progress_updated();
+ void store_successful();
+
private:
- const std::string file_name_;
- const std::shared_ptr<sigrok::OutputFormat> output_format_;
- const std::map<std::string, Glib::VariantBase> options_;
- const std::pair<uint64_t, uint64_t> sample_range_;
+ const string file_name_;
+ const shared_ptr<sigrok::OutputFormat> output_format_;
+ const map<string, Glib::VariantBase> options_;
+ const pair<uint64_t, uint64_t> sample_range_;
const Session &session_;
- std::shared_ptr<sigrok::Output> output_;
- std::ofstream output_stream_;
+ shared_ptr<sigrok::Output> output_;
+ ofstream output_stream_;
std::thread thread_;
- std::atomic<bool> interrupt_;
+ atomic<bool> interrupt_;
- std::atomic<int> units_stored_, unit_count_;
+ atomic<int> units_stored_, unit_count_;
- mutable std::mutex mutex_;
+ mutable mutex mutex_;
QString error_;
uint64_t start_sample_, sample_count_;
};
-} // pv
+} // namespace pv
#endif // PULSEVIEW_PV_STORESESSION_HPP