X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=pv%2Fdevices%2Fsessionfile.cpp;h=0ba64a9b48cf6ffa4c2e7843bb95cf0a739dea7e;hb=0cbadf1c6a80ec37481ae11ee3cb709eeffda3e7;hp=7bcabee036cef366eb59d6cd3d5e4731ae1e9bfe;hpb=474e817a724fdad4db635ba59202283fbcc22ef9;p=pulseview.git
diff --git a/pv/devices/sessionfile.cpp b/pv/devices/sessionfile.cpp
index 7bcabee0..0ba64a9b 100644
--- a/pv/devices/sessionfile.cpp
+++ b/pv/devices/sessionfile.cpp
@@ -14,8 +14,7 @@
* 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
@@ -24,19 +23,33 @@
#include "sessionfile.hpp"
+using std::shared_ptr;
+using std::string;
+
namespace pv {
namespace devices {
-SessionFile::SessionFile(const std::shared_ptr &context,
- const std::string &file_name) :
+SessionFile::SessionFile(const shared_ptr context,
+ const string &file_name) :
File(file_name),
- context_(context) {
+ 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