20#ifndef TLX_SORT_STRINGS_STRING_PTR_HEADER
21#define TLX_SORT_STRINGS_STRING_PTR_HEADER
34namespace sort_strings_detail {
36template <
typename StringSet_>
39template <
typename StringSet_,
typename LcpType_>
40class StringShadowLcpPtr;
46template <
typename StringSet_>
51 typedef typename StringSet::String
String;
70 assert(offset + sub_size <=
size());
78 template <
typename LcpType>
79 void set_lcp(
size_t ,
const LcpType& )
const { }
82 template <
typename LcpType>
96template <
typename StringSet_,
typename LcpType_>
102 typedef typename StringSet::String
String;
124 assert(offset + sub_size <=
size());
151 for (
size_t i = 1; i <
size(); ++i)
167template <
typename StringSet_>
172 typedef typename StringSet::String
String;
202 assert(offset + sub_size <=
size());
204 shadow_.subi(offset, offset + sub_size),
211 assert(offset + sub_size <=
size());
213 active_.subi(offset, offset + sub_size),
233 template <
typename LcpType>
234 void set_lcp(
size_t ,
const LcpType& )
const { }
237 template <
typename LcpType>
246template <
typename StringSet_,
typename LcpType_>
252 typedef typename StringSet::String
String;
285 assert(offset + sub_size <=
size());
287 shadow_.subi(offset, offset + sub_size),
294 assert(offset + sub_size <=
size());
296 active_.subi(offset, offset + sub_size),
334 for (
size_t i = 1; i <
size(); ++i)
341template <
typename StringSet_>
342StringShadowPtr<StringSet_>
347template <
typename StringSet_,
typename LcpType_>
Objectified string and LCP array pointer arrays.
StringShadowLcpPtr< StringSet_, LcpType_ > WithShadow
objectified string and shadow pointer class
StringLcpPtr sub(size_t offset, size_t sub_size) const
Advance (both) pointers by given offset, return sub-array.
size_t size() const
return valid length
const StringSet & active() const
return currently active array
LcpType * lcp() const
return LCP array pointer
LcpType get_lcp(size_t i) const
return LCP array value
StringSet active_
strings (front) array
static const bool with_lcp
if we want to save the LCPs
void fill_lcp(const LcpType &v) const
fill entire LCP array with v, excluding the first lcp[0] position!
void set_lcp(size_t i, const LcpType &v) const
set the i-th lcp to v and check its value
WithShadow add_shadow(const StringSet &shadow) const
construct objectified string and shadow pointer class
StringLcpPtr(const StringSet &ss, LcpType *lcp)
constructor specifying all attributes
Objectified string array pointer array.
StringShadowPtr< StringSet_ > WithShadow
objectified string and shadow pointer class
size_t size() const
return valid length
const StringSet & active() const
return currently active array
StringPtr(const StringSet &ss)
constructor specifying all attributes
StringPtr sub(size_t offset, size_t sub_size) const
Advance (both) pointers by given offset, return sub-array.
void fill_lcp(const LcpType &) const
fill entire LCP array with v, excluding the first lcp[0] position!
StringSet active_
strings (front) array
static const bool with_lcp
if we want to save the LCPs
void set_lcp(size_t, const LcpType &) const
set the i-th lcp to v and check its value
WithShadow add_shadow(const StringSet &shadow) const
construct objectified string and shadow pointer class
Objectified string array pointer and shadow pointer array for out-of-place swapping of pointers.
StringShadowLcpPtr sub(size_t offset, size_t sub_size) const
Advance (both) pointers by given offset, return sub-array without flip.
StringSet::Iterator Iterator
size_t size() const
return valid length
const StringSet & active() const
return currently active array
LcpType * lcp() const
return LCP array pointer
const StringSet & shadow() const
return current shadow array
StringShadowLcpPtr copy_back() const
return subarray pointer to n strings in original array, might copy from shadow before returning.
StringShadowLcpPtr(const StringSet &original, const StringSet &shadow, LcpType *lcp, bool flipped=false)
constructor specifying all attributes
bool flipped() const
true if flipped to back array
LcpType get_lcp(size_t i) const
return LCP array value
bool flipped_
false if active_ is original, true if shadow_ is original
StringSet active_
strings (front) and temporary shadow (back) array
static const bool with_lcp
if we want to save the LCPs
void fill_lcp(const LcpType &v) const
fill entire LCP array with v, excluding the first lcp[0] position!
void set_lcp(size_t i, const LcpType &v) const
set the i-th lcp to v and check its value
StringShadowLcpPtr flip(size_t offset, size_t sub_size) const
construct a StringShadowLcpPtr object specifying a sub-array with flipping to other array.
Objectified string array pointer and shadow pointer array for out-of-place swapping of pointers.
StringSet::Iterator Iterator
size_t size() const
return valid length
const StringSet & active() const
return currently active array
const StringSet & shadow() const
return current shadow array
StringShadowPtr flip(size_t offset, size_t sub_size) const
construct a StringShadowPtr object specifying a sub-array with flipping to other array.
StringShadowPtr sub(size_t offset, size_t sub_size) const
Advance (both) pointers by given offset, return sub-array without flip.
bool flipped() const
true if flipped to back array
bool flipped_
false if active_ is original, true if shadow_ is original
StringShadowPtr(const StringSet &original, const StringSet &shadow, bool flipped=false)
constructor specifying all attributes
void fill_lcp(const LcpType &) const
fill entire LCP array with v, excluding the first lcp[0] position!
StringShadowPtr copy_back() const
return subarray pointer to n strings in original array, might copy from shadow before returning.
StringSet active_
strings (front) and temporary shadow (back) array
static const bool with_lcp
if we want to save the LCPs
void set_lcp(size_t, const LcpType &) const
set the i-th lcp to v and check its value