#pragma SWIG nowarn=325,401
-%{
-#include "libsigrok/libsigrok.hpp"
-using namespace std;
-%}
-
%include "typemaps.i"
-%include "std_string.i"
-%include "std_vector.i"
-%include "std_map.i"
-%include "std_shared_ptr.i"
%include "exception.i"
%{
%shared_ptr(sigrok::HardwareDevice);
%shared_ptr(sigrok::Channel);
%shared_ptr(sigrok::ChannelGroup);
-%shared_ptr(sigrok::EventSource);
%shared_ptr(sigrok::Session);
%shared_ptr(sigrok::SessionDevice);
%shared_ptr(sigrok::Packet);
%shared_ptr(sigrok::Trigger);
%shared_ptr(sigrok::TriggerStage);
%shared_ptr(sigrok::TriggerMatch);
-
-%template(StringMap) std::map<std::string, std::string>;
-
-%template(DriverMap)
- std::map<std::string, std::shared_ptr<sigrok::Driver> >;
-%template(InputFormatMap)
- std::map<std::string, std::shared_ptr<sigrok::InputFormat> >;
-%template(OutputFormatMap)
- std::map<std::string, std::shared_ptr<sigrok::OutputFormat> >;
-
-%template(HardwareDeviceVector)
- std::vector<std::shared_ptr<sigrok::HardwareDevice> >;
-
-%template(DeviceVector)
- std::vector<std::shared_ptr<sigrok::Device> >;
-
-%template(ChannelVector)
- std::vector<std::shared_ptr<sigrok::Channel> >;
-
-%template(ChannelGroupMap)
- std::map<std::string, std::shared_ptr<sigrok::ChannelGroup> >;
-
-/* Workaround for SWIG bug. The vector template instantiation
- isn't needed but somehow fixes a bug that stops the wrapper
- for the map instantiation from compiling. */
-%template(ConfigVector)
- std::vector<const sigrok::ConfigKey *>;
-%template(ConfigMap)
- std::map<const sigrok::ConfigKey *, Glib::VariantBase>;
-
-%template(OptionVector)
- std::vector<std::shared_ptr<sigrok::Option> >;
-%template(OptionMap)
- std::map<std::string, std::shared_ptr<sigrok::Option> >;
-
-%template(VariantVector)
- std::vector<Glib::VariantBase>;
-%template(VariantMap)
- std::map<std::string, Glib::VariantBase>;
-
-%template(QuantityFlagVector)
- std::vector<const sigrok::QuantityFlag *>;
-
-%template(TriggerStageVector)
- std::vector<std::shared_ptr<sigrok::TriggerStage> >;
-
-%template(TriggerMatchVector)
- std::vector<std::shared_ptr<sigrok::TriggerMatch> >;
+%shared_ptr(sigrok::UserDevice);
#define SR_API
#define SR_PRIV
%ignore sigrok::DatafeedCallbackData;
-%ignore sigrok::SourceCallbackData;
+
+#ifndef SWIGJAVA
#define SWIG_ATTRIBUTE_TEMPLATE
map_ConfigKey_Variant;
}
-%attributeval(sigrok::Context,
+%attributemap(Context,
map_string_Driver, drivers, drivers);
-%attributeval(sigrok::Context,
+%attributemap(Context,
map_string_InputFormat, input_formats, input_formats);
-%attributeval(sigrok::Context,
+%attributemap(Context,
map_string_OutputFormat, output_formats, output_formats);
%attributestring(sigrok::Context,
%attribute(sigrok::Context,
const sigrok::LogLevel *, log_level, log_level, set_log_level);
-%attributestring(sigrok::Context,
- std::string, log_domain, log_domain, set_log_domain);
-
%attributestring(sigrok::Driver, std::string, name, name);
%attributestring(sigrok::Driver, std::string, long_name, long_name);
%attributestring(sigrok::Option,
std::string, description, description);
/* Currently broken on Python due to some issue with variant typemaps. */
-/* %attributeval(sigrok::Option,
+/* %attributevector(Option,
Glib::VariantBase, default_value, default_value); */
-%attributeval(sigrok::Option,
+%attributevector(Option,
std::vector<Glib::VariantBase>, values, values);
%attributestring(sigrok::OutputFormat,
std::string, name, name);
%attributestring(sigrok::OutputFormat,
std::string, description, description);
-%attributeval(sigrok::OutputFormat,
+%attributemap(OutputFormat,
map_string_Option, options, options);
-%attributestring(sigrok::Device, std::string, description, description);
%attributestring(sigrok::Device, std::string, vendor, vendor);
%attributestring(sigrok::Device, std::string, model, model);
%attributestring(sigrok::Device, std::string, version, version);
-%attributeval(sigrok::Device,
+%attributevector(Device,
std::vector<std::shared_ptr<sigrok::Channel> >,
channels, channels);
-%attributeval(sigrok::Device, map_string_ChannelGroup,
+%attributemap(Device, map_string_ChannelGroup,
channel_groups, channel_groups);
/* Using %attributestring for shared_ptr attribute. See
%attribute(sigrok::Channel, unsigned int, index, index);
%attributestring(sigrok::ChannelGroup, std::string, name, name);
-%attributeval(sigrok::ChannelGroup,
+%attributevector(ChannelGroup,
std::vector<std::shared_ptr<sigrok::Channel> >,
channels, channels);
%attributestring(sigrok::Trigger, std::string, name, name);
-%attributeval(sigrok::Trigger,
+%attributevector(Trigger,
std::vector<std::shared_ptr<sigrok::TriggerStage> >,
stages, stages);
%attribute(sigrok::TriggerStage, int, number, number);
-%attributeval(sigrok::TriggerStage,
+%attributevector(TriggerStage,
std::vector<std::shared_ptr<sigrok::TriggerMatch> >,
matches, matches);
%attribute(sigrok::TriggerMatch, const sigrok::TriggerMatchType *, type, type);
%attribute(sigrok::TriggerMatch, float, value, value);
-%attributeval(sigrok::Session,
+%attributevector(Session,
std::vector<std::shared_ptr<sigrok::Device> >,
devices, devices);
%attribute(sigrok::Packet,
const sigrok::PacketType *, type, type);
-%attributestring(sigrok::Packet,
- std::shared_ptr<sigrok::PacketPayload>, payload, payload);
-%attributeval(sigrok::Meta, map_ConfigKey_Variant, config, config);
+%attributemap(Meta, map_ConfigKey_Variant, config, config);
+%attributevector(Analog,
+ std::vector<std::shared_ptr<sigrok::Channel> >, channels, channels);
%attribute(sigrok::Analog, int, num_samples, num_samples);
%attribute(sigrok::Analog, const sigrok::Quantity *, mq, mq);
%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"
+#endif
-namespace sigrok {
-%include "libsigrok/enums.hpp"
-}
+%include <libsigrokcxx/libsigrokcxx.hpp>
+
+%include "swig/enums.i"
+
+%include <libsigrokcxx/enums.hpp>