19 #ifndef INCLUDE_RCF_RECURSIONLIMITER_HPP
20 #define INCLUDE_RCF_RECURSIONLIMITER_HPP
22 #include <boost/type_traits/is_same.hpp>
23 #include <boost/mpl/bool.hpp>
25 #include <RCF/ByteBuffer.hpp>
26 #include <RCF/Tools.hpp>
27 #include <RCF/TypeTraits.hpp>
31 template<
typename T1,
typename T2>
42 void assign(
const T1 &t1)
49 void assign(
const T1 &t1,
const T2 &t2)
72 void clearArg_(
const ByteBuffer &byteBuffer, TrueType *)
74 const_cast<ByteBuffer &
>(byteBuffer).clear();
78 void clearArg_(
const T &, FalseType *)
82 void clearArg(
const T &t)
84 typedef typename boost::is_same<T, ByteBuffer>::type type;
85 clearArg_(t, (type*) 0);
93 template<
typename StateT,
typename X,
typename Pfn>
94 void applyRecursionLimiter(
102 if (state.mRecursing)
104 state.mRecursing =
false;
109 using namespace boost::multi_index::detail;
111 scope_guard guard = boost::multi_index::detail::make_obj_guard(
115 RCF_UNUSED_VARIABLE(guard);
117 while (!state.mRecursing && !state.mBreak)
119 state.mRecursing =
true;
126 template<
typename StateT,
typename X,
typename Pfn,
typename T1>
127 void applyRecursionLimiter(
133 state.mBreak =
false;
136 if (state.mRecursing)
138 state.mRecursing =
false;
143 using namespace boost::multi_index::detail;
145 scope_guard guard = boost::multi_index::detail::make_obj_guard(
149 RCF_UNUSED_VARIABLE(guard);
151 while (!state.mRecursing && !state.mBreak)
153 state.mRecursing =
true;
154 ((&x)->*pfn)(state.mT1);
159 template<
typename StateT,
typename X,
typename Pfn,
typename T1,
typename T2>
160 void applyRecursionLimiter(
167 state.mBreak =
false;
169 state.assign(t1, t2);
170 if (state.mRecursing)
172 state.mRecursing =
false;
177 using namespace boost::multi_index::detail;
179 scope_guard guard = boost::multi_index::detail::make_obj_guard(
183 RCF_UNUSED_VARIABLE(guard);
185 while (!state.mRecursing && !state.mBreak)
187 state.mRecursing =
true;
188 ((&x)->*pfn)(state.mT1, state.mT2);
195 #endif // ! INCLUDE_RCF_RECURSIONLIMITER_HPP