Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:44

0001 /////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga  2009-2013.
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // See http://www.boost.org/libs/intrusive for documentation.
0010 //
0011 /////////////////////////////////////////////////////////////////////////////
0012 //  This code was modified from the code posted by Alexandre Courpron in his
0013 //  article "Interface Detection" in The Code Project:
0014 //  http://www.codeproject.com/KB/architecture/Detector.aspx
0015 ///////////////////////////////////////////////////////////////////////////////
0016 // Copyright 2007 Alexandre Courpron
0017 //
0018 // Permission to use, copy, modify, redistribute and sell this software,
0019 // provided that this copyright notice appears on all copies of the software.
0020 ///////////////////////////////////////////////////////////////////////////////
0021 
0022 #ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
0023 #define BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
0024 
0025 #ifndef BOOST_CONFIG_HPP
0026 #  include <boost/config.hpp>
0027 #endif
0028 
0029 #if defined(BOOST_HAS_PRAGMA_ONCE)
0030 #  pragma once
0031 #endif
0032 
0033 namespace boost {
0034 namespace intrusive {
0035 namespace function_detector {
0036 
0037     typedef char NotFoundType;
0038     struct StaticFunctionType { NotFoundType x [2]; };
0039     struct NonStaticFunctionType { NotFoundType x [3]; };
0040 
0041     enum
0042          { NotFound          = 0,
0043            StaticFunction    = sizeof( StaticFunctionType )    - sizeof( NotFoundType ),
0044            NonStaticFunction = sizeof( NonStaticFunctionType ) - sizeof( NotFoundType )
0045          };
0046 
0047 }  //namespace boost {
0048 }  //namespace intrusive {
0049 }  //namespace function_detector {
0050 
0051 #define BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(Identifier, InstantiationKey) \
0052    namespace boost { \
0053    namespace intrusive { \
0054    namespace function_detector { \
0055    template < class T, \
0056             class NonStaticType, \
0057             class NonStaticConstType, \
0058             class StaticType > \
0059    class DetectMember_##InstantiationKey_##Identifier { \
0060       template < NonStaticType > \
0061       struct TestNonStaticNonConst ; \
0062       \
0063       template < NonStaticConstType > \
0064       struct TestNonStaticConst ; \
0065       \
0066       template < StaticType > \
0067       struct TestStatic ; \
0068       \
0069       template <class U > \
0070       static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \
0071       \
0072       template <class U > \
0073       static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \
0074       \
0075       template <class U> \
0076       static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \
0077       \
0078       template <class U> \
0079       static NotFoundType Test( ... ); \
0080    public : \
0081       static const int check = NotFound + int(sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
0082    };\
0083 }}} //namespace boost::intrusive::function_detector {
0084 
0085 #define BOOST_INTRUSIVE_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
0086     ::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
0087                                          ReturnType (Class::*)Params,\
0088                                          ReturnType (Class::*)Params const,\
0089                                          ReturnType (*)Params \
0090                                        >::check
0091 
0092 #endif   //@ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP