mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Friends
m::Block< N > Struct Template Reference

A block of size N contains N tuples. More...

#include <Interpreter.hpp>

Collaboration diagram for m::Block< N >:
[legend]

Data Structures

struct  the_iterator
 

Public Types

using iterator = the_iterator< false >
 
using const_iterator = the_iterator< true >
 

Public Member Functions

 Block ()=default
 
 Block (const Block &)=delete
 
 Block (Block &&)=delete
 
 Block (Schema schema)
 Create a new Block with tuples of Schema schema.
 
Tupledata ()
 Return a pointer to the underlying array of tuples.
 
const Tupledata () const
 Return a pointer to the underlying array of tuples.
 
const Schemaschema () const
 
std::size_t size () const
 Return the number of alive tuples in this Block.
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
iterator at (std::size_t index)
 Returns an iterator to the tuple at index index.
 
const_iterator at (std::size_t index) const
 Returns an iterator to the tuple at index index.
 
bool alive (std::size_t index) const
 Check whether the tuple at the given index is alive.
 
bool empty () const
 Returns true iff the block has no alive tuples, i.e. size() == 0.
 
uint64_t mask () const
 Returns the bit mask that identifies which tuples of this Block are alive.
 
void mask (uint64_t new_mask)
 Returns the bit mask that identifies which tuples of this Block are alive.
 
Tupleoperator[] (std::size_t index)
 Returns the tuple at index index.
 
const Tupleoperator[] (std::size_t index) const
 Returns the tuple at index index.
 
void fill ()
 Make all tuples in this Block alive.
 
void erase (std::size_t index)
 Erase the tuple at the given index from this Block.
 
void erase (iterator it)
 Erase the tuple identified by it from this Block.
 
void erase (const_iterator it)
 Erase the tuple identified by it from this Block.
 
void clear ()
 Renders all tuples dead and removes their attributes.
 
void dump (std::ostream &out) const
 
void dump () const
 

Static Public Member Functions

static constexpr std::size_t capacity ()
 Return the capacity of this Block.
 

Static Public Attributes

static constexpr std::size_t CAPACITY = N
 the capacity of a block
 

Static Private Member Functions

static constexpr uint64_t AllOnes ()
 Returns a bit vector with left-most capacity() many bits set to 1 and the others set to 0.
 

Private Attributes

std::array< Tuple, N > data_
 an array of the tuples of this Block; some slots may be unused
 
uint64_t mask_ = 0x0
 a mast identifying which slots of data_ are in use
 
Schema schema_
 

Friends

M_LCOV_EXCL_START friend std::ostream & operator<< (std::ostream &out, const Block< N > &block)
 Print a textual representation of this Block to out.
 

Detailed Description

template<std::size_t N>
struct m::Block< N >

A block of size N contains N tuples.


Definition at line 19 of file Interpreter.hpp.

Member Typedef Documentation

◆ const_iterator

template<std::size_t N>
using m::Block< N >::const_iterator = the_iterator<true>

Definition at line 57 of file Interpreter.hpp.

◆ iterator

template<std::size_t N>
using m::Block< N >::iterator = the_iterator<false>

Definition at line 56 of file Interpreter.hpp.

Constructor & Destructor Documentation

◆ Block() [1/4]

template<std::size_t N>
m::Block< N >::Block ( )
default

◆ Block() [2/4]

template<std::size_t N>
m::Block< N >::Block ( const Block< N > &  )
delete

◆ Block() [3/4]

template<std::size_t N>
m::Block< N >::Block ( Block< N > &&  )
delete

◆ Block() [4/4]

template<std::size_t N>
m::Block< N >::Block ( Schema  schema)
inline

Create a new Block with tuples of Schema schema.

Definition at line 71 of file Interpreter.hpp.

References m::Block< N >::data_, and m::Block< N >::schema_.

Member Function Documentation

◆ alive()

template<std::size_t N>
bool m::Block< N >::alive ( std::size_t  index) const
inline

Check whether the tuple at the given index is alive.

Definition at line 106 of file Interpreter.hpp.

References m::Block< N >::capacity(), M_insist, and m::Block< N >::mask_.

Referenced by m::Block< N >::operator[]().

◆ AllOnes()

template<std::size_t N>
static constexpr uint64_t m::Block< N >::AllOnes ( )
inlinestaticconstexprprivate

Returns a bit vector with left-most capacity() many bits set to 1 and the others set to 0.


Definition at line 121 of file Interpreter.hpp.

References m::Block< N >::capacity(), and m::Block< N >::mask_.

Referenced by m::Block< N >::fill().

◆ at() [1/2]

template<std::size_t N>
iterator m::Block< N >::at ( std::size_t  index)
inline

Returns an iterator to the tuple at index index.

Definition at line 98 of file Interpreter.hpp.

References m::Block< N >::capacity(), M_insist, and m::Block< N >::mask_.

◆ at() [2/2]

template<std::size_t N>
const_iterator m::Block< N >::at ( std::size_t  index) const
inline

Returns an iterator to the tuple at index index.

Definition at line 103 of file Interpreter.hpp.

References m::Block< N >::at().

Referenced by m::Block< N >::at().

◆ begin() [1/2]

template<std::size_t N>
iterator m::Block< N >::begin ( )
inline

Definition at line 90 of file Interpreter.hpp.

References m::Block< N >::mask_.

◆ begin() [2/2]

template<std::size_t N>
const_iterator m::Block< N >::begin ( ) const
inline

Definition at line 92 of file Interpreter.hpp.

References m::Block< N >::mask_.

◆ capacity()

template<std::size_t N>
static constexpr std::size_t m::Block< N >::capacity ( )
inlinestaticconstexpr

◆ cbegin()

template<std::size_t N>
const_iterator m::Block< N >::cbegin ( ) const
inline

Definition at line 94 of file Interpreter.hpp.

References m::Block< N >::mask_.

◆ cend()

template<std::size_t N>
const_iterator m::Block< N >::cend ( ) const
inline

Definition at line 95 of file Interpreter.hpp.

◆ clear()

template<std::size_t N>
void m::Block< N >::clear ( )
inline

Renders all tuples dead and removes their attributes.

Definition at line 147 of file Interpreter.hpp.

References m::Block< N >::data_, and m::Block< N >::mask_.

Referenced by m::Pipeline::clear().

◆ data() [1/2]

template<std::size_t N>
Tuple * m::Block< N >::data ( )
inline

Return a pointer to the underlying array of tuples.

Definition at line 79 of file Interpreter.hpp.

References m::Block< N >::data_.

◆ data() [2/2]

template<std::size_t N>
const Tuple * m::Block< N >::data ( ) const
inline

Return a pointer to the underlying array of tuples.

Definition at line 81 of file Interpreter.hpp.

References m::Block< N >::data_.

◆ dump() [1/2]

template<std::size_t N>
void m::Block< N >::dump ( ) const
inline

Definition at line 173 of file Interpreter.hpp.

References m::Block< N >::dump().

Referenced by m::Block< N >::dump().

◆ dump() [2/2]

template<std::size_t N>
void m::Block< N >::dump ( std::ostream &  out) const
inline

Definition at line 168 of file Interpreter.hpp.

◆ empty()

template<std::size_t N>
bool m::Block< N >::empty ( ) const
inline

Returns true iff the block has no alive tuples, i.e. size() == 0.

Definition at line 112 of file Interpreter.hpp.

References m::Block< N >::size().

◆ end() [1/2]

template<std::size_t N>
iterator m::Block< N >::end ( )
inline

Definition at line 91 of file Interpreter.hpp.

◆ end() [2/2]

template<std::size_t N>
const_iterator m::Block< N >::end ( ) const
inline

Definition at line 93 of file Interpreter.hpp.

◆ erase() [1/3]

template<std::size_t N>
void m::Block< N >::erase ( const_iterator  it)
inline

Erase the tuple identified by it from this Block.

Definition at line 144 of file Interpreter.hpp.

References m::Block< N >::erase(), and m::Block< N >::the_iterator< C >::index().

Referenced by m::Block< N >::erase().

◆ erase() [2/3]

template<std::size_t N>
void m::Block< N >::erase ( iterator  it)
inline

Erase the tuple identified by it from this Block.

Definition at line 142 of file Interpreter.hpp.

References m::Block< N >::erase(), and m::Block< N >::the_iterator< C >::index().

Referenced by m::Block< N >::erase().

◆ erase() [3/3]

template<std::size_t N>
void m::Block< N >::erase ( std::size_t  index)
inline

Erase the tuple at the given index from this Block.

Definition at line 137 of file Interpreter.hpp.

References m::Block< N >::capacity(), M_insist, m::Block< N >::mask_, and m::setbit().

◆ fill()

template<std::size_t N>
void m::Block< N >::fill ( )
inline

Make all tuples in this Block alive.

Definition at line 134 of file Interpreter.hpp.

References m::Block< N >::AllOnes(), m::Block< N >::capacity(), M_insist, m::Block< N >::mask_, and m::Block< N >::size().

◆ mask() [1/2]

template<std::size_t N>
uint64_t m::Block< N >::mask ( ) const
inline

Returns the bit mask that identifies which tuples of this Block are alive.

Definition at line 115 of file Interpreter.hpp.

References m::Block< N >::mask_.

Referenced by m::Pipeline::Pipeline().

◆ mask() [2/2]

template<std::size_t N>
void m::Block< N >::mask ( uint64_t  new_mask)
inline

Returns the bit mask that identifies which tuples of this Block are alive.

Definition at line 117 of file Interpreter.hpp.

References m::Block< N >::mask_.

◆ operator[]() [1/2]

template<std::size_t N>
Tuple & m::Block< N >::operator[] ( std::size_t  index)
inline

Returns the tuple at index index.

The tuple must be alive!

Definition at line 125 of file Interpreter.hpp.

References m::Block< N >::alive(), m::Block< N >::capacity(), m::Block< N >::data_, and M_insist.

◆ operator[]() [2/2]

template<std::size_t N>
const Tuple & m::Block< N >::operator[] ( std::size_t  index) const
inline

Returns the tuple at index index.

The tuple must be alive!

Definition at line 131 of file Interpreter.hpp.

◆ schema()

template<std::size_t N>
const Schema & m::Block< N >::schema ( ) const
inline

Definition at line 83 of file Interpreter.hpp.

References m::Block< N >::schema_.

Referenced by m::Pipeline::schema().

◆ size()

template<std::size_t N>
std::size_t m::Block< N >::size ( ) const
inline

Return the number of alive tuples in this Block.

Definition at line 88 of file Interpreter.hpp.

References m::Block< N >::mask_.

Referenced by m::Block< N >::empty(), and m::Block< N >::fill().

Friends And Related Function Documentation

◆ operator<<

template<std::size_t N>
M_LCOV_EXCL_START friend std::ostream & operator<< ( std::ostream &  out,
const Block< N > &  block 
)
friend

Print a textual representation of this Block to out.

Definition at line 155 of file Interpreter.hpp.

Field Documentation

◆ CAPACITY

template<std::size_t N>
constexpr std::size_t m::Block< N >::CAPACITY = N
staticconstexpr

the capacity of a block

Definition at line 21 of file Interpreter.hpp.

Referenced by m::Block< N >::capacity().

◆ data_

template<std::size_t N>
std::array<Tuple, N> m::Block< N >::data_
private

an array of the tuples of this Block; some slots may be unused

Definition at line 60 of file Interpreter.hpp.

Referenced by m::Block< N >::Block(), m::Block< N >::clear(), m::Block< N >::data(), and m::Block< N >::operator[]().

◆ mask_

template<std::size_t N>
uint64_t m::Block< N >::mask_ = 0x0
private

◆ schema_

template<std::size_t N>
Schema m::Block< N >::schema_
private

Definition at line 63 of file Interpreter.hpp.

Referenced by m::Block< N >::Block(), and m::Block< N >::schema().


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