18 #ifndef INCLUDE_RCF_RECURSIONLIMITER_HPP 19 #define INCLUDE_RCF_RECURSIONLIMITER_HPP 21 #include <type_traits> 23 #include <RCF/TypeTraits.hpp> 24 #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, std::true_type *)
73 const_cast<ByteBuffer &
>(byteBuffer).clear();
77 void clearArg_(
const T &, std::false_type *)
81 void clearArg(
const T &t)
83 typedef typename std::is_same<T, ByteBuffer>::type type;
84 clearArg_(t, (type*) 0);
92 template<
typename StateT,
typename X,
typename Pfn>
93 void applyRecursionLimiter(
100 if (state.mRecursing)
102 state.mRecursing =
false;
106 ScopeGuard guard([&]() { state.clear(); });
108 while (!state.mRecursing && !state.mBreak)
110 state.mRecursing =
true;
117 template<
typename StateT,
typename X,
typename Pfn,
typename T1>
118 void applyRecursionLimiter(
124 state.mBreak =
false;
127 if (state.mRecursing)
129 state.mRecursing =
false;
133 ScopeGuard guard([&]() { state.clear(); });
135 while (!state.mRecursing && !state.mBreak)
137 state.mRecursing =
true;
138 ((&x)->*pfn)(state.mT1);
143 template<
typename StateT,
typename X,
typename Pfn,
typename T1,
typename T2>
144 void applyRecursionLimiter(
151 state.mBreak =
false;
153 state.assign(t1, t2);
154 if (state.mRecursing)
156 state.mRecursing =
false;
160 ScopeGuard guard([&]() { state.clear(); });
162 while (!state.mRecursing && !state.mBreak)
164 state.mRecursing =
true;
165 ((&x)->*pfn)(state.mT1, state.mT2);
172 #endif // ! INCLUDE_RCF_RECURSIONLIMITER_HPP Definition: AmiIoHandler.hpp:23