]> sigrok.org Git - libsigrok.git/blobdiff - bindings/cxx/classes.cpp
bindings: Remove Device::description().
[libsigrok.git] / bindings / cxx / classes.cpp
index 86d0865e30b59460365def90bb72160bc90f91dc..41ded8522ba89c6d22aff03d74e9e6c122369674 100644 (file)
@@ -437,29 +437,6 @@ Device::~Device()
                delete entry.second;
 }
 
-string Device::description()
-{
-       ostringstream s;
-
-       vector<string> parts =
-               {vendor(), model(), version(), serial_number()};
-
-       for (size_t i = 0; i < parts.size(); i++)
-       {
-               if (parts[i].length() > 0)
-               {
-                       if (i != 0)
-                               s << " ";
-                       s << parts[i];
-               }
-       }
-
-       if (serial_number().length() == 0 && connection_id().length() > 0)
-               s << " " << connection_id();
-
-       return s.str();
-}
-
 string Device::vendor()
 {
        return valid_string(_structure->vendor);
@@ -806,6 +783,7 @@ Session::Session(shared_ptr<Context> context) :
 Session::Session(shared_ptr<Context> context, string filename) :
        UserOwned(_structure),
        _context(context),
+       _filename(filename),
        _saving(false)
 {
        check(sr_session_load(filename.c_str(), &_structure));
@@ -865,16 +843,6 @@ vector<shared_ptr<Device>> Session::devices()
 
 void Session::remove_devices()
 {
-       for (auto entry : _owned_devices)
-       {
-               // We own this device. Make sure it's not referenced.
-               auto device = entry.second;
-               auto ptr = device->get_shared_pointer(this);
-               if (ptr.use_count() > 1)
-                       throw Error(SR_ERR_BUG);
-               delete device;
-       }
-       _owned_devices.clear();
        _other_devices.clear();
        check(sr_session_dev_remove_all(_structure));
 }
@@ -1075,6 +1043,11 @@ void Session::set_trigger(shared_ptr<Trigger> trigger)
        _trigger = trigger;
 }
 
+string Session::filename()
+{
+       return _filename;
+}
+
 Packet::Packet(shared_ptr<Device> device,
        const struct sr_datafeed_packet *structure) :
        UserOwned(structure),