From: Martin Ling Date: Tue, 2 Sep 2014 19:38:44 +0000 (+0100) Subject: C++: Rename StructureWrapper to ParentOwned. X-Git-Tag: libsigrok-0.4.0~1047 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=541c855e1d05a007e996f52639698a7d3881c957;p=libsigrok.git C++: Rename StructureWrapper to ParentOwned. --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 0aade4b1..dcbf8021 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -245,7 +245,7 @@ shared_ptr 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 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 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, const TriggerMatchType } TriggerMatch::TriggerMatch(struct sr_trigger_match *structure, shared_ptr 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 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 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, struct sr_dev_inst *structure) : - StructureWrapper(structure), + ParentOwned(structure), Device(structure), input(input) { @@ -1259,7 +1259,7 @@ vector Option::get_values() } OutputFormat::OutputFormat(const struct sr_output_module *structure) : - StructureWrapper(structure) + ParentOwned(structure) { } diff --git a/bindings/cxx/include/libsigrok/libsigrok.hpp b/bindings/cxx/include/libsigrok/libsigrok.hpp index 62608582..0c77c906 100644 --- a/bindings/cxx/include/libsigrok/libsigrok.hpp +++ b/bindings/cxx/include/libsigrok/libsigrok.hpp @@ -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 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(Struct *structure) : + ParentOwned(Struct *structure) : structure(structure) { } @@ -262,7 +262,7 @@ protected: /** A hardware driver provided by the library */ class SR_API Driver : - public StructureWrapper + public ParentOwned { public: /** Name of this driver. */ @@ -352,7 +352,7 @@ protected: /** A real hardware device, connected via a driver */ class SR_API HardwareDevice : - public StructureWrapper, + public ParentOwned, public Device { public: @@ -369,7 +369,7 @@ protected: /** A channel on a device */ class SR_API Channel : - public StructureWrapper + public ParentOwned { 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, + public ParentOwned, public Configurable { public: @@ -441,7 +441,7 @@ protected: /** A stage in a trigger configuration */ class SR_API TriggerStage : - public StructureWrapper + public ParentOwned { public: /** Index number of this stage. */ @@ -466,7 +466,7 @@ protected: /** A match condition in a trigger configuration */ class SR_API TriggerMatch : - public StructureWrapper + public ParentOwned { public: /** Channel this condition matches on. */ @@ -682,7 +682,7 @@ protected: /** Payload of a datafeed header packet */ class SR_API Header : - public StructureWrapper, + public ParentOwned, public PacketPayload { public: @@ -699,7 +699,7 @@ protected: /** Payload of a datafeed metadata packet */ class SR_API Meta : - public StructureWrapper, + public ParentOwned, public PacketPayload { public: @@ -715,7 +715,7 @@ protected: /** Payload of a datafeed packet with logic data */ class SR_API Logic : - public StructureWrapper, + public ParentOwned, public PacketPayload { public: @@ -734,7 +734,7 @@ protected: /** Payload of a datafeed packet with analog data */ class SR_API Analog : - public StructureWrapper, + public ParentOwned, public PacketPayload { public: @@ -759,7 +759,7 @@ protected: /** An input format supported by the library */ class SR_API InputFormat : - public StructureWrapper + public ParentOwned { public: /** Name of this input format. */ @@ -806,7 +806,7 @@ protected: /** A virtual device associated with an input */ class SR_API InputDevice : - public StructureWrapper, + public ParentOwned, public Device { protected: @@ -857,7 +857,7 @@ protected: /** An output format supported by the library */ class SR_API OutputFormat : - public StructureWrapper + public ParentOwned { public: /** Name of this output format. */