9#include "./block_funcs.hpp"
13namespace mdds {
namespace mtv {
92#ifdef MDDS_MULTI_TYPE_VECTOR_TRACE
94template<
typename T,
typename =
void>
95struct has_trace : std::false_type
100struct has_trace<T, decltype((void)T::trace)> : std::true_type
104template<
typename Traits>
109 call_trace(
int& _call_depth) : call_depth(_call_depth)
113 ~call_trace() noexcept
118 void call(std::false_type, const ::mdds::mtv::trace_method_properties_t&)
const
123 void call(std::true_type, const ::mdds::mtv::trace_method_properties_t& props)
const
127 Traits::trace(props);
130 void operator()(const ::mdds::mtv::trace_method_properties_t& props)
const
132 call(has_trace<Traits>{}, props);
138inline void throw_block_position_not_found(
139 const char* method_sig,
int line,
size_t pos,
size_t block_size,
size_t container_size)
141 std::ostringstream os;
142 os << method_sig <<
"#" << line <<
": block position not found! (logical pos=" << pos
143 <<
", block size=" << block_size <<
", logical size=" << container_size <<
")";
144 throw std::out_of_range(os.str());
165template<
typename _T,
typename _SizeT>
166std::pair<_SizeT, bool> calc_input_end_position(
const _T& it_begin,
const _T& it_end, _SizeT pos, _SizeT total_size)
168 using ret_type = std::pair<_SizeT, bool>;
170 _SizeT length = std::distance(it_begin, it_end);
173 return ret_type(0,
false);
175 _SizeT end_pos = pos + length - 1;
176 if (end_pos >= total_size)
177 throw std::out_of_range(
"Input data sequence is too long.");
179 return ret_type(end_pos,
true);
183T advance_position(
const T& pos,
int steps)
191 if (ret.second + steps < ret.first->size)
199 steps -=
static_cast<int>(ret.first->size - ret.second);
209 if (
static_cast<int>(ret.second) >= -steps)
216 steps +=
static_cast<int>(ret.second + 1);
218 ret.second = ret.first->size - 1;
230#ifdef MDDS_MULTI_TYPE_VECTOR_TRACE
232#define MDDS_MTV_TRACE(method_type) \
233 ::mdds::mtv::detail::call_trace<Traits> mdds_mtv_ct(m_trace_call_depth); \
234 mdds_mtv_ct({trace_method_t::method_type, this, __func__, "", __FILE__, __LINE__})
236#define MDDS_MTV_TRACE_ARGS(method_type, stream) \
237 ::mdds::mtv::detail::call_trace<Traits> mdds_mtv_ct(m_trace_call_depth); \
240 std::ostringstream _os_; \
242 mdds_mtv_ct({trace_method_t::method_type, this, __func__, _os_.str(), __FILE__, __LINE__}); \
247#define MDDS_MTV_TRACE(...)
249#define MDDS_MTV_TRACE_ARGS(...)
default_exec_policy exec_policy
Definition util.hpp:72
static constexpr lu_factor_t loop_unrolling
Definition util.hpp:67
empty_event_func event_func
Definition util.hpp:61
element_block_funcs<> block_funcs
Definition util.hpp:82
void element_block_acquired(const base_element_block *block)
Definition util.hpp:29
void element_block_released(const base_element_block *block)
Definition util.hpp:42