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) :
StructureWrapper(structure),
ParentOwned(structure),
initialized(false)
{
}
@ -446,7 +446,7 @@ void Device::close()
}
HardwareDevice::HardwareDevice(Driver *driver, struct sr_dev_inst *structure) :
StructureWrapper(structure),
ParentOwned(structure),
Device(structure),
driver(driver)
{
@ -467,7 +467,7 @@ shared_ptr<Driver> HardwareDevice::get_driver()
}
Channel::Channel(struct sr_channel *structure) :
StructureWrapper(structure),
ParentOwned(structure),
type(ChannelType::get(structure->type))
{
}
@ -508,7 +508,7 @@ unsigned int Channel::get_index()
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)
@ -568,7 +568,7 @@ shared_ptr<TriggerStage> Trigger::add_stage()
}
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) :
StructureWrapper(structure), channel(channel)
ParentOwned(structure), channel(channel)
{
}
@ -995,7 +995,7 @@ PacketPayload::~PacketPayload()
}
Header::Header(const struct sr_datafeed_header *structure) :
StructureWrapper(structure),
ParentOwned(structure),
PacketPayload()
{
}
@ -1022,7 +1022,7 @@ Glib::TimeVal Header::get_start_time()
}
Meta::Meta(const struct sr_datafeed_meta *structure) :
StructureWrapper(structure),
ParentOwned(structure),
PacketPayload()
{
}
@ -1048,7 +1048,7 @@ map<const ConfigKey *, Glib::VariantBase> Meta::get_config()
}
Logic::Logic(const struct sr_datafeed_logic *structure) :
StructureWrapper(structure),
ParentOwned(structure),
PacketPayload()
{
}
@ -1078,7 +1078,7 @@ unsigned int Logic::get_unit_size()
}
Analog::Analog(const struct sr_datafeed_analog *structure) :
StructureWrapper(structure),
ParentOwned(structure),
PacketPayload()
{
}
@ -1127,7 +1127,7 @@ vector<const QuantityFlag *> Analog::get_mq_flags()
}
InputFormat::InputFormat(const struct sr_input_module *structure) :
StructureWrapper(structure)
ParentOwned(structure)
{
}
@ -1204,7 +1204,7 @@ Input::~Input()
InputDevice::InputDevice(shared_ptr<Input> input,
struct sr_dev_inst *structure) :
StructureWrapper(structure),
ParentOwned(structure),
Device(structure),
input(input)
{
@ -1259,7 +1259,7 @@ vector<Glib::VariantBase> Option::get_values()
}
OutputFormat::OutputFormat(const struct sr_output_module *structure) :
StructureWrapper(structure)
ParentOwned(structure)
{
}

View File

@ -124,9 +124,9 @@ public:
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.
@ -186,7 +186,7 @@ protected:
Struct *structure;
StructureWrapper<Class, Parent, Struct>(Struct *structure) :
ParentOwned<Class, Parent, Struct>(Struct *structure) :
structure(structure)
{
}
@ -262,7 +262,7 @@ protected:
/** 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. */
@ -352,7 +352,7 @@ protected:
/** 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:
@ -369,7 +369,7 @@ protected:
/** 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. */
@ -398,7 +398,7 @@ protected:
/** 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:
@ -441,7 +441,7 @@ protected:
/** 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. */
@ -466,7 +466,7 @@ protected:
/** 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. */
@ -682,7 +682,7 @@ protected:
/** 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:
@ -699,7 +699,7 @@ protected:
/** 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:
@ -715,7 +715,7 @@ protected:
/** 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:
@ -734,7 +734,7 @@ protected:
/** 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:
@ -759,7 +759,7 @@ protected:
/** 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. */
@ -806,7 +806,7 @@ protected:
/** 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:
@ -857,7 +857,7 @@ 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. */