bindings: Use new %attributevector and %attributemap macros.
This commit is contained in:
parent
e480df0c45
commit
062430a2fb
|
@ -377,4 +377,13 @@ typedef jobject jsourcecallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
%include "doc.i"
|
%include "doc.i"
|
||||||
|
|
||||||
|
%define %attributevector(Class, Type, Name, Get)
|
||||||
|
%attributeval(sigrok::Class, Type, Name, Get);
|
||||||
|
%enddef
|
||||||
|
|
||||||
|
%define %attributemap(Class, Type, Name, Get)
|
||||||
|
%attributeval(sigrok::Class, Type, Name, Get);
|
||||||
|
%enddef
|
||||||
|
|
||||||
%include "bindings/swig/classes.i"
|
%include "bindings/swig/classes.i"
|
||||||
|
|
|
@ -359,6 +359,14 @@ std::map<std::string, Glib::VariantBase> dict_to_map_options(PyObject *dict,
|
||||||
|
|
||||||
%include "doc.i"
|
%include "doc.i"
|
||||||
|
|
||||||
|
%define %attributevector(Class, Type, Name, Get)
|
||||||
|
%attributeval(sigrok::Class, Type, Name, Get);
|
||||||
|
%enddef
|
||||||
|
|
||||||
|
%define %attributemap(Class, Type, Name, Get)
|
||||||
|
%attributeval(sigrok::Class, Type, Name, Get);
|
||||||
|
%enddef
|
||||||
|
|
||||||
%include "../../../swig/classes.i"
|
%include "../../../swig/classes.i"
|
||||||
|
|
||||||
/* Support Driver.scan() with keyword arguments. */
|
/* Support Driver.scan() with keyword arguments. */
|
||||||
|
|
|
@ -160,11 +160,11 @@ typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
|
||||||
map_ConfigKey_Variant;
|
map_ConfigKey_Variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
%attributeval(sigrok::Context,
|
%attributemap(Context,
|
||||||
map_string_Driver, drivers, drivers);
|
map_string_Driver, drivers, drivers);
|
||||||
%attributeval(sigrok::Context,
|
%attributemap(Context,
|
||||||
map_string_InputFormat, input_formats, input_formats);
|
map_string_InputFormat, input_formats, input_formats);
|
||||||
%attributeval(sigrok::Context,
|
%attributemap(Context,
|
||||||
map_string_OutputFormat, output_formats, output_formats);
|
map_string_OutputFormat, output_formats, output_formats);
|
||||||
|
|
||||||
%attributestring(sigrok::Context,
|
%attributestring(sigrok::Context,
|
||||||
|
@ -196,27 +196,27 @@ typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
|
||||||
%attributestring(sigrok::Option,
|
%attributestring(sigrok::Option,
|
||||||
std::string, description, description);
|
std::string, description, description);
|
||||||
/* Currently broken on Python due to some issue with variant typemaps. */
|
/* Currently broken on Python due to some issue with variant typemaps. */
|
||||||
/* %attributeval(sigrok::Option,
|
/* %attributevector(Option,
|
||||||
Glib::VariantBase, default_value, default_value); */
|
Glib::VariantBase, default_value, default_value); */
|
||||||
%attributeval(sigrok::Option,
|
%attributevector(Option,
|
||||||
std::vector<Glib::VariantBase>, values, values);
|
std::vector<Glib::VariantBase>, values, values);
|
||||||
|
|
||||||
%attributestring(sigrok::OutputFormat,
|
%attributestring(sigrok::OutputFormat,
|
||||||
std::string, name, name);
|
std::string, name, name);
|
||||||
%attributestring(sigrok::OutputFormat,
|
%attributestring(sigrok::OutputFormat,
|
||||||
std::string, description, description);
|
std::string, description, description);
|
||||||
%attributeval(sigrok::OutputFormat,
|
%attributemap(OutputFormat,
|
||||||
map_string_Option, options, options);
|
map_string_Option, options, options);
|
||||||
|
|
||||||
%attributestring(sigrok::Device, std::string, vendor, vendor);
|
%attributestring(sigrok::Device, std::string, vendor, vendor);
|
||||||
%attributestring(sigrok::Device, std::string, model, model);
|
%attributestring(sigrok::Device, std::string, model, model);
|
||||||
%attributestring(sigrok::Device, std::string, version, version);
|
%attributestring(sigrok::Device, std::string, version, version);
|
||||||
|
|
||||||
%attributeval(sigrok::Device,
|
%attributevector(Device,
|
||||||
std::vector<std::shared_ptr<sigrok::Channel> >,
|
std::vector<std::shared_ptr<sigrok::Channel> >,
|
||||||
channels, channels);
|
channels, channels);
|
||||||
|
|
||||||
%attributeval(sigrok::Device, map_string_ChannelGroup,
|
%attributemap(Device, map_string_ChannelGroup,
|
||||||
channel_groups, channel_groups);
|
channel_groups, channel_groups);
|
||||||
|
|
||||||
/* Using %attributestring for shared_ptr attribute. See
|
/* Using %attributestring for shared_ptr attribute. See
|
||||||
|
@ -230,17 +230,17 @@ typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
|
||||||
%attribute(sigrok::Channel, unsigned int, index, index);
|
%attribute(sigrok::Channel, unsigned int, index, index);
|
||||||
|
|
||||||
%attributestring(sigrok::ChannelGroup, std::string, name, name);
|
%attributestring(sigrok::ChannelGroup, std::string, name, name);
|
||||||
%attributeval(sigrok::ChannelGroup,
|
%attributevector(ChannelGroup,
|
||||||
std::vector<std::shared_ptr<sigrok::Channel> >,
|
std::vector<std::shared_ptr<sigrok::Channel> >,
|
||||||
channels, channels);
|
channels, channels);
|
||||||
|
|
||||||
%attributestring(sigrok::Trigger, std::string, name, name);
|
%attributestring(sigrok::Trigger, std::string, name, name);
|
||||||
%attributeval(sigrok::Trigger,
|
%attributevector(Trigger,
|
||||||
std::vector<std::shared_ptr<sigrok::TriggerStage> >,
|
std::vector<std::shared_ptr<sigrok::TriggerStage> >,
|
||||||
stages, stages);
|
stages, stages);
|
||||||
|
|
||||||
%attribute(sigrok::TriggerStage, int, number, number);
|
%attribute(sigrok::TriggerStage, int, number, number);
|
||||||
%attributeval(sigrok::TriggerStage,
|
%attributevector(TriggerStage,
|
||||||
std::vector<std::shared_ptr<sigrok::TriggerMatch> >,
|
std::vector<std::shared_ptr<sigrok::TriggerMatch> >,
|
||||||
matches, matches);
|
matches, matches);
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
|
||||||
%attribute(sigrok::TriggerMatch, const sigrok::TriggerMatchType *, type, type);
|
%attribute(sigrok::TriggerMatch, const sigrok::TriggerMatchType *, type, type);
|
||||||
%attribute(sigrok::TriggerMatch, float, value, value);
|
%attribute(sigrok::TriggerMatch, float, value, value);
|
||||||
|
|
||||||
%attributeval(sigrok::Session,
|
%attributevector(Session,
|
||||||
std::vector<std::shared_ptr<sigrok::Device> >,
|
std::vector<std::shared_ptr<sigrok::Device> >,
|
||||||
devices, devices);
|
devices, devices);
|
||||||
|
|
||||||
|
@ -263,12 +263,12 @@ typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
|
||||||
%attributestring(sigrok::Packet,
|
%attributestring(sigrok::Packet,
|
||||||
std::shared_ptr<sigrok::PacketPayload>, payload, payload);
|
std::shared_ptr<sigrok::PacketPayload>, payload, payload);
|
||||||
|
|
||||||
%attributeval(sigrok::Meta, map_ConfigKey_Variant, config, config);
|
%attributemap(Meta, map_ConfigKey_Variant, config, config);
|
||||||
|
|
||||||
%attribute(sigrok::Analog, int, num_samples, num_samples);
|
%attribute(sigrok::Analog, int, num_samples, num_samples);
|
||||||
%attribute(sigrok::Analog, const sigrok::Quantity *, mq, mq);
|
%attribute(sigrok::Analog, const sigrok::Quantity *, mq, mq);
|
||||||
%attribute(sigrok::Analog, const sigrok::Unit *, unit, unit);
|
%attribute(sigrok::Analog, const sigrok::Unit *, unit, unit);
|
||||||
%attributeval(sigrok::Analog, std::vector<const sigrok::QuantityFlag *>, mq_flags, mq_flags);
|
%attributevector(Analog, std::vector<const sigrok::QuantityFlag *>, mq_flags, mq_flags);
|
||||||
|
|
||||||
%include "libsigrok/libsigrok.hpp"
|
%include "libsigrok/libsigrok.hpp"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue