diff --git a/src/Gui/ViewProvider.h b/src/Gui/ViewProvider.h index 9d175230b1..2bf274ec2a 100644 --- a/src/Gui/ViewProvider.h +++ b/src/Gui/ViewProvider.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -77,6 +78,26 @@ enum ViewStatus { }; +/** Convenience smart pointer to wrap coin node. + * + * It is basically boost::intrusive plus implicit pointer conversion to save the + * trouble of typing get() all the time. + */ +template +class CoinPtr: public boost::intrusive_ptr { +public: + // Too bad, VC2013 does not support constructor inheritance + //using boost::intrusive_ptr::intrusive_ptr; + typedef boost::intrusive_ptr inherited; + CoinPtr() {} + CoinPtr(T *p, bool add_ref=true):inherited(p,add_ref){} + template CoinPtr(CoinPtr const &r):inherited(r){} + + operator T *() const { + return this->get(); + } +}; + /** General interface for all visual stuff in FreeCAD * This class is used to generate and handle all around