]> sigrok.org Git - libsigrok.git/blobdiff - bindings/cxx/include/libsigrok/libsigrok.hpp
bindings: Add Session::filename() and corresponding SWIG attribute.
[libsigrok.git] / bindings / cxx / include / libsigrok / libsigrok.hpp
index e30fd4d396a360dbca2df87de75eda0ff17c8b57..3e49bd5986defbc4cbabc789c0adf0be2c08a9f6 100644 (file)
@@ -149,6 +149,12 @@ protected:
        weak_ptr<Class> _weak_this;
 
 public:
+       /* Get parent object that owns this object. */
+       shared_ptr<Parent> parent()
+       {
+               return _parent;
+       }
+
        /* Note, this implementation will create a new smart_ptr if none exists. */
        shared_ptr<Class> shared_from_this()
        {
@@ -347,7 +353,7 @@ class SR_API Device : public Configurable
 {
 public:
        /** Description identifying this device. */
-       string description();
+       virtual string description();
        /** Vendor name for this device. */
        string vendor();
        /** Model name for this device. */
@@ -609,6 +615,8 @@ class SR_API SessionDevice :
        public ParentOwned<SessionDevice, Session, struct sr_dev_inst>,
        public Device
 {
+       /** Description identifying this device. */
+       string description();
 protected:
        SessionDevice(struct sr_dev_inst *sdi);
        ~SessionDevice();
@@ -664,14 +672,19 @@ public:
        /** Set trigger setting.
         * @param trigger Trigger object to use. */
        void set_trigger(shared_ptr<Trigger> trigger);
+       /** Get filename this session was loaded from. */
+       string filename();
 protected:
        Session(shared_ptr<Context> context);
        Session(shared_ptr<Context> context, string filename);
        ~Session();
+       shared_ptr<Device> get_device(const struct sr_dev_inst *sdi);
        const shared_ptr<Context> _context;
-       map<const struct sr_dev_inst *, shared_ptr<Device> > _devices;
+       map<const struct sr_dev_inst *, SessionDevice *> _owned_devices;
+       map<const struct sr_dev_inst *, shared_ptr<Device> > _other_devices;
        vector<DatafeedCallbackData *> _datafeed_callbacks;
        map<shared_ptr<EventSource>, SourceCallbackData *> _source_callbacks;
+       string _filename;
        bool _saving;
        bool _save_initialized;
        string _save_filename;
@@ -680,6 +693,7 @@ protected:
        friend class Deleter;
        friend class Context;
        friend class DatafeedCallbackData;
+       friend class SessionDevice;
 };
 
 /** A packet on the session datafeed */
@@ -849,6 +863,9 @@ class SR_API InputDevice :
        public ParentOwned<InputDevice, Input, struct sr_dev_inst>,
        public Device
 {
+public:
+       /** Description identifying this device. */
+       string description();
 protected:
        InputDevice(shared_ptr<Input> input, struct sr_dev_inst *sdi);
        ~InputDevice();