[beast/devel: 13/26] BSE: introduce Bse::ImplicitBase for shared_ptr handling
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/devel: 13/26] BSE: introduce Bse::ImplicitBase for shared_ptr handling
- Date: Mon, 13 Oct 2014 02:27:12 +0000 (UTC)
commit f50049831a1dae75ce853723bbf7f18287b1839b
Author: Tim Janik <timj gnu org>
Date: Sun Oct 12 05:18:25 2014 +0200
BSE: introduce Bse::ImplicitBase for shared_ptr handling
bse/Makefile.am | 4 ++--
bse/bseutils.hh | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index 195cdf1..983a7c2 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -304,13 +304,13 @@ GENERATED += bseclientapi.cc
bseserverapi.hh: $(srcdir)/bseapi.idl $(AUXTYPES_PY)
$(AM_V_GEN)
$(Q) ${AIDACC} -x CxxStub -x $(AUXTYPES_PY) -G serverhh -G cppguard=__BST_BSESERVERAPI_HH_ \
- -G iface-base=BseImplicitBase $< -o xgen-$(@F)
+ -G iface-base=Bse::ImplicitBase $< -o xgen-$(@F)
$(Q) mv xgen-$(@F) $@
GENERATED += bseserverapi.hh
bseserverapi.cc: $(srcdir)/bseapi.idl $(AUXTYPES_PY)
$(AM_V_GEN)
$(Q) ${AIDACC} -x CxxStub -x $(AUXTYPES_PY) -G servercc -G cppguard=__BST_BSESERVERAPI_CC_ \
- -G iface-base=BseImplicitBase $< -o xgen-$(@F)
+ -G iface-base=Bse::ImplicitBase $< -o xgen-$(@F)
$(Q) patch < patch-bseserverapi.cc.diff
$(Q) mv xgen-$(@F) $@
GENERATED += bseserverapi.cc
diff --git a/bse/bseutils.hh b/bse/bseutils.hh
index 69beffd..210d490 100644
--- a/bse/bseutils.hh
+++ b/bse/bseutils.hh
@@ -3,6 +3,23 @@
#define __BSE_UTILS_H__
#include <bse/bseclientapi.hh>
+#include <rapicorn-core.hh>
+
+namespace Bse {
+
+/// IDL API base class until Rapicorn supports ImplicitBaseP out of the box.
+class ImplicitBase : public virtual Rapicorn::Aida::ImplicitBase,
+ public virtual std::enable_shared_from_this<ImplicitBase> {
+public:
+ template<class Class, typename std::enable_if<std::is_base_of<ImplicitBase, Class>::value>::type* =
nullptr>
+ static std::shared_ptr<Class> shared_ptr (Class *object) ///< Wrap ImplicitBase or derived type into a
std::shared_ptr<>().
+ {
+ return object ? std::shared_ptr<Class> (object->shared_from_this()) : std::shared_ptr<Class>();
+ }
+};
+
+} // Bse
+
#include <bse/bseserverapi.hh>
#include <bse/bseenums.hh>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]