C++: Rename StructureWrapper to ParentOwned.

This commit is contained in:
Martin Ling 2014-09-02 20:38:44 +01:00 committed by Bert Vermeulen
parent bf52cc8cf2
commit 541c855e1d
2 changed files with 29 additions and 29 deletions

View File

@ -245,7 +245,7 @@ shared_ptr<Input> Context::open_stream(string header)
} }
Driver::Driver(struct sr_dev_driver *structure) : Driver::Driver(struct sr_dev_driver *structure) :
StructureWrapper(structure), ParentOwned(structure),
initialized(false) initialized(false)
{ {
} }
@ -446,7 +446,7 @@ void Device::close()
} }
HardwareDevice::HardwareDevice(Driver *driver, struct sr_dev_inst *structure) : HardwareDevice::HardwareDevice(Driver *driver, struct sr_dev_inst *structure) :
StructureWrapper(structure), ParentOwned(structure),
Device(structure), Device(structure),
driver(driver) driver(driver)
{ {
@ -467,7 +467,7 @@ shared_ptr<Driver> HardwareDevice::get_driver()
} }
Channel::Channel(struct sr_channel *structure) : Channel::Channel(struct sr_channel *structure) :
StructureWrapper(structure), ParentOwned(structure),
type(ChannelType::get(structure->type)) type(ChannelType::get(structure->type))
{ {
} }
@ -508,7 +508,7 @@ unsigned int Channel::get_index()
ChannelGroup::ChannelGroup(Device *device, ChannelGroup::ChannelGroup(Device *device,
struct sr_channel_group *structure) : struct sr_channel_group *structure) :
StructureWrapper(structure), ParentOwned(structure),
Configurable(device->structure->driver, device->structure, structure) Configurable(device->structure->driver, device->structure, structure)
{ {
for (GSList *entry = structure->channels; entry; entry = entry->next) for (GSList *entry = structure->channels; entry; entry = entry->next)
@ -568,7 +568,7 @@ shared_ptr<TriggerStage> Trigger::add_stage()
} }
TriggerStage::TriggerStage(struct sr_trigger_stage *structure) : TriggerStage::TriggerStage(struct sr_trigger_stage *structure) :
StructureWrapper(structure) ParentOwned(structure)
{ {
} }
@ -604,7 +604,7 @@ void TriggerStage::add_match(shared_ptr<Channel> channel, const TriggerMatchType
} }
TriggerMatch::TriggerMatch(struct sr_trigger_match *structure, shared_ptr<Channel> channel) : TriggerMatch::TriggerMatch(struct sr_trigger_match *structure, shared_ptr<Channel> channel) :
StructureWrapper(structure), channel(channel) ParentOwned(structure), channel(channel)
{ {
} }
@ -995,7 +995,7 @@ PacketPayload::~PacketPayload()
} }
Header::Header(const struct sr_datafeed_header *structure) : Header::Header(const struct sr_datafeed_header *structure) :
StructureWrapper(structure), ParentOwned(structure),
PacketPayload() PacketPayload()
{ {
} }
@ -1022,7 +1022,7 @@ Glib::TimeVal Header::get_start_time()
} }
Meta::Meta(const struct sr_datafeed_meta *structure) : Meta::Meta(const struct sr_datafeed_meta *structure) :
StructureWrapper(structure), ParentOwned(structure),
PacketPayload() PacketPayload()
{ {
} }
@ -1048,7 +1048,7 @@ map<const ConfigKey *, Glib::VariantBase> Meta::get_config()
} }
Logic::Logic(const struct sr_datafeed_logic *structure) : Logic::Logic(const struct sr_datafeed_logic *structure) :
StructureWrapper(structure), ParentOwned(structure),
PacketPayload() PacketPayload()
{ {
} }
@ -1078,7 +1078,7 @@ unsigned int Logic::get_unit_size()
} }
Analog::Analog(const struct sr_datafeed_analog *structure) : Analog::Analog(const struct sr_datafeed_analog *structure) :
StructureWrapper(structure), ParentOwned(structure),
PacketPayload() PacketPayload()
{ {
} }
@ -1127,7 +1127,7 @@ vector<const QuantityFlag *> Analog::get_mq_flags()
} }
InputFormat::InputFormat(const struct sr_input_module *structure) : InputFormat::InputFormat(const struct sr_input_module *structure) :
StructureWrapper(structure) ParentOwned(structure)
{ {
} }
@ -1204,7 +1204,7 @@ Input::~Input()
InputDevice::InputDevice(shared_ptr<Input> input, InputDevice::InputDevice(shared_ptr<Input> input,
struct sr_dev_inst *structure) : struct sr_dev_inst *structure) :
StructureWrapper(structure), ParentOwned(structure),
Device(structure), Device(structure),
input(input) input(input)
{ {
@ -1259,7 +1259,7 @@ vector<Glib::VariantBase> Option::get_values()
} }
OutputFormat::OutputFormat(const struct sr_output_module *structure) : OutputFormat::OutputFormat(const struct sr_output_module *structure) :
StructureWrapper(structure) ParentOwned(structure)
{ {
} }

View File

@ -124,9 +124,9 @@ public:
const char *what() const throw(); 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> template <class Class, class Parent, typename Struct>
class SR_API StructureWrapper class SR_API ParentOwned
{ {
protected: protected:
/* Parent object which owns this child object's underlying structure. /* Parent object which owns this child object's underlying structure.
@ -186,7 +186,7 @@ protected:
Struct *structure; Struct *structure;
StructureWrapper<Class, Parent, Struct>(Struct *structure) : ParentOwned<Class, Parent, Struct>(Struct *structure) :
structure(structure) structure(structure)
{ {
} }
@ -262,7 +262,7 @@ protected:
/** A hardware driver provided by the library */ /** A hardware driver provided by the library */
class SR_API Driver : class SR_API Driver :
public StructureWrapper<Driver, Context, struct sr_dev_driver> public ParentOwned<Driver, Context, struct sr_dev_driver>
{ {
public: public:
/** Name of this driver. */ /** Name of this driver. */
@ -352,7 +352,7 @@ protected:
/** A real hardware device, connected via a driver */ /** A real hardware device, connected via a driver */
class SR_API HardwareDevice : class SR_API HardwareDevice :
public StructureWrapper<HardwareDevice, Context, struct sr_dev_inst>, public ParentOwned<HardwareDevice, Context, struct sr_dev_inst>,
public Device public Device
{ {
public: public:
@ -369,7 +369,7 @@ protected:
/** A channel on a device */ /** A channel on a device */
class SR_API Channel : class SR_API Channel :
public StructureWrapper<Channel, Device, struct sr_channel> public ParentOwned<Channel, Device, struct sr_channel>
{ {
public: public:
/** Current name of this channel. */ /** Current name of this channel. */
@ -398,7 +398,7 @@ protected:
/** A group of channels on a device, which share some configuration */ /** A group of channels on a device, which share some configuration */
class SR_API ChannelGroup : class SR_API ChannelGroup :
public StructureWrapper<ChannelGroup, Device, struct sr_channel_group>, public ParentOwned<ChannelGroup, Device, struct sr_channel_group>,
public Configurable public Configurable
{ {
public: public:
@ -441,7 +441,7 @@ protected:
/** A stage in a trigger configuration */ /** A stage in a trigger configuration */
class SR_API TriggerStage : class SR_API TriggerStage :
public StructureWrapper<TriggerStage, Trigger, struct sr_trigger_stage> public ParentOwned<TriggerStage, Trigger, struct sr_trigger_stage>
{ {
public: public:
/** Index number of this stage. */ /** Index number of this stage. */
@ -466,7 +466,7 @@ protected:
/** A match condition in a trigger configuration */ /** A match condition in a trigger configuration */
class SR_API TriggerMatch : class SR_API TriggerMatch :
public StructureWrapper<TriggerMatch, TriggerStage, struct sr_trigger_match> public ParentOwned<TriggerMatch, TriggerStage, struct sr_trigger_match>
{ {
public: public:
/** Channel this condition matches on. */ /** Channel this condition matches on. */
@ -682,7 +682,7 @@ protected:
/** Payload of a datafeed header packet */ /** Payload of a datafeed header packet */
class SR_API Header : 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 PacketPayload
{ {
public: public:
@ -699,7 +699,7 @@ protected:
/** Payload of a datafeed metadata packet */ /** Payload of a datafeed metadata packet */
class SR_API Meta : 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 PacketPayload
{ {
public: public:
@ -715,7 +715,7 @@ protected:
/** Payload of a datafeed packet with logic data */ /** Payload of a datafeed packet with logic data */
class SR_API Logic : 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 PacketPayload
{ {
public: public:
@ -734,7 +734,7 @@ protected:
/** Payload of a datafeed packet with analog data */ /** Payload of a datafeed packet with analog data */
class SR_API Analog : 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 PacketPayload
{ {
public: public:
@ -759,7 +759,7 @@ protected:
/** An input format supported by the library */ /** An input format supported by the library */
class SR_API InputFormat : class SR_API InputFormat :
public StructureWrapper<InputFormat, Context, const struct sr_input_module> public ParentOwned<InputFormat, Context, const struct sr_input_module>
{ {
public: public:
/** Name of this input format. */ /** Name of this input format. */
@ -806,7 +806,7 @@ protected:
/** A virtual device associated with an input */ /** A virtual device associated with an input */
class SR_API InputDevice : class SR_API InputDevice :
public StructureWrapper<InputDevice, Input, struct sr_dev_inst>, public ParentOwned<InputDevice, Input, struct sr_dev_inst>,
public Device public Device
{ {
protected: protected:
@ -857,7 +857,7 @@ protected:
/** An output format supported by the library */ /** An output format supported by the library */
class SR_API OutputFormat : class SR_API OutputFormat :
public StructureWrapper<OutputFormat, Context, const struct sr_output_module> public ParentOwned<OutputFormat, Context, const struct sr_output_module>
{ {
public: public:
/** Name of this output format. */ /** Name of this output format. */