}
Driver::Driver(struct sr_dev_driver *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
initialized(false)
{
}
}
HardwareDevice::HardwareDevice(Driver *driver, struct sr_dev_inst *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
Device(structure),
driver(driver)
{
}
Channel::Channel(struct sr_channel *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
type(ChannelType::get(structure->type))
{
}
ChannelGroup::ChannelGroup(Device *device,
struct sr_channel_group *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
Configurable(device->structure->driver, device->structure, structure)
{
for (GSList *entry = structure->channels; entry; entry = entry->next)
}
TriggerStage::TriggerStage(struct sr_trigger_stage *structure) :
- StructureWrapper(structure)
+ ParentOwned(structure)
{
}
}
TriggerMatch::TriggerMatch(struct sr_trigger_match *structure, shared_ptr<Channel> channel) :
- StructureWrapper(structure), channel(channel)
+ ParentOwned(structure), channel(channel)
{
}
}
Header::Header(const struct sr_datafeed_header *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
PacketPayload()
{
}
}
Meta::Meta(const struct sr_datafeed_meta *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
PacketPayload()
{
}
}
Logic::Logic(const struct sr_datafeed_logic *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
PacketPayload()
{
}
}
Analog::Analog(const struct sr_datafeed_analog *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
PacketPayload()
{
}
}
InputFormat::InputFormat(const struct sr_input_module *structure) :
- StructureWrapper(structure)
+ ParentOwned(structure)
{
}
InputDevice::InputDevice(shared_ptr<Input> input,
struct sr_dev_inst *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
Device(structure),
input(input)
{
}
OutputFormat::OutputFormat(const struct sr_output_module *structure) :
- StructureWrapper(structure)
+ ParentOwned(structure)
{
}
const char *what() const throw();
};
-/* Base template for most classes which wrap a struct type from libsigrok. */
+/* Base template for classes whose resources are owned by a parent object. */
template <class Class, class Parent, typename Struct>
-class SR_API StructureWrapper
+class SR_API ParentOwned
{
protected:
/* Parent object which owns this child object's underlying structure.
Struct *structure;
- StructureWrapper<Class, Parent, Struct>(Struct *structure) :
+ ParentOwned<Class, Parent, Struct>(Struct *structure) :
structure(structure)
{
}
/** A hardware driver provided by the library */
class SR_API Driver :
- public StructureWrapper<Driver, Context, struct sr_dev_driver>
+ public ParentOwned<Driver, Context, struct sr_dev_driver>
{
public:
/** Name of this driver. */
/** A real hardware device, connected via a driver */
class SR_API HardwareDevice :
- public StructureWrapper<HardwareDevice, Context, struct sr_dev_inst>,
+ public ParentOwned<HardwareDevice, Context, struct sr_dev_inst>,
public Device
{
public:
/** A channel on a device */
class SR_API Channel :
- public StructureWrapper<Channel, Device, struct sr_channel>
+ public ParentOwned<Channel, Device, struct sr_channel>
{
public:
/** Current name of this channel. */
/** A group of channels on a device, which share some configuration */
class SR_API ChannelGroup :
- public StructureWrapper<ChannelGroup, Device, struct sr_channel_group>,
+ public ParentOwned<ChannelGroup, Device, struct sr_channel_group>,
public Configurable
{
public:
/** A stage in a trigger configuration */
class SR_API TriggerStage :
- public StructureWrapper<TriggerStage, Trigger, struct sr_trigger_stage>
+ public ParentOwned<TriggerStage, Trigger, struct sr_trigger_stage>
{
public:
/** Index number of this stage. */
/** A match condition in a trigger configuration */
class SR_API TriggerMatch :
- public StructureWrapper<TriggerMatch, TriggerStage, struct sr_trigger_match>
+ public ParentOwned<TriggerMatch, TriggerStage, struct sr_trigger_match>
{
public:
/** Channel this condition matches on. */
/** Payload of a datafeed header packet */
class SR_API Header :
- public StructureWrapper<Header, Packet, const struct sr_datafeed_header>,
+ public ParentOwned<Header, Packet, const struct sr_datafeed_header>,
public PacketPayload
{
public:
/** Payload of a datafeed metadata packet */
class SR_API Meta :
- public StructureWrapper<Meta, Packet, const struct sr_datafeed_meta>,
+ public ParentOwned<Meta, Packet, const struct sr_datafeed_meta>,
public PacketPayload
{
public:
/** Payload of a datafeed packet with logic data */
class SR_API Logic :
- public StructureWrapper<Logic, Packet, const struct sr_datafeed_logic>,
+ public ParentOwned<Logic, Packet, const struct sr_datafeed_logic>,
public PacketPayload
{
public:
/** Payload of a datafeed packet with analog data */
class SR_API Analog :
- public StructureWrapper<Analog, Packet, const struct sr_datafeed_analog>,
+ public ParentOwned<Analog, Packet, const struct sr_datafeed_analog>,
public PacketPayload
{
public:
/** An input format supported by the library */
class SR_API InputFormat :
- public StructureWrapper<InputFormat, Context, const struct sr_input_module>
+ public ParentOwned<InputFormat, Context, const struct sr_input_module>
{
public:
/** Name of this input format. */
/** A virtual device associated with an input */
class SR_API InputDevice :
- public StructureWrapper<InputDevice, Input, struct sr_dev_inst>,
+ public ParentOwned<InputDevice, Input, struct sr_dev_inst>,
public Device
{
protected:
/** An output format supported by the library */
class SR_API OutputFormat :
- public StructureWrapper<OutputFormat, Context, const struct sr_output_module>
+ public ParentOwned<OutputFormat, Context, const struct sr_output_module>
{
public:
/** Name of this output format. */