]> sigrok.org Git - libsigrok.git/blobdiff - bindings/cxx/include/libsigrok/libsigrok.hpp
C++: Add SessionDevice class for devices owned by loaded sessions.
[libsigrok.git] / bindings / cxx / include / libsigrok / libsigrok.hpp
index 29d6c73638fa7780253e7287ec1c97faac2eec6d..2a819b09c9649ff0a16636ac2296e936b60c7be8 100644 (file)
@@ -585,6 +585,25 @@ protected:
        friend class SourceCallbackData;
 };
 
+/** A virtual device associated with a stored session */
+class SR_API SessionDevice :
+       public ParentOwned<SessionDevice, Session, struct sr_dev_inst>,
+       public Device
+{
+protected:
+       SessionDevice(struct sr_dev_inst *sdi);
+       ~SessionDevice();
+       shared_ptr<Device> get_shared_from_this();
+       /** Deleter needed to allow shared_ptr use with protected destructor. */
+       class Deleter
+       {
+       public:
+               void operator()(SessionDevice *device) { delete device; }
+       };
+       friend class Deleter;
+       friend class Session;
+};
+
 /** A sigrok session */
 class SR_API Session : public UserOwned<Session, struct sr_session>
 {