dejavu
Fast probabilistic symmetry detection.
Loading...
Searching...
No Matches
dejavu::ds::worklist_t< T > Class Template Reference

Fixed-size array, uninitialized. More...

#include <ds.h>

Public Member Functions

 worklist_t ()=default
 
 worklist_t (const worklist_t< T > &other)
 
 worklist_t (const worklist_t< T > &&other)
 
worklist_t< T > & operator= (const worklist_t< T > &other)
 
 worklist_t (int size)
 
void swap (worklist_t< T > &other)
 
void copy (const worklist_t< T > *other)
 
void allocate (int size)
 
void push_back (T value)
 
pop_back ()
 
T * last () const
 
dej_nodiscard bool empty () const
 
void set_size (const int size)
 
dej_nodiscard int size () const
 
void reset ()
 
int max ()
 
void resize (const int size)
 
 ~worklist_t ()
 
void sort ()
 
T * get_array () const
 
T & operator[] (int index) const
 
void sort_after_map (T *map)
 

Public Attributes

int cur_pos = 0
 

Detailed Description

template<class T>
class dejavu::ds::worklist_t< T >

Fixed-size array, uninitialized.

An array of fixed size, with some further convenience functions.

Template Parameters
TThe type of array elements.

Definition at line 90 of file ds.h.

Constructor & Destructor Documentation

◆ worklist_t() [1/4]

template<class T >
dejavu::ds::worklist_t< T >::worklist_t ( )
default

Default constructor, does not allocate any memory.

◆ worklist_t() [2/4]

template<class T >
dejavu::ds::worklist_t< T >::worklist_t ( const worklist_t< T > &  other)
inline

Definition at line 114 of file ds.h.

◆ worklist_t() [3/4]

template<class T >
dejavu::ds::worklist_t< T >::worklist_t ( const worklist_t< T > &&  other)
inline

Definition at line 118 of file ds.h.

◆ worklist_t() [4/4]

template<class T >
dejavu::ds::worklist_t< T >::worklist_t ( int  size)
inlineexplicit

Constructor that allocates the internal array with size size. The allocated memory is not initialized.

Parameters
sizeSize to allocate.

Definition at line 134 of file ds.h.

◆ ~worklist_t()

template<class T >
dejavu::ds::worklist_t< T >::~worklist_t ( )
inline

Deallocates the internal array.

Definition at line 266 of file ds.h.

Member Function Documentation

◆ allocate()

template<class T >
void dejavu::ds::worklist_t< T >::allocate ( int  size)
inline

Allocates the internal array with size size. The allocated memory is not initialized. Initializes the internal position cur_pos of the array at 0.

Parameters
sizeSize to allocate.

Definition at line 166 of file ds.h.

◆ copy()

template<class T >
void dejavu::ds::worklist_t< T >::copy ( const worklist_t< T > *  other)
inline

Definition at line 151 of file ds.h.

◆ empty()

template<class T >
dej_nodiscard bool dejavu::ds::worklist_t< T >::empty ( ) const
inline
Returns
Whether cur_pos == 0.

Definition at line 206 of file ds.h.

◆ get_array()

template<class T >
T * dejavu::ds::worklist_t< T >::get_array ( ) const
inline
Returns
A pointer to the internal memory.

Definition at line 280 of file ds.h.

◆ last()

template<class T >
T * dejavu::ds::worklist_t< T >::last ( ) const
inline
Returns
Element at cur_pos.

Definition at line 199 of file ds.h.

◆ max()

template<class T >
int dejavu::ds::worklist_t< T >::max ( )
inline

Definition at line 233 of file ds.h.

◆ operator=()

template<class T >
worklist_t< T > & dejavu::ds::worklist_t< T >::operator= ( const worklist_t< T > &  other)
inline

Definition at line 122 of file ds.h.

◆ operator[]()

template<class T >
T & dejavu::ds::worklist_t< T >::operator[] ( int  index) const
inline

Access element index in the internal array arr.

Parameters
indexIndex of the internal array.
Returns
The element arr[index].

Definition at line 290 of file ds.h.

◆ pop_back()

template<class T >
T dejavu::ds::worklist_t< T >::pop_back ( )
inline

Pop an element at position cur_pos. Decreases the internal position cur_pos. There is no safeguard in place if cur_pos <= 0.

Returns
Element popped at cur_pos.
See also
The function empty() tests whether cur_pos == 0.

Definition at line 191 of file ds.h.

◆ push_back()

template<class T >
void dejavu::ds::worklist_t< T >::push_back ( value)
inline

Push back an element at position cur_pos. Increments the internal position cur_pos.

Parameters
valueElement to push back.

Definition at line 177 of file ds.h.

◆ reset()

template<class T >
void dejavu::ds::worklist_t< T >::reset ( )
inline

Sets cur_pos to 0.

Definition at line 229 of file ds.h.

◆ resize()

template<class T >
void dejavu::ds::worklist_t< T >::resize ( const int  size)
inline

Resizes the internal array to size. Copies the contents of the old array into the new one. If the new size is larger than the old one, the new space is only allocated and not initialized.

Parameters
sizeNew size to allocate the array to.

Definition at line 248 of file ds.h.

◆ set_size()

template<class T >
void dejavu::ds::worklist_t< T >::set_size ( const int  size)
inline

Sets cur_pos to size.

Parameters
sizeValue to set cur_pos to.

Definition at line 215 of file ds.h.

◆ size()

template<class T >
dej_nodiscard int dejavu::ds::worklist_t< T >::size ( ) const
inline
Returns
The current position cur_pos.

Definition at line 222 of file ds.h.

◆ sort()

template<class T >
void dejavu::ds::worklist_t< T >::sort ( )
inline

Sort the internal array up to position cur_pos.

Definition at line 273 of file ds.h.

◆ sort_after_map()

template<class T >
void dejavu::ds::worklist_t< T >::sort_after_map ( T *  map)
inline

Definition at line 296 of file ds.h.

◆ swap()

template<class T >
void dejavu::ds::worklist_t< T >::swap ( worklist_t< T > &  other)
inline

Definition at line 139 of file ds.h.

Member Data Documentation

◆ cur_pos

template<class T >
int dejavu::ds::worklist_t< T >::cur_pos = 0

current position

Definition at line 312 of file ds.h.


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