diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index c5ce6386..5cab6ac9 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -278,7 +278,7 @@ shared_ptr Context::create_header_packet(Glib::TimeVal start_time) } shared_ptr Context::create_meta_packet( - const map &config) + map config) { auto meta = g_new0(struct sr_datafeed_meta, 1); for (const auto &input : config) @@ -311,9 +311,9 @@ shared_ptr Context::create_logic_packet( } shared_ptr Context::create_analog_packet( - const vector > &channels, + vector > channels, float *data_pointer, unsigned int num_samples, const Quantity *mq, - const Unit *unit, const vector &mqflags) + const Unit *unit, vector mqflags) { auto analog = g_new0(struct sr_datafeed_analog, 1); auto meaning = g_new0(struct sr_analog_meaning, 1); @@ -325,7 +325,7 @@ shared_ptr Context::create_analog_packet( analog->num_samples = num_samples; meaning->mq = static_cast(mq->id()); meaning->unit = static_cast(unit->id()); - meaning->mqflags = static_cast(QuantityFlag::mask_from_flags(mqflags)); + meaning->mqflags = static_cast(QuantityFlag::mask_from_flags(move(mqflags))); analog->data = data_pointer; auto packet = g_new(struct sr_datafeed_packet, 1); packet->type = SR_DF_ANALOG; @@ -407,7 +407,7 @@ string Driver::long_name() const } vector> Driver::scan( - const map &options) + map options) { /* Initialise the driver if not yet done. */ if (!_initialized) @@ -1274,7 +1274,7 @@ map> InputFormat::options() } shared_ptr InputFormat::create_input( - const map &options) + map options) { auto input = sr_input_new(_structure, map_to_hash_variant(options)); if (!input) @@ -1423,18 +1423,18 @@ map> OutputFormat::options() } shared_ptr OutputFormat::create_output( - shared_ptr device, const map &options) + shared_ptr device, map options) { return shared_ptr{ - new Output{shared_from_this(), move(device), options}, + new Output{shared_from_this(), move(device), move(options)}, default_delete{}}; } shared_ptr OutputFormat::create_output(string filename, - shared_ptr device, const map &options) + shared_ptr device, map options) { return shared_ptr{ - new Output{move(filename), shared_from_this(), move(device), options}, + new Output{move(filename), shared_from_this(), move(device), move(options)}, default_delete{}}; } @@ -1444,22 +1444,22 @@ bool OutputFormat::test_flag(const OutputFlag *flag) const } Output::Output(shared_ptr format, - shared_ptr device, const map &options) : + shared_ptr device, map options) : _structure(sr_output_new(format->_structure, map_to_hash_variant(options), device->_structure, nullptr)), _format(move(format)), _device(move(device)), - _options(options) + _options(move(options)) { } Output::Output(string filename, shared_ptr format, - shared_ptr device, const map &options) : + shared_ptr device, map options) : _structure(sr_output_new(format->_structure, map_to_hash_variant(options), device->_structure, filename.c_str())), _format(move(format)), _device(move(device)), - _options(options) + _options(move(options)) { } diff --git a/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp b/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp index f7b2c468..620e45eb 100644 --- a/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp +++ b/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp @@ -269,15 +269,15 @@ public: shared_ptr create_header_packet(Glib::TimeVal start_time); /** Create a meta packet. */ shared_ptr create_meta_packet( - const map &config); + map config); /** Create a logic packet. */ shared_ptr create_logic_packet( void *data_pointer, size_t data_length, unsigned int unit_size); /** Create an analog packet. */ shared_ptr create_analog_packet( - const vector > &channels, + vector > channels, float *data_pointer, unsigned int num_samples, const Quantity *mq, - const Unit *unit, const vector &mqflags); + const Unit *unit, vector mqflags); /** Load a saved session. * @param filename File name string. */ shared_ptr load_session(string filename); @@ -352,8 +352,8 @@ public: string long_name() const; /** Scan for devices and return a list of devices found. * @param options Mapping of (ConfigKey, value) pairs. */ - vector > scan(const map - &options = map()); + vector > scan(map + options = map()); private: struct sr_dev_driver *_structure; bool _initialized; @@ -798,8 +798,8 @@ public: map > options(); /** Create an input using this input format. * @param options Mapping of (option name, value) pairs. */ - shared_ptr create_input(const map - &options = map()); + shared_ptr create_input(map + options = map()); private: explicit InputFormat(const struct sr_input_module *structure); ~InputFormat(); @@ -893,14 +893,14 @@ public: * @param device Device to output for. * @param options Mapping of (option name, value) pairs. */ shared_ptr create_output(shared_ptr device, - const map &options = map()); + map options = map()); /** Create an output using this format. * @param filename Name of destination file. * @param device Device to output for. * @param options Mapping of (option name, value) pairs. */ shared_ptr create_output(string filename, shared_ptr device, - const map &options = map()); + map options = map()); /** * Checks whether a given flag is set. * @param flag Flag to check @@ -929,9 +929,9 @@ public: private: Output(shared_ptr format, shared_ptr device); Output(shared_ptr format, - shared_ptr device, const map &options); + shared_ptr device, map options); Output(string filename, shared_ptr format, - shared_ptr device, const map &options); + shared_ptr device, map options); ~Output(); const struct sr_output *_structure;