X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fcxx%2Fclasses.cpp;h=3043ba51b318caf15d37aa5aab2be6e0be190247;hb=cac58676e987d06b890366ac4078a1e4fb1cbdc3;hp=76d3e8ecfed5c9a32d22967016e0adde7901ac63;hpb=be43d5d58472a54fbf49df93781be4775a831a41;p=libsigrok.git diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 76d3e8ec..3043ba51 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -745,6 +745,21 @@ EventSource::~EventSource() { } +SessionDevice::SessionDevice(struct sr_dev_inst *structure) : + ParentOwned(structure), + Device(structure) +{ +} + +SessionDevice::~SessionDevice() +{ +} + +shared_ptr SessionDevice::get_shared_from_this() +{ + return static_pointer_cast(shared_from_this()); +} + Session::Session(shared_ptr context) : UserOwned(structure), context(context), saving(false) @@ -758,6 +773,15 @@ Session::Session(shared_ptr context, string filename) : context(context), saving(false) { check(sr_session_load(filename.c_str(), &structure)); + GSList *dev_list; + check(sr_session_dev_list(structure, &dev_list)); + for (GSList *dev = dev_list; dev; dev = dev->next) + { + auto sdi = (struct sr_dev_inst *) dev->data; + auto device = new SessionDevice(sdi); + devices[sdi] = shared_ptr(device, + SessionDevice::Deleter()); + } context->session = this; }