16#ifndef RANS_INTERNAL_TRANSFORM_SOURCEPROXY_H_
17#define RANS_INTERNAL_TRANSFORM_SOURCEPROXY_H_
33template <
typename source_T>
46 template <
typename IT>
50 mBuffer.reserve(
size);
52 for (
size_t i = 0;
i <
size; ++
i) {
54 mMin = std::min(mMin,
value);
55 mMax = std::max(mMax,
value);
56 mBuffer.push_back(
value);
62 inline size_t size() const noexcept {
return mBuffer.size(); };
63 inline bool empty() const noexcept {
return mBuffer.empty(); };
69 std::vector<source_type> mBuffer;
70 source_type mMin{std::numeric_limits<source_type>::min()};
71 source_type mMax{std::numeric_limits<source_type>::max()};
83 iterator
begin()
const {
return mBegin; };
84 iterator
end()
const {
return mEnd; };
95 using source_type =
typename std::iterator_traits<iterator>::value_type;
96 using pointer = source_type*;
97 using const_pointer =
const source_type*;
102 template <
typename F>
105 if (functor(begin,
end)) {
106 mProxy.template emplace<0>(begin,
end);
108 LOGP(
debug,
"Caching enabled");
110 mProxy.template emplace<1>(begin,
end);
112 LOGP(
debug,
"Caching disabled");
116 inline const_pointer
beginCache()
const {
return std::get<0>(mProxy).begin(); };
117 inline const_pointer
endCache()
const {
return std::get<0>(mProxy).end(); };
118 inline iterator
beginIter()
const {
return std::get<1>(mProxy).begin(); };
119 inline iterator
endIter()
const {
return std::get<1>(mProxy).end(); };
120 inline source_type
getMin()
const {
return std::get<0>(mProxy).getMin(); };
121 inline source_type
getMax()
const {
return std::get<0>(mProxy).getMax(); };
126 inline size_t size() const noexcept
128 if (std::holds_alternative<cache_type>(mProxy)) {
129 return std::get<0>(mProxy).size();
131 return std::get<1>(mProxy).size();
137 if (std::holds_alternative<cache_type>(mProxy)) {
138 return std::get<0>(mProxy).empty();
140 return std::get<1>(mProxy).empty();
145 std::variant<cache_type, range_type> mProxy{};
146 bool mIsCached{
true};
common helper classes and functions
RangeWrapper(IT begin, IT end)
const source_type * const_pointer
source_type getMax() const noexcept
SourceCache(IT begin, IT end)
size_t getAlphabetRangeBits() const noexcept
const_iterator begin() const noexcept
size_t size() const noexcept
source_type getMin() const noexcept
bool empty() const noexcept
const_iterator end() const noexcept
source_type getMax() const
iterator beginIter() const
size_t getAlphabetRangeBits() const
SourceProxy(IT begin, IT end, F functor)
bool empty() const noexcept
source_type getMin() const
size_t size() const noexcept
const_pointer beginCache() const
const_pointer endCache() const
GLsizei const GLfloat * value
constexpr uint32_t getRangeBits(T min, T max) noexcept