};
/** A generic device, either hardware or virtual */
-class SR_API Device :
- public Configurable,
- public StructureWrapper<Context, struct sr_dev_inst>
+class SR_API Device : public Configurable
{
public:
/** Description identifying this device. */
protected:
Device(struct sr_dev_inst *structure);
~Device();
+ virtual shared_ptr<Device> get_shared_from_this() = 0;
shared_ptr<Channel> get_channel(struct sr_channel *ptr);
+ struct sr_dev_inst *structure;
map<struct sr_channel *, Channel *> channels;
map<string, ChannelGroup *> channel_groups;
/** Deleter needed to allow shared_ptr use with protected destructor. */
};
/** A real hardware device, connected via a driver */
-class SR_API HardwareDevice : public Device
+class SR_API HardwareDevice :
+ public StructureWrapper<Context, struct sr_dev_inst>,
+ public Device
{
public:
/** Driver providing this device. */
protected:
HardwareDevice(Driver *driver, struct sr_dev_inst *structure);
~HardwareDevice();
+ shared_ptr<Device> get_shared_from_this();
Driver *driver;
friend class Driver;
friend class ChannelGroup;
protected:
Input(shared_ptr<Context> context, const struct sr_input *structure);
~Input();
+ shared_ptr<Device> get_shared_from_this();
const struct sr_input *structure;
shared_ptr<Context> context;
InputDevice *device;
};
/** A virtual device associated with an input */
-class SR_API InputDevice : public Device
+class SR_API InputDevice :
+ public StructureWrapper<Input, struct sr_dev_inst>,
+ public Device
{
protected:
InputDevice(shared_ptr<Input> input, struct sr_dev_inst *sdi);
~InputDevice();
+ shared_ptr<Device> get_shared_from_this();
shared_ptr<Input> input;
/** Deleter needed to allow shared_ptr use with protected destructor. */
class Deleter
void operator()(Option *option) { delete option; }
};
friend class Deleter;
+ friend class InputFormat;
friend class OutputFormat;
};