1 #ifndef SALOMEDSCLIENT_DEF_HXX
2 #define SALOMEDSCLIENT_DEF_HXX
4 #include <boost/shared_ptr.hpp>
6 template<class T> class clt_shared_ptr: public boost::shared_ptr<T>
12 explicit clt_shared_ptr(Y * p)
18 clt_shared_ptr(clt_shared_ptr<Y> const & r):
19 boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag())
23 clt_shared_ptr & operator=(clt_shared_ptr<Y> const & r)
25 clt_shared_ptr<T>(r).swap(*this);
29 template<class Y> clt_shared_ptr& operator()(Y * p) // Y must be complete
31 if(T* pt = dynamic_cast<T*>(p))
32 boost::shared_ptr<T>::reset(pt);
34 boost::throw_exception(std::bad_cast());
40 #define _PTR(Class) clt_shared_ptr<SALOMEDSClient_##Class>
41 #define _CAST(Class, shared_ptr_Obj) dynamic_cast<SALOMEDS_##Class*>(shared_ptr_Obj.get())