]> 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 637daf912114e99dd4b8efe1a5eb1922579eaf77..2a819b09c9649ff0a16636ac2296e936b60c7be8 100644 (file)
@@ -297,6 +297,8 @@ public:
        Glib::VariantContainerBase config_list(const ConfigKey *key);
        /** Enumerate available keys, according to a given index key. */
        vector<const ConfigKey *> config_keys(const ConfigKey *key);
+       /** Check for a key in the list from a given index key. */
+       bool config_check(const ConfigKey *key, const ConfigKey *index_key);
 protected:
        Configurable(
                struct sr_dev_driver *driver,
@@ -583,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>
 {