slot¶
- template <std::size_t dim, typename node_value_type = std::size_t>
-
struct
slot¶ slot stucture, used to store Nodes with a hash code in an interval.
slot structures, store a set of Nodes.
Inherits from std::vector< Node< dim, node_value_type > >
Public Functions
-
auto
find(node_type const &node)¶ find a Node.
- Note
- we do not check if x is hashed.
- Parameters
x: Node hashed
- template <typename container>
-
void
put(container const &x)¶ put a vector of Node’s at the end.
- Parameters
x: vector of hashed nodes (not checked).
-
void
compress(node_type N = node_type::voidbit)¶ compress: ie, supress void Nodes with a given value
- Parameters
N: supress nodes for which N&node !=0
-
void
compressany()¶ compress all marked Nodes.
ie, supress Nodes with any value in the FreeBitsPart or marked as void
-
void
compress(node_type N, node_type M)¶ compress: ie, supress void Nodes with given values
- Note
- a Node K are supressed iff K&N==N or K&M==M
- Parameters
N: test valueM: test value
-
void
setMark(node_type N)¶ mark the slot with some value.
- Parameters
N: associated value.
-
unsigned char
getMark()¶ get the mark tag.
-
void
unsetMark(node_type N)¶ suppress a given mark
- Note
- throw an exception if not marked “mark”.
- Parameters
N: the mark
-
bool
markedOther(node_type mark)¶ test if the slot has been marked by an other mark as “mark”
- Parameters
mark: for the test.
-
bool
hasvoidNodes() const¶ does this slot contains void Nodes ?
-
void
sethasvoidNodes()¶ mark the slot as containing void Nodes.
-
void
And(node_type N)¶ make a logical “and” of all Nodes with a given value.
- Parameters
N: the value.
-
void
setTag(node_type N)¶ Tag, ie add some value to all Nodes.
- Note
- a “and” with the value must be zero. Not tested if DEBUG is not set. We do not want to set a value to Nodes, but to tag them.
- Parameters
N: the value.
-
void
empty()¶ empty the slot. Do not change s1 and s2, do not deallocate space.
-
auto
cut(std::size_t const nc)¶ cut the slot in nc slots.
- Note
- sizes of the resulting slots are not garanted to be equal.
- Parameters
nc: number of slotss: result. Array of nc slot*.
-
auto
cutBefore(std::size_t pos, node_type s2new)¶ cut this slot in 2 slots, at position pos, and then shrink it.
the returned slot is the first part containing v[0,pos[
- Note
- we do not check that pos is correct, except if DEBUG is set.
- Note
- for s2new: position part only; tested only if DEBUG set.
- Parameters
pos:s2new: value for s2 of the new slot, and s1 of this slot.
-
void
sort()¶ sort by hash function.
-
bool
cutdown(std::size_t lim = 2)¶ reallocate to reduce size;
- Note
- return True iff slot is reduced.
- Parameters
lim: we reduce size if allocsize/size>= lim
-
void
forgetFreeBits()¶ suppress all bits used to mark something (except voidbit).
-
void
uniq()¶ suppress ex-aequo.
- Note
- slot must be sorted (tested only if DEBUG is set).
-
bool
testWellFormed(bool throwexept = true) const¶ test if all nodes have their abscissa between s1 and s2.
- Parameters
throwexept: throw an exception if true.
-
bool
exaequo() const¶ look for ex-aequo
-
void
setStartRank(std::size_t r)¶ set startrank
- Parameters
r:
-
int
Slotrank() const¶ return slotrank.
-
void
setSlotrank(std::size_t r)¶ set the slot rank
- Parameters
r:
-
void
dump(std::ofstream &f)¶ Write slot to a file, already open.
_param f the file.
-
void
restore(std::ifstream &f)¶ restore a slot from a dump.
- Parameters
file: the file to restore from.
-
auto