5 #include <libutl/SpanCol.h> 24 template <
class T,
class D = T>
30 typedef typename SpanCol<T, D>::iterator
iterator;
80 virtual void onAdd(
const Object&
object);
81 virtual void onRemove(
const Object&
object);
97 template <
class T,
class D>
107 template <
class T,
class D>
111 auto& sa = utl::cast<SpanAllocator<T, D>>(object);
114 for (
auto span : *
this)
122 template <
class T,
class D>
131 template <
class T,
class D>
138 for (
auto span : *
this)
147 template <
class T,
class D>
160 if (!nodeKey.isA2(
Span, T, D))
166 if (span.
size() < size)
168 node = node->
right();
172 if (!found || (span.
size() < bestSize))
176 bestSize = span.
size();
196 template <
class T,
class D>
200 _spans.add(
object.getKey());
205 template <
class T,
class D>
209 _spans.
remove(
object.getKey());
214 template <
class T,
class D>
221 if (!objSpan.
isNil())
230 template <
class T,
class D>
234 _spans.setOwner(
false);
virtual bool remove(const Object &key)
Remove the object matching the given key.
const T & begin() const
Get the beginning of the span.
void serialize(bool &b, Stream &stream, uint_t io, uint_t mode=ser_default)
Serialize a boolean.
void deInit()
De-initialize UTL++.
#define UTL_CLASS_DECL_TPL2_TPL2(DC, DC_T1, DC_T2, BC, BC_T1, BC_T2)
Declaration of standard UTL++ functionality for a template class with two parameters, where the base class also has two template parameters.
void setEnd(const T &end)
Set the end of the span.
D size() const
Return the size (end - begin).
default representation (via getSerializeMode())
void remove(FwdIt &begin, const FwdIt &end, bool cmp=false, const Predicate *pred=nullptr, bool predVal=false)
Remove objects from a sequence.
void copy(T *dest, const T *src, size_t len)
Copy one array of objects to another.
void free(const Span< T, D > *span)
Free the given span.
BinTreeNode * right() const
Return the right child.
bool isLeaf() const
Determine whether self is a leaf node.
In-order bi-directional BinTree iterator.
void setRelaxed(bool relaxed)
Set the relaxed flag.
unsigned int uint_t
Unsigned integer.
void setBegin(const T &begin)
Set the beginning of the span.
#define UTL_CLASS_IMPL_TPL2(className, T1, T2)
Implementation of standard UTL++ functionality for a template class with two parameters.
const uint_t uint_t_max
Maximum uint_t value.
virtual const Object & getKey() const
Get the key for this object.
void free(const Span< T, D > &span)
Free the given span.
Object * get() const
Get the contained object.
bool isNil() const
Determine whether the span is nil.
BinTreeNode * left() const
Return the left child.
Root of UTL++ class hierarchy.
Span< T, D > remove(const Span< T, D > &span)
Remove the given span from self.
void dump(const FwdIt &begin, const FwdIt &end, Stream &os, uint_t level=uint_t_max, bool key=false, bool printClassName=false, uint_t indent=0, const char *separator=nullptr)
Dump objects to the given stream (with Object::dump()).
void init()
Initialize UTL++.