X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdevices%2Fsessionfile.cpp;h=1e8c3acda039f3184e32e701972f16b7f5617bfd;hp=4ca982ae7cf4f3897dbf83778faecf3ff0a08dfd;hb=efdec55aec1a137460fa362a381ed1904182bfed;hpb=da30ecb7e72bd2547e524258efa5ec642988b70b diff --git a/pv/devices/sessionfile.cpp b/pv/devices/sessionfile.cpp index 4ca982ae..1e8c3acd 100644 --- a/pv/devices/sessionfile.cpp +++ b/pv/devices/sessionfile.cpp @@ -14,27 +14,39 @@ * 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 . */ #include +#include + #include "sessionfile.hpp" namespace pv { namespace devices { -SessionFile::SessionFile(const std::shared_ptr &context, +SessionFile::SessionFile(const std::shared_ptr context, const std::string &file_name) : - context_(context), - file_name_(file_name) { + File(file_name), + context_(context) +{ } -void SessionFile::create() { +void SessionFile::open() +{ + if (session_) + close(); + session_ = context_->load_session(file_name_); device_ = session_->devices()[0]; } +void SessionFile::close() +{ + if (session_) + session_->remove_devices(); +} + } // namespace devices } // namespace pv