X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fcxx%2Finclude%2Flibsigrok%2Flibsigrok.hpp;h=3063e3bdb41671964d44fb8fdff6ac0f54c0c087;hb=7ea75009d1977874efb686b000516c4ce1343474;hp=a6cca1d2b5c638bf45c5c117b0e0bb07622ef16b;hpb=f36ca8893d575d42eae0b103768ac7d8a4320322;p=libsigrok.git diff --git a/bindings/cxx/include/libsigrok/libsigrok.hpp b/bindings/cxx/include/libsigrok/libsigrok.hpp index a6cca1d2..3063e3bd 100644 --- a/bindings/cxx/include/libsigrok/libsigrok.hpp +++ b/bindings/cxx/include/libsigrok/libsigrok.hpp @@ -111,6 +111,7 @@ class SR_API QuantityFlag; class SR_API InputFileDevice; class SR_API Output; class SR_API DataType; +class SR_API Option; /** Exception thrown when an error code is returned by any libsigrok call. */ class SR_API Error: public exception @@ -340,6 +341,8 @@ public: bool get_enabled(); /** Set the enabled status of this channel. */ void set_enabled(bool value); + /** Get the index number of this channel. */ + unsigned int get_index(); protected: Channel(struct sr_channel *structure); ~Channel(); @@ -715,19 +718,52 @@ protected: friend class InputFormat; }; +/** An option used by an output format */ +class SR_API Option +{ +public: + /** Short name of this option suitable for command line usage. */ + string get_id(); + /** Short name of this option suitable for GUI usage. */ + string get_name(); + /** Description of this option in a sentence. */ + string get_description(); + /** Default value for this option. */ + Glib::VariantBase get_default_value(); + /** Possible values for this option, if a limited set. */ + vector get_values(); +protected: + Option(const struct sr_option *structure, + shared_ptr structure_array); + ~Option(); + const struct sr_option *structure; + shared_ptr structure_array; + /** Deleter needed to allow shared_ptr use with protected destructor. */ + class Deleter + { + public: + void operator()(Option *option) { delete option; } + }; + friend class Deleter; + friend class OutputFormat; +}; + /** An output format supported by the library */ class SR_API OutputFormat : - public StructureWrapper + public StructureWrapper { public: /** Name of this output format. */ string get_name(); /** Description of this output format. */ string get_description(); + /** Options supported by this output format. */ + map > get_options(); /** Create an output using this format. */ - shared_ptr create_output(shared_ptr device, map options = {}); + shared_ptr create_output(shared_ptr device, + map options = {}); protected: - OutputFormat(struct sr_output_format *structure); + OutputFormat(const struct sr_output_module *structure); ~OutputFormat(); friend class Context; friend class Output; @@ -742,12 +778,12 @@ public: protected: Output(shared_ptr format, shared_ptr device); Output(shared_ptr format, - shared_ptr device, map options); + shared_ptr device, map options); ~Output(); - struct sr_output *structure; + const struct sr_output *structure; const shared_ptr format; const shared_ptr device; - const map options; + const map options; /** Deleter needed to allow shared_ptr use with protected destructor. */ class Deleter {