20 #ifndef TLX_SORT_STRINGS_STRING_PTR_HEADER 21 #define TLX_SORT_STRINGS_STRING_PTR_HEADER 34 namespace sort_strings_detail {
36 template <
typename StringSet_>
39 template <
typename StringSet_,
typename LcpType_>
46 template <
typename StringSet_>
51 typedef typename StringSet::String
String;
66 size_t size()
const {
return active_.size(); }
70 assert(offset + sub_size <=
size());
71 return StringPtr(active_.subi(offset, offset + sub_size));
78 template <
typename LcpType>
79 void set_lcp(
size_t ,
const LcpType& )
const { }
82 template <
typename LcpType>
89 WithShadow
add_shadow(
const StringSet& shadow)
const;
96 template <
typename StringSet_,
typename LcpType_>
102 typedef typename StringSet::String
String;
114 : active_(ss), lcp_(lcp) { }
120 size_t size()
const {
return active_.size(); }
124 assert(offset + sub_size <=
size());
125 return StringLcpPtr(active_.subi(offset, offset + sub_size),
144 void set_lcp(
size_t i,
const LcpType& v)
const {
151 for (
size_t i = 1; i <
size(); ++i)
159 WithShadow
add_shadow(
const StringSet& shadow)
const;
167 template <
typename StringSet_>
172 typedef typename StringSet::String
String;
185 bool flipped =
false)
186 : active_(original), shadow_(shadow), flipped_(flipped) { }
192 const StringSet&
shadow()
const {
return shadow_; }
198 size_t size()
const {
return active_.size(); }
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),
224 std::move(active_.begin(), active_.end(), shadow_.begin());
233 template <
typename LcpType>
234 void set_lcp(
size_t ,
const LcpType& )
const { }
237 template <
typename LcpType>
246 template <
typename StringSet_,
typename LcpType_>
252 typedef typename StringSet::String
String;
268 LcpType* lcp,
bool flipped =
false)
269 : active_(original), shadow_(shadow), lcp_(lcp), flipped_(flipped) { }
275 const StringSet&
shadow()
const {
return shadow_; }
281 size_t size()
const {
return active_.size(); }
285 assert(offset + sub_size <=
size());
287 shadow_.subi(offset, offset + sub_size),
288 lcp_ + offset, flipped_);
294 assert(offset + sub_size <=
size());
296 active_.subi(offset, offset + sub_size),
297 lcp_ + offset, !flipped_);
307 std::move(active_.begin(), active_.end(), shadow_.begin());
327 void set_lcp(
size_t i,
const LcpType& v)
const {
334 for (
size_t i = 1; i <
size(); ++i)
341 template <
typename StringSet_>
347 template <
typename StringSet_,
typename LcpType_>
361 #endif // !TLX_SORT_STRINGS_STRING_PTR_HEADER size_t size() const
return valid length
const StringSet & active() const
return currently active array
StringLcpPtr(const StringSet &ss, LcpType *lcp)
constructor specifying all attributes
const StringSet & active() const
return currently active array
const StringSet & active() const
return currently active array
bool flipped() const
true if flipped to back array
StringShadowPtr sub(size_t offset, size_t sub_size) const
Advance (both) pointers by given offset, return sub-array without flip.
void fill_lcp(const LcpType &) const
fill entire LCP array with v, excluding the first lcp[0] position!
StringShadowLcpPtr copy_back() const
void fill_lcp(const LcpType &v) const
fill entire LCP array with v, excluding the first lcp[0] position!
StringSet::Iterator Iterator
StringSet active_
strings (front) array
StringShadowPtr(const StringSet &original, const StringSet &shadow, bool flipped=false)
constructor specifying all attributes
const StringSet & shadow() const
return current shadow array
void fill_lcp(const LcpType &v) const
fill entire LCP array with v, excluding the first lcp[0] position!
bool flipped() const
true if flipped to back array
void set_lcp(size_t, const LcpType &) const
set the i-th lcp to v and check its value
StringLcpPtr sub(size_t offset, size_t sub_size) const
Advance (both) pointers by given offset, return sub-array.
StringShadowPtr< StringSet_ > WithShadow
objectified string and shadow pointer class
LcpType * lcp() const
return LCP array pointer
void set_lcp(size_t, const LcpType &) const
set the i-th lcp to v and check its value
StringPtr sub(size_t offset, size_t sub_size) const
Advance (both) pointers by given offset, return sub-array.
StringShadowLcpPtr sub(size_t offset, size_t sub_size) const
Advance (both) pointers by given offset, return sub-array without flip.
size_t size() const
return valid length
StringShadowPtr flip(size_t offset, size_t sub_size) const
bool flipped_
false if active_ is original, true if shadow_ is original
static const bool with_lcp
if we want to save the LCPs
LcpType get_lcp(size_t i) const
return LCP array value
const StringSet & active() const
return currently active array
bool flipped_
false if active_ is original, true if shadow_ is original
void set_lcp(size_t i, const LcpType &v) const
set the i-th lcp to v and check its value
StringShadowPtr copy_back() const
WithShadow add_shadow(const StringSet &shadow) const
construct objectified string and shadow pointer class
Objectified string and LCP array pointer arrays.
StringSet active_
strings (front) array
void fill_lcp(const LcpType &) const
fill entire LCP array with v, excluding the first lcp[0] position!
size_t size() const
return valid length
StringShadowLcpPtr< StringSet_, LcpType_ > WithShadow
objectified string and shadow pointer class
LcpType get_lcp(size_t i) const
return LCP array value
const StringSet & shadow() const
return current shadow array
void set_lcp(size_t i, const LcpType &v) const
set the i-th lcp to v and check its value
StringPtr(const StringSet &ss)
constructor specifying all attributes
StringSet::Iterator Iterator
LcpType * lcp() const
return LCP array pointer
Objectified string array pointer array.
StringShadowLcpPtr flip(size_t offset, size_t sub_size) const
size_t size() const
return valid length
WithShadow add_shadow(const StringSet &shadow) const
construct objectified string and shadow pointer class
StringShadowLcpPtr(const StringSet &original, const StringSet &shadow, LcpType *lcp, bool flipped=false)
constructor specifying all attributes