19 #ifndef INCLUDE_RCF_RECURSIONLIMITER_HPP 20 #define INCLUDE_RCF_RECURSIONLIMITER_HPP 22 #include <type_traits> 24 #include <RCF/TypeTraits.hpp> 25 #include <RCF/Tools.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, std::true_type *)
74 const_cast<ByteBuffer &
>(byteBuffer).clear();
78 void clearArg_(
const T &, std::false_type *)
82 void clearArg(
const T &t)
84 typedef typename std::is_same<T, ByteBuffer>::type type;
85 clearArg_(t, (type*) 0);
93 template<
typename StateT,
typename X,
typename Pfn>
94 void applyRecursionLimiter(
101 if (state.mRecursing)
103 state.mRecursing =
false;
107 ScopeGuard guard([&]() { state.clear(); });
109 while (!state.mRecursing && !state.mBreak)
111 state.mRecursing =
true;
118 template<
typename StateT,
typename X,
typename Pfn,
typename T1>
119 void applyRecursionLimiter(
125 state.mBreak =
false;
128 if (state.mRecursing)
130 state.mRecursing =
false;
134 ScopeGuard guard([&]() { state.clear(); });
136 while (!state.mRecursing && !state.mBreak)
138 state.mRecursing =
true;
139 ((&x)->*pfn)(state.mT1);
144 template<
typename StateT,
typename X,
typename Pfn,
typename T1,
typename T2>
145 void applyRecursionLimiter(
152 state.mBreak =
false;
154 state.assign(t1, t2);
155 if (state.mRecursing)
157 state.mRecursing =
false;
161 ScopeGuard guard([&]() { state.clear(); });
163 while (!state.mRecursing && !state.mBreak)
165 state.mRecursing =
true;
166 ((&x)->*pfn)(state.mT1, state.mT2);
173 #endif // ! INCLUDE_RCF_RECURSIONLIMITER_HPP Definition: AmiIoHandler.hpp:24