]> sigrok.org Git - pulseview.git/blame_incremental - pv/devices/sessionfile.cpp
DecodeSignal: Use srd_session_terminate_reset() for multi-segment data
[pulseview.git] / pv / devices / sessionfile.cpp
... / ...
CommitLineData
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2015 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#include <libsigrokcxx/libsigrokcxx.hpp>
21
22#include <boost/filesystem.hpp>
23
24#include "sessionfile.hpp"
25
26using std::shared_ptr;
27using std::string;
28
29namespace pv {
30namespace devices {
31
32SessionFile::SessionFile(const shared_ptr<sigrok::Context> context,
33 const string &file_name) :
34 File(file_name),
35 context_(context)
36{
37}
38
39void SessionFile::open()
40{
41 if (session_)
42 close();
43
44 session_ = context_->load_session(file_name_);
45 device_ = session_->devices()[0];
46}
47
48void SessionFile::close()
49{
50 if (session_)
51 session_->remove_devices();
52}
53
54} // namespace devices
55} // namespace pv