auto_closure.hpp

Go to the documentation of this file.
00001 /****
00002 ***** Copyright 2010 Intel Corporation All Rights Reserved.
00003 *****
00004 ***** The source code, information and material contained herein are owned by Intel Corporation or its suppliers  *****
00005 ***** or licensors, and title to such Material remains with Intel Corporation or its suppliers or licensors.      *****
00006 ***** The Material contains proprietary information of Intel or its suppliers and licensors. The Material is      *****
00007 ***** protected by worldwide copyright laws and treaty provisions. No part of the Material may be used, copied,   *****
00008 ***** reproduced, modified, published, uploaded, posted, transmitted, distributed or disclosed in any way without *****
00009 ***** Intel's prior express written permission.
00010 *****
00011 ***** No license under any patent, copyright or other intellectual property rights in the material is granted to  *****
00012 ***** or conferred upon you, either expressly, by implication, inducement, estoppel or otherwise. Any license     *****
00013 ***** under such intellectual property rights must be express and approved by Intel in writing.
00014 ****/
00015 
00016 /**** Copyright Ends ****/
00017 
00018 #ifndef ARBB_CPP_AUTO_CLOSURE_HPP
00019 #define ARBB_CPP_AUTO_CLOSURE_HPP
00020 
00021 #include "namespace.hpp"
00022 #include "detail/closure_base.hpp"
00023 #include "detail/collectors.hpp"
00024 #include "detail/type_list.hpp"
00025 #include "detail/type_traits.hpp"
00026 #include "detail/type_info.hpp"
00027 
00028 #include <stdexcept>
00029 #include <vector>
00030 
00031 namespace ARBB_CPP_NS {
00032 
00035 
00043 class auto_closure : public detail::closure_base {
00044 public:
00045 
00047   auto_closure();
00048 
00050   auto_closure(const auto_closure& other);
00051 
00053   bool empty() const;
00054 
00056   auto_closure& operator=(const auto_closure& other);
00057 
00059   bool operator==(const detail::closure_base& other) const;
00061   bool operator!=(const detail::closure_base& other) const;
00062 
00068   template <typename T>
00069   bool has_type() const;
00070 
00072 
00073   // Factory function for creating an auto_closure from a given function
00074   // object and type_list. This function should only be called by closure.
00075   template <typename T>
00076   static auto_closure create(const detail::function& func,
00077                              const detail::function& wrapper_func,
00078                              ARBB_CPP_DETAIL_ENABLE_IF_TYPE_LIST(T) = 0);
00079 
00080   const detail::type_info_list& detail_type_info() const { return m_type_info_list; }
00081 
00082 #ifdef ARBB_CPP_DOXYGEN_ONLY
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099   void operator()(FunctionParams... arguments) const;
00100 #endif
00101   
00102 private:
00103 
00104   void type_check(const detail::type_info_list& argument_types) const;
00105 
00106   detail::type_info_list m_type_info_list;
00107 
00108 public:
00109 
00110   // template <typename T0, ..., typename Tn>
00111   // void operator()(T0, ..., Tn);
00112 #define ARBB_AUTO_CLOSURE_NUM_ARGS 0
00113 #include "detail/auto_closure_template.hpp"
00114 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00115 #define ARBB_AUTO_CLOSURE_NUM_ARGS 1
00116 #include "detail/auto_closure_template.hpp"
00117 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00118 #define ARBB_AUTO_CLOSURE_NUM_ARGS 2
00119 #include "detail/auto_closure_template.hpp"
00120 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00121 #define ARBB_AUTO_CLOSURE_NUM_ARGS 3
00122 #include "detail/auto_closure_template.hpp"
00123 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00124 #define ARBB_AUTO_CLOSURE_NUM_ARGS 4
00125 #include "detail/auto_closure_template.hpp"
00126 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00127 #define ARBB_AUTO_CLOSURE_NUM_ARGS 5
00128 #include "detail/auto_closure_template.hpp"
00129 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00130 #define ARBB_AUTO_CLOSURE_NUM_ARGS 6
00131 #include "detail/auto_closure_template.hpp"
00132 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00133 #define ARBB_AUTO_CLOSURE_NUM_ARGS 7
00134 #include "detail/auto_closure_template.hpp"
00135 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00136 #define ARBB_AUTO_CLOSURE_NUM_ARGS 8
00137 #include "detail/auto_closure_template.hpp"
00138 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00139 #define ARBB_AUTO_CLOSURE_NUM_ARGS 9
00140 #include "detail/auto_closure_template.hpp"
00141 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00142 #define ARBB_AUTO_CLOSURE_NUM_ARGS 10
00143 #include "detail/auto_closure_template.hpp"
00144 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00145 #define ARBB_AUTO_CLOSURE_NUM_ARGS 11
00146 #include "detail/auto_closure_template.hpp"
00147 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00148 #define ARBB_AUTO_CLOSURE_NUM_ARGS 12
00149 #include "detail/auto_closure_template.hpp"
00150 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00151 #define ARBB_AUTO_CLOSURE_NUM_ARGS 13
00152 #include "detail/auto_closure_template.hpp"
00153 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00154 #define ARBB_AUTO_CLOSURE_NUM_ARGS 14
00155 #include "detail/auto_closure_template.hpp"
00156 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00157 #define ARBB_AUTO_CLOSURE_NUM_ARGS 15
00158 #include "detail/auto_closure_template.hpp"
00159 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00160 #define ARBB_AUTO_CLOSURE_NUM_ARGS 16
00161 #include "detail/auto_closure_template.hpp"
00162 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00163 #define ARBB_AUTO_CLOSURE_NUM_ARGS 17
00164 #include "detail/auto_closure_template.hpp"
00165 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00166 #define ARBB_AUTO_CLOSURE_NUM_ARGS 18
00167 #include "detail/auto_closure_template.hpp"
00168 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00169 #define ARBB_AUTO_CLOSURE_NUM_ARGS 19
00170 #include "detail/auto_closure_template.hpp"
00171 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00172 #define ARBB_AUTO_CLOSURE_NUM_ARGS 20
00173 #include "detail/auto_closure_template.hpp"
00174 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00175 #define ARBB_AUTO_CLOSURE_NUM_ARGS 21
00176 #include "detail/auto_closure_template.hpp"
00177 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00178 #define ARBB_AUTO_CLOSURE_NUM_ARGS 22
00179 #include "detail/auto_closure_template.hpp"
00180 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00181 #define ARBB_AUTO_CLOSURE_NUM_ARGS 23
00182 #include "detail/auto_closure_template.hpp"
00183 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00184 #define ARBB_AUTO_CLOSURE_NUM_ARGS 24
00185 #include "detail/auto_closure_template.hpp"
00186 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00187 #define ARBB_AUTO_CLOSURE_NUM_ARGS 25
00188 #include "detail/auto_closure_template.hpp"
00189 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00190 #define ARBB_AUTO_CLOSURE_NUM_ARGS 26
00191 #include "detail/auto_closure_template.hpp"
00192 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00193 #define ARBB_AUTO_CLOSURE_NUM_ARGS 27
00194 #include "detail/auto_closure_template.hpp"
00195 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00196 #define ARBB_AUTO_CLOSURE_NUM_ARGS 28
00197 #include "detail/auto_closure_template.hpp"
00198 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00199 #define ARBB_AUTO_CLOSURE_NUM_ARGS 29
00200 #include "detail/auto_closure_template.hpp"
00201 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00202 #define ARBB_AUTO_CLOSURE_NUM_ARGS 30
00203 #include "detail/auto_closure_template.hpp"
00204 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00205 #define ARBB_AUTO_CLOSURE_NUM_ARGS 31
00206 #include "detail/auto_closure_template.hpp"
00207 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00208 #define ARBB_AUTO_CLOSURE_NUM_ARGS 32
00209 #include "detail/auto_closure_template.hpp"
00210 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00211 #define ARBB_AUTO_CLOSURE_NUM_ARGS 33
00212 #include "detail/auto_closure_template.hpp"
00213 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00214 #define ARBB_AUTO_CLOSURE_NUM_ARGS 34
00215 #include "detail/auto_closure_template.hpp"
00216 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00217 #define ARBB_AUTO_CLOSURE_NUM_ARGS 35
00218 #include "detail/auto_closure_template.hpp"
00219 #undef ARBB_AUTO_CLOSURE_NUM_ARGS
00220 
00222 };
00223 
00225 
00226 } // namespace ARBB_CPP_NS
00227 
00228 #include "detail/auto_closure_impl.hpp"
00229 
00230 #endif // ARBB_AUTO_CLOSURE_H

Submit feedback on this help topic

Copyright © 2010, Intel Corporation. All rights reserved.