PageRenderTime 37ms CodeModel.GetById 18ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 1ms

/Src/Dependencies/Boost/boost/function_types/property_tags.hpp

http://hadesmem.googlecode.com/
C++ Header | 149 lines | 108 code | 33 blank | 8 comment | 0 complexity | 8cb9950914b03c507942237a43419e0d MD5 | raw file
  1
  2// (C) Copyright Tobias Schwinger
  3//
  4// Use modification and distribution are subject to the boost Software License,
  5// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
  6
  7//------------------------------------------------------------------------------
  8
  9#ifndef BOOST_FT_DETAIL_TAGS_HPP_INCLUDED
 10#define BOOST_FT_DETAIL_TAGS_HPP_INCLUDED
 11
 12#include <cstddef>
 13
 14#include <boost/type_traits/integral_constant.hpp>
 15#include <boost/mpl/bitxor.hpp>
 16
 17
 18namespace boost { namespace function_types { 
 19
 20namespace detail 
 21{
 22  typedef long bits_t;
 23
 24  template<bits_t Value> struct constant 
 25    : boost::integral_constant<bits_t,Value> 
 26  { };
 27
 28  template<bits_t Bits, bits_t Mask> struct property_tag 
 29  {
 30    typedef constant<Bits> bits;
 31    typedef constant<Mask> mask;
 32  };
 33
 34  template<typename T> struct bits : T::bits { };
 35  template<typename T> struct mask : T::mask { };
 36
 37  // forward declaration, defined in pp_tags
 38  template<bits_t Bits, bits_t CCID> struct encode_bits_impl; 
 39
 40  // forward declaration, defined in pp_tags
 41  template<bits_t LHS_bits, bits_t LHS_mask, 
 42           bits_t RHS_bits, bits_t RHS_mask> 
 43  struct tag_ice;
 44 
 45  // forward declaration, defined in retag_default_cc 
 46  template<class Tag, class RegTag = Tag> struct retag_default_cc; 
 47 
 48  template<bits_t Bits, bits_t CCID> struct encode_bits
 49    : constant< 
 50        ::boost::function_types::detail::encode_bits_impl<Bits,CCID>::value 
 51      >
 52  { };
 53
 54  template<class LHS, class RHS> struct compound_tag
 55  {
 56    typedef constant<
 57      ::boost::function_types::detail::tag_ice
 58        < ::boost::function_types::detail::bits<LHS>::value
 59        , ::boost::function_types::detail::mask<LHS>::value
 60        , ::boost::function_types::detail::bits<RHS>::value
 61        , ::boost::function_types::detail::mask<RHS>::value
 62        >::combined_bits 
 63    > bits;
 64
 65    typedef constant< 
 66      ::boost::function_types::detail::tag_ice
 67        < ::boost::function_types::detail::bits<LHS>::value
 68        , ::boost::function_types::detail::mask<LHS>::value
 69        , ::boost::function_types::detail::bits<RHS>::value
 70        , ::boost::function_types::detail::mask<RHS>::value
 71        >::combined_mask 
 72    > mask; 
 73  };
 74
 75  template <class Base, class PropOld, class PropNew>
 76  struct changed_tag
 77    : Base
 78  {
 79    typedef mpl::bitxor_
 80        <typename Base::bits, typename PropOld::bits, typename PropNew::bits>
 81    bits;
 82  };
 83
 84  template<class Tag, class QueryTag> struct represents_impl
 85    : boost::integral_constant<bool,
 86        ::boost::function_types::detail::tag_ice
 87          < ::boost::function_types::detail::bits<Tag>::value
 88          , ::boost::function_types::detail::mask<Tag>::value
 89          , ::boost::function_types::detail::bits<QueryTag>::value
 90          , ::boost::function_types::detail::mask<QueryTag>::value
 91          >::match
 92      >
 93  { };
 94
 95} // namespace detail
 96
 97typedef detail::property_tag<0,0> null_tag;
 98
 99template<class Tag1, class Tag2, class Tag3 = null_tag, class Tag4 = null_tag>
100struct tag
101  : detail::compound_tag< detail::compound_tag<Tag1,Tag2>, 
102        detail::compound_tag<Tag3,Tag4> >
103{ };
104
105#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
106template<class Tag1, class Tag2, class Tag3> struct tag<Tag1,Tag2,Tag3,null_tag>
107  : detail::compound_tag<detail::compound_tag<Tag1,Tag2>,Tag3>
108{ };
109template<class Tag1, class Tag2> struct tag<Tag1,Tag2,null_tag,null_tag>
110  : detail::compound_tag<Tag1,Tag2>
111{ };
112template<class Tag1> struct tag<Tag1,null_tag,null_tag,null_tag>
113  : Tag1
114{ };
115#endif
116
117
118template<class Tag, class QueryTag> struct represents
119  : detail::represents_impl<Tag, detail::retag_default_cc<QueryTag,Tag> >
120{ };
121
122
123template<class Tag, class QueryTag> struct extract
124{ 
125  typedef detail::constant<
126    ::boost::function_types::detail::tag_ice
127      < ::boost::function_types::detail::bits<Tag>::value
128      , ::boost::function_types::detail::mask<Tag>::value
129      , ::boost::function_types::detail::bits<QueryTag>::value
130      , ::boost::function_types::detail::mask<QueryTag>::value
131      >::extracted_bits 
132  > bits;
133
134  typedef detail::constant< 
135    ::boost::function_types::detail::mask<QueryTag>::value
136  > mask; 
137};
138
139} } // namespace ::boost::function_types
140
141#include <boost/function_types/detail/pp_tags/preprocessed.hpp>
142
143namespace boost { namespace function_types {
144#define BOOST_FT_cc_file <boost/function_types/detail/pp_tags/cc_tag.hpp>
145#include <boost/function_types/detail/pp_loop.hpp>
146} } // namespace boost::function_types
147
148#endif
149