X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fcxx%2Finclude%2Flibsigrok%2Flibsigrok.hpp;h=972bde883d523fccec8f7324a9dc05dea06f6972;hb=a4e47454580b83972f052b5ace8e687d54d9425c;hp=15509c9c5803ac805956a8f7f648fe98502e95a1;hpb=3b161085731fc6e86f7decedee34f55096282581;p=libsigrok.git diff --git a/bindings/cxx/include/libsigrok/libsigrok.hpp b/bindings/cxx/include/libsigrok/libsigrok.hpp index 15509c9c..972bde88 100644 --- a/bindings/cxx/include/libsigrok/libsigrok.hpp +++ b/bindings/cxx/include/libsigrok/libsigrok.hpp @@ -323,7 +323,8 @@ public: /** Scan for devices and return a list of devices found. * @param options Mapping of (ConfigKey, value) pairs. */ vector > scan( - map options = {}); + map options = + map()); protected: bool _initialized; vector _devices; @@ -378,17 +379,24 @@ protected: /** A real hardware device, connected via a driver */ class SR_API HardwareDevice : - public ParentOwned, + public UserOwned, public Device { public: /** Driver providing this device. */ shared_ptr driver(); protected: - HardwareDevice(Driver *driver, struct sr_dev_inst *structure); + HardwareDevice(shared_ptr driver, struct sr_dev_inst *structure); ~HardwareDevice(); shared_ptr get_shared_from_this(); - Driver *_driver; + shared_ptr _driver; + /** Deleter needed to allow shared_ptr use with protected destructor. */ + class Deleter + { + public: + void operator()(HardwareDevice *device) { delete device; } + }; + friend class Deleter; friend class Driver; friend class ChannelGroup; }; @@ -795,7 +803,8 @@ public: map > options(); /** Create an input using this input format. * @param options Mapping of (option name, value) pairs. */ - shared_ptr create_input(map options = {}); + shared_ptr create_input(map options = + map()); protected: InputFormat(const struct sr_input_module *structure); ~InputFormat(); @@ -874,7 +883,8 @@ public: * @param device Device to output for. * @param options Mapping of (option name, value) pairs. */ shared_ptr create_output(shared_ptr device, - map options = {}); + map options = + map()); protected: OutputFormat(const struct sr_output_module *structure); ~OutputFormat();