C++: Make Driver inherit Configurable.

This commit is contained in:
Martin Ling 2014-09-06 13:08:29 +01:00 committed by Uwe Hermann
parent 4f7bcf0ec3
commit 59b74d28c9
2 changed files with 25 additions and 23 deletions

View File

@ -248,6 +248,7 @@ shared_ptr<Input> Context::open_stream(string header)
Driver::Driver(struct sr_dev_driver *structure) :
ParentOwned(structure),
Configurable(structure, NULL, NULL),
initialized(false)
{
}

View File

@ -281,29 +281,6 @@ protected:
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
{
@ -329,6 +306,30 @@ protected:
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
{