2 * This file is part of the libsigrok project.
4 * Copyright (C) 2013-2014 Martin Ling <martin-sigrok@earth.li>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 @mainpage API Reference
27 The sigrok++ API provides an object-oriented C++ interface to the functionality
28 in libsigrok, including automatic memory and resource management.
30 It is built on top of the public libsigrok C API, and is designed to be used as
31 a standalone alternative API. Programs should not mix usage of the C and C++
32 APIs; the C++ interface code needs to have full control of all C API calls for
33 resources to be managed correctly.
38 All runtime objects created through the C++ API are passed and accessed via
39 shared pointers, using the C++11 std::shared_ptr implementation. This means
40 that a reference count is kept for each object.
42 Shared pointers can be copied and assigned in a user's program, automatically
43 updating their reference count and deleting objects when they are no longer in
44 use. The C++ interface code also keeps track of internal dependencies between
45 libsigrok resources, and ensures that objects are not prematurely deleted when
46 their resources are in use by other objects.
48 This means that management of sigrok++ objects and their underlying libsigrok
49 resources can be treated as fully automatic. As long as all shared pointers to
50 objects are deleted or reassigned when no longer in use, all underlying
51 resources will be released at the right time.
56 Usage of the C++ API needs to begin with a call to sigrok::Context::create().
57 This will create the global libsigrok context and returns a shared pointer to
58 the sigrok::Context object. Methods on this object provide access to the
59 hardware drivers, input and output formats supported by the library, as well
60 as means of creating other objects such as sessions and triggers.
65 When any libsigrok C API call returns an error, a sigrok::Error exception is
66 raised, which provides access to the error code and description.
73 #include "libsigrok/libsigrok.h"
74 #include <glibmm-2.4/glibmm.h>
86 /* Forward declarations */
91 class SR_API HardwareDevice;
93 class SR_API EventSource;
95 class SR_API ConfigKey;
96 class SR_API InputFormat;
97 class SR_API OutputFormat;
98 class SR_API LogLevel;
99 class SR_API ChannelGroup;
100 class SR_API Trigger;
101 class SR_API TriggerStage;
102 class SR_API TriggerMatch;
103 class SR_API TriggerMatchType;
104 class SR_API ChannelType;
106 class SR_API PacketPayload;
107 class SR_API PacketType;
108 class SR_API Quantity;
110 class SR_API QuantityFlag;
112 class SR_API InputDevice;
114 class SR_API DataType;
117 /** Exception thrown when an error code is returned by any libsigrok call. */
118 class SR_API Error: public exception
124 const char *what() const throw();
127 /* Base template for most classes which wrap a struct type from libsigrok. */
128 template <class Parent, typename Struct> class SR_API StructureWrapper
131 /* Parent object which owns this child object's underlying structure.
133 This shared pointer will be null when this child is unused, but
134 will be assigned to point to the parent before any shared pointer
135 to this child is handed out to the user.
137 When the reference count of this child falls to zero, this shared
138 pointer to its parent is reset by a custom deleter on the child's
141 This strategy ensures that the destructors for both the child and
142 the parent are called at the correct time, i.e. only when all
143 references to both the parent and all its children are gone. */
144 shared_ptr<Parent> parent;
146 /* Weak pointer for shared_from_this() implementation. */
147 weak_ptr<StructureWrapper<Parent, Struct> > weak_this;
150 /* Note, this implementation will create a new smart_ptr if none exists. */
151 shared_ptr<StructureWrapper<Parent, Struct> > shared_from_this()
153 shared_ptr<StructureWrapper<Parent, Struct> > shared;
155 if (!(shared = weak_this.lock()))
157 shared = shared_ptr<StructureWrapper<Parent, Struct> >(
165 shared_ptr<StructureWrapper<Parent, Struct> >
166 get_shared_pointer(shared_ptr<Parent> parent)
169 throw Error(SR_ERR_BUG);
170 this->parent = parent;
171 return shared_from_this();
174 shared_ptr<StructureWrapper<Parent, Struct> >
175 get_shared_pointer(Parent *parent)
178 throw Error(SR_ERR_BUG);
179 return get_shared_pointer(static_pointer_cast<Parent>(
180 parent->shared_from_this()));
183 static void reset_parent(StructureWrapper<Parent, Struct> *object)
186 throw Error(SR_ERR_BUG);
187 object->parent.reset();
192 StructureWrapper<Parent, Struct>(Struct *structure) :
198 /** Type of log callback */
199 typedef function<void(const LogLevel *, string message)> LogCallbackFunction;
201 /** The global libsigrok context */
202 class SR_API Context : public enable_shared_from_this<Context>
205 /** Create new context */
206 static shared_ptr<Context> create();
207 /** libsigrok package version. */
208 string get_package_version();
209 /** libsigrok library version. */
210 string get_lib_version();
211 /** Available hardware drivers, indexed by name. */
212 map<string, shared_ptr<Driver> > get_drivers();
213 /** Available input formats, indexed by name. */
214 map<string, shared_ptr<InputFormat> > get_input_formats();
215 /** Available output formats, indexed by name. */
216 map<string, shared_ptr<OutputFormat> > get_output_formats();
217 /** Current log level. */
218 const LogLevel *get_log_level();
219 /** Set the log level.
220 * @param level LogLevel to use. */
221 void set_log_level(const LogLevel *level);
222 /** Current log domain. */
223 string get_log_domain();
224 /** Set the log domain.
225 * @param value Log domain prefix string. */
226 void set_log_domain(string value);
227 /** Set the log callback.
228 * @param callback Callback of the form callback(LogLevel, string). */
229 void set_log_callback(LogCallbackFunction callback);
230 /** Set the log callback to the default handler. */
231 void set_log_callback_default();
232 /** Create a new session. */
233 shared_ptr<Session> create_session();
234 /** Load a saved session.
235 * @param filename File name string. */
236 shared_ptr<Session> load_session(string filename);
237 /** Create a new trigger.
238 * @param name Name string for new trigger. */
239 shared_ptr<Trigger> create_trigger(string name);
240 /** Open an input file.
241 * @param filename File name string. */
242 shared_ptr<Input> open_file(string filename);
243 /** Open an input stream based on header data.
244 * @param header Initial data from stream. */
245 shared_ptr<Input> open_stream(string header);
247 struct sr_context *structure;
248 map<string, Driver *> drivers;
249 map<string, InputFormat *> input_formats;
250 map<string, OutputFormat *> output_formats;
252 LogCallbackFunction log_callback;
255 /** Deleter needed to allow shared_ptr use with protected destructor. */
259 void operator()(Context *context) { delete context; }
261 friend class Deleter;
262 friend class Session;
266 /** A hardware driver provided by the library */
267 class SR_API Driver : public StructureWrapper<Context, struct sr_dev_driver>
270 /** Name of this driver. */
272 /** Long name for this driver. */
273 string get_long_name();
274 /** Scan for devices and return a list of devices found.
275 * @param options Mapping of (ConfigKey, value) pairs. */
276 vector<shared_ptr<HardwareDevice> > scan(
277 map<const ConfigKey *, Glib::VariantBase> options = {});
280 vector<HardwareDevice *> devices;
281 Driver(struct sr_dev_driver *structure);
283 friend class Context;
284 friend class HardwareDevice;
285 friend class ChannelGroup;
288 /** An object that can be configured. */
289 class SR_API Configurable
292 /** Read configuration for the given key.
293 * @param key ConfigKey to read. */
294 Glib::VariantBase config_get(const ConfigKey *key);
295 /** Set configuration for the given key to a specified value.
296 * @param key ConfigKey to set.
297 * @param value Value to set. */
298 void config_set(const ConfigKey *key, Glib::VariantBase value);
299 /** Enumerate available values for the given configuration key.
300 * @param key ConfigKey to enumerate values for. */
301 Glib::VariantContainerBase config_list(const ConfigKey *key);
304 struct sr_dev_driver *driver,
305 struct sr_dev_inst *sdi,
306 struct sr_channel_group *channel_group);
307 virtual ~Configurable();
308 struct sr_dev_driver *config_driver;
309 struct sr_dev_inst *config_sdi;
310 struct sr_channel_group *config_channel_group;
313 /** A generic device, either hardware or virtual */
314 class SR_API Device : public Configurable
317 /** Description identifying this device. */
318 string get_description();
319 /** Vendor name for this device. */
321 /** Model name for this device. */
323 /** Version string for this device. */
324 string get_version();
325 /** List of the channels available on this device. */
326 vector<shared_ptr<Channel> > get_channels();
327 /** Channel groups available on this device, indexed by name. */
328 map<string, shared_ptr<ChannelGroup> > get_channel_groups();
334 Device(struct sr_dev_inst *structure);
336 virtual shared_ptr<Device> get_shared_from_this() = 0;
337 shared_ptr<Channel> get_channel(struct sr_channel *ptr);
338 struct sr_dev_inst *structure;
339 map<struct sr_channel *, Channel *> channels;
340 map<string, ChannelGroup *> channel_groups;
341 /** Deleter needed to allow shared_ptr use with protected destructor. */
345 void operator()(Device *device) { delete device; }
347 friend class Deleter;
348 friend class Session;
349 friend class Channel;
350 friend class ChannelGroup;
355 /** A real hardware device, connected via a driver */
356 class SR_API HardwareDevice :
357 public StructureWrapper<Context, struct sr_dev_inst>,
361 /** Driver providing this device. */
362 shared_ptr<Driver> get_driver();
364 HardwareDevice(Driver *driver, struct sr_dev_inst *structure);
366 shared_ptr<Device> get_shared_from_this();
369 friend class ChannelGroup;
372 /** A channel on a device */
373 class SR_API Channel : public StructureWrapper<Device, struct sr_channel>
376 /** Current name of this channel. */
378 /** Set the name of this channel. *
379 * @param name Name string to set. */
380 void set_name(string name);
381 /** Type of this channel. */
382 const ChannelType *get_type();
383 /** Enabled status of this channel. */
385 /** Set the enabled status of this channel.
386 * @param value Boolean value to set. */
387 void set_enabled(bool value);
388 /** Get the index number of this channel. */
389 unsigned int get_index();
391 Channel(struct sr_channel *structure);
393 const ChannelType * const type;
395 friend class ChannelGroup;
396 friend class Session;
397 friend class TriggerStage;
400 /** A group of channels on a device, which share some configuration */
401 class SR_API ChannelGroup :
402 public StructureWrapper<Device, struct sr_channel_group>,
406 /** Name of this channel group. */
408 /** List of the channels in this group. */
409 vector<shared_ptr<Channel> > get_channels();
411 ChannelGroup(Device *device, struct sr_channel_group *structure);
413 vector<Channel *> channels;
417 /** A trigger configuration */
418 class SR_API Trigger : public enable_shared_from_this<Trigger>
421 /** Name of this trigger configuration. */
423 /** List of the stages in this trigger. */
424 vector<shared_ptr<TriggerStage> > get_stages();
425 /** Add a new stage to this trigger. */
426 shared_ptr<TriggerStage> add_stage();
428 Trigger(shared_ptr<Context> context, string name);
430 struct sr_trigger *structure;
431 shared_ptr<Context> context;
432 vector<TriggerStage *> stages;
433 /** Deleter needed to allow shared_ptr use with protected destructor. */
437 void operator()(Trigger *trigger) { delete trigger; }
439 friend class Context;
440 friend class Session;
443 /** A stage in a trigger configuration */
444 class SR_API TriggerStage : public StructureWrapper<Trigger, struct sr_trigger_stage>
447 /** Index number of this stage. */
449 /** List of match conditions on this stage. */
450 vector<shared_ptr<TriggerMatch> > get_matches();
451 /** Add a new match condition to this stage.
452 * @param channel Channel to match on.
453 * @param type TriggerMatchType to apply. */
454 void add_match(shared_ptr<Channel> channel, const TriggerMatchType *type);
455 /** Add a new match condition to this stage.
456 * @param channel Channel to match on.
457 * @param type TriggerMatchType to apply.
458 * @param value Threshold value. */
459 void add_match(shared_ptr<Channel> channel, const TriggerMatchType *type, float value);
461 vector<TriggerMatch *> matches;
462 TriggerStage(struct sr_trigger_stage *structure);
464 friend class Trigger;
467 /** A match condition in a trigger configuration */
468 class SR_API TriggerMatch : public StructureWrapper<TriggerStage, struct sr_trigger_match>
471 /** Channel this condition matches on. */
472 shared_ptr<Channel> get_channel();
473 /** Type of match. */
474 const TriggerMatchType *get_type();
475 /** Threshold value. */
478 TriggerMatch(struct sr_trigger_match *structure, shared_ptr<Channel> channel);
480 shared_ptr<Channel> channel;
481 friend class TriggerStage;
484 /** Type of datafeed callback */
485 typedef function<void(shared_ptr<Device>, shared_ptr<Packet>)>
486 DatafeedCallbackFunction;
488 /* Data required for C callback function to call a C++ datafeed callback */
489 class SR_PRIV DatafeedCallbackData
492 void run(const struct sr_dev_inst *sdi,
493 const struct sr_datafeed_packet *pkt);
495 DatafeedCallbackFunction callback;
496 DatafeedCallbackData(Session *session,
497 DatafeedCallbackFunction callback);
499 friend class Session;
502 /** Type of source callback */
503 typedef function<bool(Glib::IOCondition)>
504 SourceCallbackFunction;
506 /* Data required for C callback function to call a C++ source callback */
507 class SR_PRIV SourceCallbackData
510 bool run(int revents);
512 SourceCallbackData(shared_ptr<EventSource> source);
513 shared_ptr<EventSource> source;
514 friend class Session;
517 /** An I/O event source */
518 class SR_API EventSource
521 /** Create an event source from a file descriptor.
522 * @param fd File descriptor.
523 * @param events GLib IOCondition event mask.
524 * @param timeout Timeout in milliseconds.
525 * @param callback Callback of the form callback(events) */
526 static shared_ptr<EventSource> create(int fd, Glib::IOCondition events,
527 int timeout, SourceCallbackFunction callback);
528 /** Create an event source from a GLib PollFD
529 * @param pollfd GLib PollFD
530 * @param timeout Timeout in milliseconds.
531 * @param callback Callback of the form callback(events) */
532 static shared_ptr<EventSource> create(Glib::PollFD pollfd, int timeout,
533 SourceCallbackFunction callback);
534 /** Create an event source from a GLib IOChannel
535 * @param channel GLib IOChannel.
536 * @param events GLib IOCondition event mask.
537 * @param timeout Timeout in milliseconds.
538 * @param callback Callback of the form callback(events) */
539 static shared_ptr<EventSource> create(
540 Glib::RefPtr<Glib::IOChannel> channel, Glib::IOCondition events,
541 int timeout, SourceCallbackFunction callback);
543 EventSource(int timeout, SourceCallbackFunction callback);
552 Glib::RefPtr<Glib::IOChannel> channel;
553 Glib::IOCondition events;
555 SourceCallbackFunction callback;
556 /** Deleter needed to allow shared_ptr use with protected destructor. */
560 void operator()(EventSource *source) { delete source; }
562 friend class Deleter;
563 friend class Session;
564 friend class SourceCallbackData;
567 /** A sigrok session */
571 /** Add a device to this session.
572 * @param device Device to add. */
573 void add_device(shared_ptr<Device> device);
574 /** List devices attached to this session. */
575 vector<shared_ptr<Device> > get_devices();
576 /** Remove all devices from this session. */
577 void remove_devices();
578 /** Add a datafeed callback to this session.
579 * @param callback Callback of the form callback(Device, Packet). */
580 void add_datafeed_callback(DatafeedCallbackFunction callback);
581 /** Remove all datafeed callbacks from this session. */
582 void remove_datafeed_callbacks();
583 /** Add an I/O event source.
584 * @param source EventSource to add. */
585 void add_source(shared_ptr<EventSource> source);
586 /** Remove an event source.
587 * @param source EventSource to remove. */
588 void remove_source(shared_ptr<EventSource> source);
589 /** Start the session. */
591 /** Run the session event loop. */
593 /** Stop the session. */
595 /** Begin saving session to a file.
596 * @param filename File name string. */
597 void begin_save(string filename);
598 /** Append a packet to the session file being saved.
599 * @param packet Packet to append. */
600 void append(shared_ptr<Packet> packet);
601 /** Append raw logic data to the session file being saved. */
602 void append(void *data, size_t length, unsigned int unit_size);
603 /** Get current trigger setting. */
604 shared_ptr<Trigger> get_trigger();
605 /** Set trigger setting.
606 * @param trigger Trigger object to use. */
607 void set_trigger(shared_ptr<Trigger> trigger);
609 Session(shared_ptr<Context> context);
610 Session(shared_ptr<Context> context, string filename);
612 struct sr_session *structure;
613 const shared_ptr<Context> context;
614 map<const struct sr_dev_inst *, shared_ptr<Device> > devices;
615 vector<DatafeedCallbackData *> datafeed_callbacks;
616 map<shared_ptr<EventSource>, SourceCallbackData *> source_callbacks;
618 bool save_initialized;
619 string save_filename;
620 uint64_t save_samplerate;
621 shared_ptr<Trigger> trigger;
622 /** Deleter needed to allow shared_ptr use with protected destructor. */
626 void operator()(Session *session) { delete session; }
628 friend class Deleter;
629 friend class Context;
630 friend class DatafeedCallbackData;
633 /** A packet on the session datafeed */
634 class SR_API Packet : public enable_shared_from_this<Packet>
637 /** Type of this packet. */
638 const PacketType *get_type();
639 /** Payload of this packet. */
640 shared_ptr<PacketPayload> get_payload();
642 Packet(shared_ptr<Device> device,
643 const struct sr_datafeed_packet *structure);
645 const struct sr_datafeed_packet *structure;
646 shared_ptr<Device> device;
647 PacketPayload *payload;
648 /** Deleter needed to allow shared_ptr use with protected destructor. */
652 void operator()(Packet *packet) { delete packet; }
654 friend class Deleter;
655 friend class Session;
657 friend class DatafeedCallbackData;
664 /** Abstract base class for datafeed packet payloads */
665 class SR_API PacketPayload
669 virtual ~PacketPayload() = 0;
670 virtual shared_ptr<PacketPayload> get_shared_pointer(Packet *parent) = 0;
671 /** Deleter needed to allow shared_ptr use with protected destructor. */
675 void operator()(PacketPayload *payload) { delete payload; }
677 friend class Deleter;
682 /** Payload of a datafeed header packet */
683 class SR_API Header :
684 public StructureWrapper<Packet, const struct sr_datafeed_header>,
688 /* Feed version number. */
689 int get_feed_version();
690 /* Start time of this session. */
691 Glib::TimeVal get_start_time();
693 Header(const struct sr_datafeed_header *structure);
695 shared_ptr<PacketPayload> get_shared_pointer(Packet *parent);
699 /** Payload of a datafeed metadata packet */
701 public StructureWrapper<Packet, const struct sr_datafeed_meta>,
705 /* Mapping of (ConfigKey, value) pairs. */
706 map<const ConfigKey *, Glib::VariantBase> get_config();
708 Meta(const struct sr_datafeed_meta *structure);
710 shared_ptr<PacketPayload> get_shared_pointer(Packet *parent);
711 map<const ConfigKey *, Glib::VariantBase> config;
715 /** Payload of a datafeed packet with logic data */
717 public StructureWrapper<Packet, const struct sr_datafeed_logic>,
721 /* Pointer to data. */
722 void *get_data_pointer();
723 /* Data length in bytes. */
724 size_t get_data_length();
725 /* Size of each sample in bytes. */
726 unsigned int get_unit_size();
728 Logic(const struct sr_datafeed_logic *structure);
730 shared_ptr<PacketPayload> get_shared_pointer(Packet *parent);
734 /** Payload of a datafeed packet with analog data */
735 class SR_API Analog :
736 public StructureWrapper<Packet, const struct sr_datafeed_analog>,
740 /** Pointer to data. */
741 float *get_data_pointer();
742 /** Number of samples in this packet. */
743 unsigned int get_num_samples();
744 /** Channels for which this packet contains data. */
745 vector<shared_ptr<Channel> > get_channels();
746 /** Measured quantity of the samples in this packet. */
747 const Quantity *get_mq();
748 /** Unit of the samples in this packet. */
749 const Unit *get_unit();
750 /** Measurement flags associated with the samples in this packet. */
751 vector<const QuantityFlag *> get_mq_flags();
753 Analog(const struct sr_datafeed_analog *structure);
755 shared_ptr<PacketPayload> get_shared_pointer(Packet *parent);
759 /** An input format supported by the library */
760 class SR_API InputFormat :
761 public StructureWrapper<Context, const struct sr_input_module>
764 /** Name of this input format. */
766 /** Description of this input format. */
767 string get_description();
768 /** Options supported by this input format. */
769 map<string, shared_ptr<Option> > get_options();
770 /** Create an input using this input format.
771 * @param options Mapping of (option name, value) pairs. */
772 shared_ptr<Input> create_input(map<string, Glib::VariantBase> options = {});
774 InputFormat(const struct sr_input_module *structure);
776 friend class Context;
777 friend class InputDevice;
780 /** An input instance (an input format applied to a file or stream) */
781 class SR_API Input : public enable_shared_from_this<Input>
784 /** Virtual device associated with this input. */
785 shared_ptr<InputDevice> get_device();
786 /** Send next stream data.
787 * @param data Next stream data. */
788 void send(string data);
790 Input(shared_ptr<Context> context, const struct sr_input *structure);
792 const struct sr_input *structure;
793 shared_ptr<Context> context;
795 /** Deleter needed to allow shared_ptr use with protected destructor. */
799 void operator()(Input *input) { delete input; }
801 friend class Deleter;
802 friend class Context;
803 friend class InputFormat;
806 /** A virtual device associated with an input */
807 class SR_API InputDevice :
808 public StructureWrapper<Input, struct sr_dev_inst>,
812 InputDevice(shared_ptr<Input> input, struct sr_dev_inst *sdi);
814 shared_ptr<Device> get_shared_from_this();
815 shared_ptr<Input> input;
816 /** Deleter needed to allow shared_ptr use with protected destructor. */
820 void operator()(InputDevice *device) { delete device; }
822 friend class Deleter;
826 /** An option used by an output format */
830 /** Short name of this option suitable for command line usage. */
832 /** Short name of this option suitable for GUI usage. */
834 /** Description of this option in a sentence. */
835 string get_description();
836 /** Default value for this option. */
837 Glib::VariantBase get_default_value();
838 /** Possible values for this option, if a limited set. */
839 vector<Glib::VariantBase> get_values();
841 Option(const struct sr_option *structure,
842 shared_ptr<const struct sr_option *> structure_array);
844 const struct sr_option *structure;
845 shared_ptr<const struct sr_option *> structure_array;
846 /** Deleter needed to allow shared_ptr use with protected destructor. */
850 void operator()(Option *option) { delete option; }
852 friend class Deleter;
853 friend class InputFormat;
854 friend class OutputFormat;
857 /** An output format supported by the library */
858 class SR_API OutputFormat :
859 public StructureWrapper<Context, const struct sr_output_module>
862 /** Name of this output format. */
864 /** Description of this output format. */
865 string get_description();
866 /** Options supported by this output format. */
867 map<string, shared_ptr<Option> > get_options();
868 /** Create an output using this format.
869 * @param device Device to output for.
870 * @param options Mapping of (option name, value) pairs. */
871 shared_ptr<Output> create_output(shared_ptr<Device> device,
872 map<string, Glib::VariantBase> options = {});
874 OutputFormat(const struct sr_output_module *structure);
876 friend class Context;
880 /** An output instance (an output format applied to a device) */
884 /** Update output with data from the given packet.
885 * @param packet Packet to handle. */
886 string receive(shared_ptr<Packet> packet);
888 Output(shared_ptr<OutputFormat> format, shared_ptr<Device> device);
889 Output(shared_ptr<OutputFormat> format,
890 shared_ptr<Device> device, map<string, Glib::VariantBase> options);
892 const struct sr_output *structure;
893 const shared_ptr<OutputFormat> format;
894 const shared_ptr<Device> device;
895 const map<string, Glib::VariantBase> options;
896 /** Deleter needed to allow shared_ptr use with protected destructor. */
900 void operator()(Output *output) { delete output; }
902 friend class Deleter;
903 friend class OutputFormat;
906 /** Base class for objects which wrap an enumeration value from libsigrok */
907 template <typename T> class SR_API EnumValue
910 /** The enum constant associated with this value. */
911 T get_id() const { return id; }
912 /** The name associated with this value. */
913 string get_name() const { return name; }
915 EnumValue(T id, const char name[]) : id(id), name(name) {}
925 #endif // LIBSIGROK_HPP