X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fcxx%2Finclude%2Flibsigrok%2Flibsigrok.hpp;h=6260858274ade8db0a9aff8fa62fc6ea7a67ebb4;hb=bf52cc8cf278ff73a0ace5b4472a276d76651232;hp=ca9c119befa16f7a64ee2ac4d5a34f5e6be7f8ec;hpb=ba4eac48d4c7277d8b7cbe4036fb64610b8e6c61;p=libsigrok.git diff --git a/bindings/cxx/include/libsigrok/libsigrok.hpp b/bindings/cxx/include/libsigrok/libsigrok.hpp index ca9c119b..62608582 100644 --- a/bindings/cxx/include/libsigrok/libsigrok.hpp +++ b/bindings/cxx/include/libsigrok/libsigrok.hpp @@ -125,7 +125,8 @@ public: }; /* Base template for most classes which wrap a struct type from libsigrok. */ -template class SR_API StructureWrapper +template +class SR_API StructureWrapper { protected: /* Parent object which owns this child object's underlying structure. @@ -144,26 +145,24 @@ protected: shared_ptr parent; /* Weak pointer for shared_from_this() implementation. */ - weak_ptr > weak_this; + weak_ptr weak_this; public: /* Note, this implementation will create a new smart_ptr if none exists. */ - shared_ptr > shared_from_this() + shared_ptr shared_from_this() { - shared_ptr > shared; + shared_ptr shared; if (!(shared = weak_this.lock())) { - shared = shared_ptr >( - this, reset_parent); + shared = shared_ptr((Class *) this, reset_parent); weak_this = shared; } return shared; } - shared_ptr > - get_shared_pointer(shared_ptr parent) + shared_ptr get_shared_pointer(shared_ptr parent) { if (!parent) throw Error(SR_ERR_BUG); @@ -171,16 +170,14 @@ public: return shared_from_this(); } - shared_ptr > - get_shared_pointer(Parent *parent) + shared_ptr get_shared_pointer(Parent *parent) { if (!parent) throw Error(SR_ERR_BUG); - return get_shared_pointer(static_pointer_cast( - parent->shared_from_this())); + return get_shared_pointer(parent->shared_from_this()); } protected: - static void reset_parent(StructureWrapper *object) + static void reset_parent(Class *object) { if (!object->parent) throw Error(SR_ERR_BUG); @@ -189,7 +186,7 @@ protected: Struct *structure; - StructureWrapper(Struct *structure) : + StructureWrapper(Struct *structure) : structure(structure) { } @@ -264,7 +261,8 @@ protected: }; /** A hardware driver provided by the library */ -class SR_API Driver : public StructureWrapper +class SR_API Driver : + public StructureWrapper { public: /** Name of this driver. */ @@ -354,7 +352,7 @@ protected: /** A real hardware device, connected via a driver */ class SR_API HardwareDevice : - public StructureWrapper, + public StructureWrapper, public Device { public: @@ -370,7 +368,8 @@ protected: }; /** A channel on a device */ -class SR_API Channel : public StructureWrapper +class SR_API Channel : + public StructureWrapper { public: /** Current name of this channel. */ @@ -399,7 +398,7 @@ protected: /** A group of channels on a device, which share some configuration */ class SR_API ChannelGroup : - public StructureWrapper, + public StructureWrapper, public Configurable { public: @@ -441,7 +440,8 @@ protected: }; /** A stage in a trigger configuration */ -class SR_API TriggerStage : public StructureWrapper +class SR_API TriggerStage : + public StructureWrapper { public: /** Index number of this stage. */ @@ -465,7 +465,8 @@ protected: }; /** A match condition in a trigger configuration */ -class SR_API TriggerMatch : public StructureWrapper +class SR_API TriggerMatch : + public StructureWrapper { public: /** Channel this condition matches on. */ @@ -681,7 +682,7 @@ protected: /** Payload of a datafeed header packet */ class SR_API Header : - public StructureWrapper, + public StructureWrapper, public PacketPayload { public: @@ -698,7 +699,7 @@ protected: /** Payload of a datafeed metadata packet */ class SR_API Meta : - public StructureWrapper, + public StructureWrapper, public PacketPayload { public: @@ -714,7 +715,7 @@ protected: /** Payload of a datafeed packet with logic data */ class SR_API Logic : - public StructureWrapper, + public StructureWrapper, public PacketPayload { public: @@ -733,7 +734,7 @@ protected: /** Payload of a datafeed packet with analog data */ class SR_API Analog : - public StructureWrapper, + public StructureWrapper, public PacketPayload { public: @@ -758,7 +759,7 @@ protected: /** An input format supported by the library */ class SR_API InputFormat : - public StructureWrapper + public StructureWrapper { public: /** Name of this input format. */ @@ -805,7 +806,7 @@ protected: /** A virtual device associated with an input */ class SR_API InputDevice : - public StructureWrapper, + public StructureWrapper, public Device { protected: @@ -856,7 +857,7 @@ protected: /** An output format supported by the library */ class SR_API OutputFormat : - public StructureWrapper + public StructureWrapper { public: /** Name of this output format. */