[beast: 9/49] BSE: move conversion template from ObjectImpl to ObjectIface.as<BseObjectPtr>()
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 9/49] BSE: move conversion template from ObjectImpl to ObjectIface.as<BseObjectPtr>()
- Date: Wed, 1 Jul 2015 11:29:51 +0000 (UTC)
commit 2ea0826da1e5da33c5f5cab9cc32d98034810008
Author: Tim Janik <timj gnu org>
Date: Mon Jun 22 02:03:06 2015 +0200
BSE: move conversion template from ObjectImpl to ObjectIface.as<BseObjectPtr>()
bse/Makefile.am | 5 +++--
bse/bseobject.hh | 10 ++--------
bse/bseserverinsert.hh | 21 +++++++++++++++++++++
3 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index ff6de9a..51c3e12 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -300,7 +300,7 @@ noinst_DATA = bsehack.idl
# == BSE IDL API (AIDA) ==
AUXTYPES_PY = $(srcdir)/AuxTypes.py
-EXTRA_DIST += AuxTypes.py
+EXTRA_DIST += AuxTypes.py bseserverinsert.hh
bseclientapi.hh: $(srcdir)/../bse/bseapi.idl $(AUXTYPES_PY)
$(AM_V_GEN)
$(Q) ${AIDACC} -x CxxStub -G macro=BSE_IDL -G clienthh -x $(AUXTYPES_PY) $< -o xgen-$(@F)
@@ -313,7 +313,8 @@ bseclientapi.cc: $(srcdir)/../bse/bseapi.idl $(AUXTYPES_PY)
GENERATED += bseclientapi.cc
bseserverapi.hh: $(srcdir)/bseapi.idl $(AUXTYPES_PY)
$(AM_V_GEN)
- $(Q) ${AIDACC} -x CxxStub -G macro=BSE_IDL -G serverhh -x $(AUXTYPES_PY) $< -o xgen-$(@F)
+ $(Q) ${AIDACC} -x CxxStub -G macro=BSE_IDL -G serverhh -x $(AUXTYPES_PY) \
+ --insertions $(srcdir)/bseserverinsert.hh $< -o xgen-$(@F)
$(Q) mv xgen-$(@F) $@
GENERATED += bseserverapi.hh
bseserverapi.cc: $(srcdir)/bseapi.idl $(AUXTYPES_PY)
diff --git a/bse/bseobject.hh b/bse/bseobject.hh
index dbfaf6f..6ceff71 100644
--- a/bse/bseobject.hh
+++ b/bse/bseobject.hh
@@ -14,14 +14,8 @@ public:
virtual std::string debug_name () override;
virtual int64_t proxy_id () override;
operator BseObject* () { return gobject_; }
- template<class BseObjectPtr>
- BseObjectPtr as ()
- {
- static_assert (std::is_pointer<BseObjectPtr>::value, "");
- typedef typename std::remove_pointer<BseObjectPtr>::type BseObjectT;
- static_assert (std::is_base_of<GObject, BseObjectT>::value, "");
- return (BseObjectPtr) gobject_;
- }
+ // template<class BseObjectPtr> BseObjectPtr as (); // provided by ObjectIface
+ virtual BseObject* as_bse_object () override { return gobject_; }
};
typedef std::shared_ptr<ObjectImpl> ObjectImplP;
diff --git a/bse/bseserverinsert.hh b/bse/bseserverinsert.hh
new file mode 100644
index 0000000..3a3bd2e
--- /dev/null
+++ b/bse/bseserverinsert.hh
@@ -0,0 +1,21 @@
+// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+
+IGNORE:
+struct DUMMY { // dummy class for auto indentation
+
+
+class_scope:Object:
+ template<class BseObjectPtr>
+ BseObjectPtr as ()
+ {
+ static_assert (std::is_pointer<BseObjectPtr>::value, "'BseObject*' required");
+ typedef typename std::remove_pointer<BseObjectPtr>::type BseObjectT;
+ static_assert (std::is_base_of<GObject, BseObjectT>::value, "'BseObject*' required");
+ return this ? (BseObjectPtr) this->as_bse_object() : NULL;
+ }
+protected:
+ virtual BseObject* as_bse_object() = 0;
+
+
+IGNORE: // close last _scope
+}; // DUMMY
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]