MDList
Public Member Functions | Private Attributes | List of all members
Node< T > Class Template Reference

Node class. More...

#include <mdlist.h>

Public Member Functions

 Node (ULL, int, ULL, T val=NULL)
 Node Class Constructor. More...
 
void lock ()
 Locks the node mutex. More...
 
bool try_lock ()
 Non blocking lock operation on node mutex. More...
 
void unlock ()
 Unlocks the node mutex. More...
 
ULL getKey ()
 Getter for key. More...
 
void setValue (T)
 Setter for value. More...
 
T getValue ()
 Getter for Value. More...
 
void setChild (int, Node *)
 Setter for child Node. More...
 
Node< T > * getChild (int)
 Getter for Child. More...
 
vector< int > getCoordinates ()
 Getter for Node coordinates. More...
 

Private Attributes

ULL key
 The key. More...
 
T val
 The value. More...
 
vector< int > COORDINATES
 The Node coordinates. More...
 
vector< Node * > child
 The vector of children of this Node. More...
 
std::mutex mutex
 Mutex lock for this Node. More...
 
std::mutex child_mutex
 Mutex lock for children. More...
 
std::mutex val_mutex
 Mutex lock for value. More...
 

Detailed Description

template<class T>
class Node< T >

Node class.

Each node has a key and coordinates in key space and it stores a value. It also has a mutex for thread safety in multi-threaded environment.

Constructor & Destructor Documentation

◆ Node()

template<class T >
Node< T >::Node ( ULL  key,
int  D,
ULL  N,
T  val = NULL 
)

Node Class Constructor.

Parameters
keyThe key.
DD value of MDList.
NThe key space.
valThe value (optional).

Member Function Documentation

◆ getChild()

template<class T >
Node< T > * Node< T >::getChild ( int  index)

Getter for Child.

Parameters
indexThe index of child.
Returns
The child.

◆ getCoordinates()

template<class T >
vector< int > Node< T >::getCoordinates ( )

Getter for Node coordinates.

Returns
The Node coordinates.

◆ getKey()

template<class T >
ULL Node< T >::getKey ( )

Getter for key.

Returns
The key of Node.

◆ getValue()

template<class T >
T Node< T >::getValue ( )

Getter for Value.

Returns
The value.

◆ lock()

template<class T >
void Node< T >::lock ( )

Locks the node mutex.

◆ setChild()

template<class T >
void Node< T >::setChild ( int  index,
Node< T > *  childNode 
)

Setter for child Node.

Parameters
indexThe index of Child.
childNodeThe child Node.

◆ setValue()

template<class T >
void Node< T >::setValue ( T  val)

Setter for value.

Parameters
valThe value.

◆ try_lock()

template<class T >
bool Node< T >::try_lock ( )

Non blocking lock operation on node mutex.

Returns
True if locked else False.

◆ unlock()

template<class T >
void Node< T >::unlock ( )

Unlocks the node mutex.

Member Data Documentation

◆ child

template<class T>
vector<Node*> Node< T >::child
private

The vector of children of this Node.

◆ child_mutex

template<class T>
std::mutex Node< T >::child_mutex
private

Mutex lock for children.

◆ COORDINATES

template<class T>
vector<int> Node< T >::COORDINATES
private

The Node coordinates.

This is constant for a given Node.

◆ key

template<class T>
ULL Node< T >::key
private

The key.

◆ mutex

template<class T>
std::mutex Node< T >::mutex
private

Mutex lock for this Node.

◆ val

template<class T>
T Node< T >::val
private

The value.

◆ val_mutex

template<class T>
std::mutex Node< T >::val_mutex
private

Mutex lock for value.


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