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>
30 template<
typename T1,
typename T2>
41 void assign(
const T1 &t1)
48 void assign(
const T1 &t1,
const T2 &t2)
71 void clearArg_(
const ByteBuffer &byteBuffer, boost::mpl::true_*)
73 const_cast<ByteBuffer &
>(byteBuffer).clear();
77 void clearArg_(
const T &, boost::mpl::false_*)
81 void clearArg(
const T &t)
83 typedef typename boost::is_same<T, ByteBuffer>::type type;
84 clearArg_(t, (type*) 0);
92 template<
typename StateT,
typename X,
typename Pfn>
93 void applyRecursionLimiter(
101 if (state.mRecursing)
103 state.mRecursing =
false;
108 using namespace boost::multi_index::detail;
110 scope_guard guard = boost::multi_index::detail::make_obj_guard(
114 RCF_UNUSED_VARIABLE(guard);
116 while (!state.mRecursing && !state.mBreak)
118 state.mRecursing =
true;
125 template<
typename StateT,
typename X,
typename Pfn,
typename T1>
126 void applyRecursionLimiter(
132 state.mBreak =
false;
135 if (state.mRecursing)
137 state.mRecursing =
false;
142 using namespace boost::multi_index::detail;
144 scope_guard guard = boost::multi_index::detail::make_obj_guard(
148 RCF_UNUSED_VARIABLE(guard);
150 while (!state.mRecursing && !state.mBreak)
152 state.mRecursing =
true;
153 ((&x)->*pfn)(state.mT1);
158 template<
typename StateT,
typename X,
typename Pfn,
typename T1,
typename T2>
159 void applyRecursionLimiter(
166 state.mBreak =
false;
168 state.assign(t1, t2);
169 if (state.mRecursing)
171 state.mRecursing =
false;
176 using namespace boost::multi_index::detail;
178 scope_guard guard = boost::multi_index::detail::make_obj_guard(
182 RCF_UNUSED_VARIABLE(guard);
184 while (!state.mRecursing && !state.mBreak)
186 state.mRecursing =
true;
187 ((&x)->*pfn)(state.mT1, state.mT2);
194 #endif // ! INCLUDE_RCF_RECURSIONLIMITER_HPP