3 * @brief some functions to deal with (smart) pointer
5 * @author Reinhard Pfau \<Reinhard.Pfau@gmx.de\>
6 * @copyright © Copyright 2009 by Intra2net AG
8 * @contact opensource@intra2net.com
12 #ifndef _ASYNCIO_POINTER_FUNC_HPP_
13 #define _ASYNCIO_POINTER_FUNC_HPP_
15 #include <asyncio_config.hpp>
16 #include <boost/shared_ptr.hpp>
17 #include <boost/enable_shared_from_this.hpp>
18 #ifdef HAVE_LIBI2NCOMMON
19 # include <pointer_func.hpp>
27 #ifdef HAVE_LIBI2NCOMMON
29 // NOTE: this typedef is needed by I2N code; please keep it!
31 typedef I2n::SharedBase SharedBase
36 : public boost::enable_shared_from_this< SharedBase >
39 typedef boost::shared_ptr< SharedBase > PtrType;
43 virtual ~SharedBase() {}
46 boost::shared_ptr< D > get_ptr_as()
50 return boost::shared_dynamic_cast< D >( shared_from_this() );
52 catch( boost::bad_weak_ptr& e )
54 // we ignore this error.
56 return boost::shared_ptr< D >();
59 }; // end of SharedBase
64 } // end of namespace Utils
65 } // end of namespace AsyncIo