os/ossrv/ossrv_pub/boost_apis/boost/test/utils/rtti.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/test/utils/rtti.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,76 @@
     1.4 +//  (C) Copyright Gennadiy Rozental 2005.
     1.5 +//  Distributed under the Boost Software License, Version 1.0.
     1.6 +//  (See accompanying file LICENSE_1_0.txt or copy at 
     1.7 +//  http://www.boost.org/LICENSE_1_0.txt)
     1.8 +
     1.9 +//  See http://www.boost.org/libs/test for the library home page.
    1.10 +//
    1.11 +//  File        : $RCSfile: rtti.hpp,v $
    1.12 +//
    1.13 +//  Version     : $Revision: 1.2 $
    1.14 +//
    1.15 +//  Description : simple facilities for accessing type information at runtime
    1.16 +// ***************************************************************************
    1.17 +
    1.18 +#ifndef BOOST_TEST_RTTI_HPP_062604GER
    1.19 +#define BOOST_TEST_RTTI_HPP_062604GER
    1.20 +
    1.21 +#include <cstddef>
    1.22 +
    1.23 +namespace boost {
    1.24 +
    1.25 +namespace rtti {
    1.26 +
    1.27 +// ************************************************************************** //
    1.28 +// **************                   rtti::type_id              ************** //
    1.29 +// ************************************************************************** //
    1.30 +
    1.31 +typedef std::ptrdiff_t id_t;
    1.32 +
    1.33 +namespace rtti_detail {
    1.34 +
    1.35 +template<typename T>
    1.36 +struct rttid_holder {
    1.37 +    static id_t id() { return reinterpret_cast<id_t>( &inst() ); }
    1.38 +
    1.39 +private:
    1.40 +    struct rttid {};
    1.41 +
    1.42 +    static rttid const& inst() { static rttid s_inst;  return s_inst; }
    1.43 +};
    1.44 +
    1.45 +} // namespace rtti_detail
    1.46 +
    1.47 +//____________________________________________________________________________//
    1.48 +
    1.49 +template<typename T>   
    1.50 +inline id_t
    1.51 +type_id()
    1.52 +{
    1.53 +    return rtti_detail::rttid_holder<T>::id();
    1.54 +}
    1.55 +
    1.56 +//____________________________________________________________________________//
    1.57 +
    1.58 +#define BOOST_RTTI_SWITCH( type_id_ ) if( ::boost::rtti::id_t switch_by_id = type_id_ )
    1.59 +#define BOOST_RTTI_CASE( type )       if( switch_by_id == ::boost::rtti::type_id<type>() )
    1.60 +
    1.61 +//____________________________________________________________________________//
    1.62 +
    1.63 +} // namespace rtti
    1.64 +
    1.65 +} // namespace boost
    1.66 +
    1.67 +// ************************************************************************** //
    1.68 +//   Revision History:
    1.69 +//
    1.70 +//   $Log: rtti.hpp,v $
    1.71 +//   Revision 1.2  2005/05/15 06:45:32  rogeeff
    1.72 +//   *** empty log message ***
    1.73 +//
    1.74 +//   Revision 1.1  2005/04/12 06:48:12  rogeeff
    1.75 +//   Runtime.Param library initial commit
    1.76 +//
    1.77 +// ************************************************************************** //
    1.78 +
    1.79 +#endif // BOOST_RT_RTTI_HPP_062604GER