Grok  7.6.3
Public Member Functions | Private Attributes | List of all members
grk::TagTree Class Reference

Tag tree. More...

#include <TagTree.h>

Public Member Functions

 TagTree (uint64_t numleafsh, uint64_t numleafsv)
 Create a tag tree. More...
 
 ~TagTree ()
 
bool init (uint64_t num_leafs_h, uint64_t num_leafs_v)
 Reinitialises a tag tree. More...
 
void reset ()
 Reset a tag tree (set all leaves to 0) More...
 
void setvalue (uint64_t leafno, int64_t value)
 Set the value of a leaf of a tag tree. More...
 
bool compress (BitIO *bio, uint64_t leafno, int64_t threshold)
 Encode the value of a leaf of the tag tree up to a given threshold. More...
 
void decompress (BitIO *bio, uint64_t leafno, int64_t threshold, uint8_t *decompressed)
 Decompress the value of a leaf of the tag tree up to a given threshold. More...
 
void decodeValue (BitIO *bio, uint64_t leafno, int64_t threshold, uint64_t *value)
 Decompress the value of a leaf of the tag tree up to a given threshold. More...
 

Private Attributes

uint64_t numleafsh
 
uint64_t numleafsv
 
uint64_t numnodes
 
TagTreeNodenodes
 
uint64_t nodes_size
 

Detailed Description

Tag tree.

Constructor & Destructor Documentation

◆ TagTree()

grk::TagTree::TagTree ( uint64_t  numleafsh,
uint64_t  numleafsv 
)

Create a tag tree.

Parameters
numleafshWidth of the array of leafs of the tree
numleafsvHeight of the array of leafs of the tree
Returns
a new tag tree if successful, returns nullptr otherwise

References grk::GRK_WARN(), nodes, nodes_size, numleafsh, numleafsv, numnodes, grk::TagTreeNode::parent, and reset().

◆ ~TagTree()

grk::TagTree::~TagTree ( )

References nodes.

Member Function Documentation

◆ compress()

bool grk::TagTree::compress ( BitIO bio,
uint64_t  leafno,
int64_t  threshold 
)

Encode the value of a leaf of the tag tree up to a given threshold.

Parameters
bioPointer to a BIO handle
leafnoNumber that identifies the leaf to compress
thresholdThreshold to use when compressing value of the leaf
Returns
true if successful, otherwise false

References grk::TagTreeNode::low, nodes, grk::TagTreeNode::parent, and grk::BitIO::write().

◆ decodeValue()

void grk::TagTree::decodeValue ( BitIO bio,
uint64_t  leafno,
int64_t  threshold,
uint64_t *  value 
)

Decompress the value of a leaf of the tag tree up to a given threshold.

Parameters
bioPointer to a BIO handle
leafnoNumber that identifies the leaf to decompress
thresholdThreshold to use when decoding value of the leaf
valuethe node's value

References grk::TagTreeNode::low, nodes, grk::TagTreeNode::parent, grk::BitIO::read(), grk::tag_tree_uninitialized_node_value, and grk::TagTreeNode::value.

Referenced by decompress().

◆ decompress()

void grk::TagTree::decompress ( BitIO bio,
uint64_t  leafno,
int64_t  threshold,
uint8_t *  decompressed 
)

Decompress the value of a leaf of the tag tree up to a given threshold.

Parameters
bioPointer to a BIO handle
leafnoNumber that identifies the leaf to decompress
thresholdThreshold to use when decoding value of the leaf
decompressed1 if the node's value < threshold, 0 otherwise

References decodeValue().

◆ init()

bool grk::TagTree::init ( uint64_t  num_leafs_h,
uint64_t  num_leafs_v 
)

Reinitialises a tag tree.

Reinitialise a tag tree from an existing one.

Parameters
num_leafs_hthe width of the array of leafs of the tree
num_leafs_vthe height of the array of leafs of the tree
Returns
true if successful, false otherwise
Parameters
num_leafs_hthe width of the array of leafs of the tree
num_leafs_vthe height of the array of leafs of the tree
Returns
a new tag tree if successful, nullptr otherwise

References nodes, nodes_size, numleafsh, numleafsv, numnodes, grk::TagTreeNode::parent, and reset().

Referenced by grk::PrecinctImpl::initTagTrees().

◆ reset()

void grk::TagTree::reset ( )

Reset a tag tree (set all leaves to 0)

References nodes, numnodes, grk::tag_tree_uninitialized_node_value, and grk::TagTreeNode::value.

Referenced by init(), and TagTree().

◆ setvalue()

void grk::TagTree::setvalue ( uint64_t  leafno,
int64_t  value 
)

Set the value of a leaf of a tag tree.

Parameters
leafnoNumber that identifies the leaf to modify
valueNew value of the leaf

References nodes, and grk::TagTreeNode::value.

Member Data Documentation

◆ nodes

TagTreeNode* grk::TagTree::nodes
private

◆ nodes_size

uint64_t grk::TagTree::nodes_size
private

Referenced by init(), and TagTree().

◆ numleafsh

uint64_t grk::TagTree::numleafsh
private

Referenced by init(), and TagTree().

◆ numleafsv

uint64_t grk::TagTree::numleafsv
private

Referenced by init(), and TagTree().

◆ numnodes

uint64_t grk::TagTree::numnodes
private

Referenced by init(), reset(), and TagTree().


The documentation for this class was generated from the following files: