structure(structure)
{
}
+
+ /* Deleter needed to allow shared_ptr use with protected destructor. */
+ class Deleter
+ {
+ public:
+ void operator()(Class *object) { delete object; }
+ };
};
/** Type of log callback */
LogCallbackFunction log_callback;
Context();
~Context();
- /** Deleter needed to allow shared_ptr use with protected destructor. */
- class Deleter
- {
- public:
- void operator()(Context *context) { delete context; }
- };
friend class Deleter;
friend class Session;
friend class Driver;
};
-/** A hardware driver provided by the library */
-class SR_API Driver :
- public ParentOwned<Driver, Context, struct sr_dev_driver>
-{
-public:
- /** Name of this driver. */
- string get_name();
- /** Long name for this driver. */
- string get_long_name();
- /** Scan for devices and return a list of devices found.
- * @param options Mapping of (ConfigKey, value) pairs. */
- vector<shared_ptr<HardwareDevice> > scan(
- map<const ConfigKey *, Glib::VariantBase> options = {});
-protected:
- bool initialized;
- vector<HardwareDevice *> devices;
- Driver(struct sr_dev_driver *structure);
- ~Driver();
- friend class Context;
- friend class HardwareDevice;
- friend class ChannelGroup;
-};
-
/** An object that can be configured. */
class SR_API Configurable
{
/** Enumerate available values for the given configuration key.
* @param key ConfigKey to enumerate values for. */
Glib::VariantContainerBase config_list(const ConfigKey *key);
+ /** Enumerate available keys, according to a given index key. */
+ vector<const ConfigKey *> config_keys(const ConfigKey *key);
protected:
Configurable(
struct sr_dev_driver *driver,
struct sr_channel_group *config_channel_group;
};
+/** A hardware driver provided by the library */
+class SR_API Driver :
+ public ParentOwned<Driver, Context, struct sr_dev_driver>,
+ public Configurable
+{
+public:
+ /** Name of this driver. */
+ string get_name();
+ /** Long name for this driver. */
+ string get_long_name();
+ /** Scan for devices and return a list of devices found.
+ * @param options Mapping of (ConfigKey, value) pairs. */
+ vector<shared_ptr<HardwareDevice> > scan(
+ map<const ConfigKey *, Glib::VariantBase> options = {});
+protected:
+ bool initialized;
+ vector<HardwareDevice *> devices;
+ Driver(struct sr_dev_driver *structure);
+ ~Driver();
+ friend class Context;
+ friend class HardwareDevice;
+ friend class ChannelGroup;
+};
+
/** A generic device, either hardware or virtual */
class SR_API Device : public Configurable
{
~Trigger();
shared_ptr<Context> context;
vector<TriggerStage *> stages;
- /** Deleter needed to allow shared_ptr use with protected destructor. */
- class Deleter
- {
- public:
- void operator()(Trigger *trigger) { delete trigger; }
- };
+ friend class Deleter;
friend class Context;
friend class Session;
};
string save_filename;
uint64_t save_samplerate;
shared_ptr<Trigger> trigger;
- /** Deleter needed to allow shared_ptr use with protected destructor. */
- class Deleter
- {
- public:
- void operator()(Session *session) { delete session; }
- };
friend class Deleter;
friend class Context;
friend class DatafeedCallbackData;
~Packet();
shared_ptr<Device> device;
PacketPayload *payload;
- /** Deleter needed to allow shared_ptr use with protected destructor. */
- class Deleter
- {
- public:
- void operator()(Packet *packet) { delete packet; }
- };
friend class Deleter;
friend class Session;
friend class Output;
~Input();
shared_ptr<Context> context;
InputDevice *device;
- /** Deleter needed to allow shared_ptr use with protected destructor. */
- class Deleter
- {
- public:
- void operator()(Input *input) { delete input; }
- };
friend class Deleter;
friend class Context;
friend class InputFormat;
~InputDevice();
shared_ptr<Device> get_shared_from_this();
shared_ptr<Input> input;
- /** Deleter needed to allow shared_ptr use with protected destructor. */
- class Deleter
- {
- public:
- void operator()(InputDevice *device) { delete device; }
- };
- friend class Deleter;
friend class Input;
};
shared_ptr<const struct sr_option *> structure_array);
~Option();
shared_ptr<const struct sr_option *> 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 InputFormat;
friend class OutputFormat;
const shared_ptr<OutputFormat> format;
const shared_ptr<Device> device;
const map<string, Glib::VariantBase> options;
- /** Deleter needed to allow shared_ptr use with protected destructor. */
- class Deleter
- {
- public:
- void operator()(Output *output) { delete output; }
- };
friend class Deleter;
friend class OutputFormat;
};