BEAST - Free Software Audio Synthesizer and Tracker  0.10.0
bseserverinsert.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 
3 IGNORE:
4 struct DUMMY { // dummy class for auto indentation
5 
6 
7 class_scope:Object:
8  // as<BseObjectPtr>()
9  template<class BseObjectPtr, typename ::std::enable_if<std::is_pointer<BseObjectPtr>::value, bool>::type = true>
10  BseObjectPtr as ()
11  {
12  static_assert (std::is_pointer<BseObjectPtr>::value, "'BseObject*' required");
13  typedef typename std::remove_pointer<BseObjectPtr>::type BseObjectT;
14  static_assert (std::is_base_of<GObject, BseObjectT>::value, "'BseObject*' required");
15  return this ? (BseObjectPtr) this->as_bse_object() : NULL;
16  }
17  // DERIVES_shared_ptr (uses void_t to prevent errors for T without shared_ptr's typedefs)
18  template<class T, typename = void> struct DERIVES_shared_ptr : std::false_type {};
19  template<class T> struct DERIVES_shared_ptr<T, Rapicorn::void_t< typename T::element_type > > :
20  std::is_base_of< std::shared_ptr<typename T::element_type>, T > {};
21  // as<shared_ptr<T>>()
22  template<class ObjectImplP, typename ::std::enable_if<DERIVES_shared_ptr<ObjectImplP>::value, bool>::type = true>
23  ObjectImplP as ()
24  {
25  typedef typename ObjectImplP::element_type ObjectImplT;
27  ObjectImplT *impl = this ? dynamic_cast<ObjectImplT*> (this) : NULL;
28  return impl ? Rapicorn::shared_ptr_cast<ObjectImplT> (impl) : NULL;
29  }
30 protected:
31  virtual BseObject* as_bse_object() = 0;
32 
33 
34 IGNORE: // close last _scope
35 }; // DUMMY
Definition: bstserverapi.cc:585
Definition: bseobject.hh:61