mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Friends
m::Tuple Struct Reference

#include <Tuple.hpp>

Collaboration diagram for m::Tuple:
[legend]

Public Member Functions

 Tuple (const Schema &S)
 Create a fresh Tuple with enough memory allocated to store all attributes of S.
 
 Tuple (std::vector< const Type * > types)
 
 Tuple ()
 
 Tuple (const Tuple &)=delete
 
 Tuple (Tuple &&other)
 
 ~Tuple ()
 
Tupleoperator= (const Tuple &)=delete
 
Tupleoperator= (Tuple &&other)
 
bool is_null (std::size_t idx) const
 Returns true iff the Value at index idx is NULL.
 
void null (std::size_t idx)
 Sets the Value at index idx to NULL.
 
void clear ()
 Sets all Values of this Tuple to NULL.
 
void not_null (std::size_t idx)
 Sets the Value at index idx to not-NULL.
 
void set (std::size_t idx, Value val)
 Assigns the Value val to this Tuple at index idx and clears the respective NULL bit.
 
void set (std::size_t idx, Value val, bool is_null)
 Assigns the Value val to this Tuple at index idx and sets the respective NULL bit to is_null.
 
Valueoperator[] (std::size_t idx)
 Returns a reference to the Value at index idx.
 
const Valueoperator[] (std::size_t idx) const
 Returns the Value at index idx.
 
Valueget (std::size_t idx)
 Returns a reference to the Value at index idx.
 
const Valueget (std::size_t idx) const
 Returns a reference to the Value at index idx.
 
void insert (const Tuple &other, std::size_t pos, std::size_t len)
 Inserts the Tuple other of length len into this Tuple starting at index pos.
 
Tuple clone (const Schema &S) const
 Create a clone of this Tuple interpreted using the Schema S.
 
M_LCOV_EXCL_STOP bool operator== (const Tuple &other) const
 
bool operator!= (const Tuple &other) const
 
void print (std::ostream &out, const Schema &schema) const
 Print this Tuple using the given schema.
 
void dump (std::ostream &out) const
 
void dump () const
 

Private Attributes

Valuevalues_ = nullptr
 the Values in this Tuple
 
SmallBitset null_mask_ = SmallBitset(-1UL)
 a bit mask for the NULL values; 1 represents NULL
 

Friends

void swap (Tuple &first, Tuple &second)
 
M_LCOV_EXCL_START friend std::ostream & operator<< (std::ostream &out, const Tuple &tup)
 

Detailed Description

Definition at line 180 of file Tuple.hpp.

Constructor & Destructor Documentation

◆ Tuple() [1/5]

M_LCOV_EXCL_STOP Tuple::Tuple ( const Schema S)
explicit

Create a fresh Tuple with enough memory allocated to store all attributes of S.

This includes allocation of memory to store character sequences within the Tuple.

Definition at line 77 of file Tuple.cpp.

◆ Tuple() [2/5]

Tuple::Tuple ( std::vector< const Type * >  types)
explicit

Definition at line 101 of file Tuple.cpp.

◆ Tuple() [3/5]

m::Tuple::Tuple ( )
inline

Definition at line 209 of file Tuple.hpp.

◆ Tuple() [4/5]

m::Tuple::Tuple ( const Tuple )
delete

◆ Tuple() [5/5]

m::Tuple::Tuple ( Tuple &&  other)
inline

Definition at line 211 of file Tuple.hpp.

References m::swap().

◆ ~Tuple()

m::Tuple::~Tuple ( )
inline

Definition at line 213 of file Tuple.hpp.

Member Function Documentation

◆ clear()

void m::Tuple::clear ( )
inline

Sets all Values of this Tuple to NULL.

Definition at line 231 of file Tuple.hpp.

Referenced by m::wasm::detail::read_result_set().

◆ clone()

Tuple Tuple::clone ( const Schema S) const

Create a clone of this Tuple interpreted using the Schema S.

Definition at line 124 of file Tuple.cpp.

References not_null(), m::Schema::num_entries(), and set().

◆ dump() [1/2]

void Tuple::dump ( ) const

Definition at line 151 of file Tuple.cpp.

References dump().

Referenced by dump().

◆ dump() [2/2]

void Tuple::dump ( std::ostream &  out) const

Definition at line 150 of file Tuple.cpp.

◆ get() [1/2]

Value & m::Tuple::get ( std::size_t  idx)
inline

Returns a reference to the Value at index idx.

Must not be NULL.

Definition at line 263 of file Tuple.hpp.

References INBOUNDS, and M_insist.

Referenced by m::idx::ArrayIndex< Key >::bulkload(), and operator==().

◆ get() [2/2]

const Value & m::Tuple::get ( std::size_t  idx) const
inline

Returns a reference to the Value at index idx.

Must not be NULL.

Definition at line 271 of file Tuple.hpp.

References get().

Referenced by get().

◆ insert()

void m::Tuple::insert ( const Tuple other,
std::size_t  pos,
std::size_t  len 
)
inline

Inserts the Tuple other of length len into this Tuple starting at index pos.

Definition at line 274 of file Tuple.hpp.

References is_null().

◆ is_null()

bool m::Tuple::is_null ( std::size_t  idx) const
inline

Returns true iff the Value at index idx is NULL.

Definition at line 219 of file Tuple.hpp.

References INBOUNDS.

Referenced by insert(), and print().

◆ not_null()

void m::Tuple::not_null ( std::size_t  idx)
inline

Sets the Value at index idx to not-NULL.

Definition at line 234 of file Tuple.hpp.

References INBOUNDS.

Referenced by clone().

◆ null()

void m::Tuple::null ( std::size_t  idx)
inline

Sets the Value at index idx to NULL.

Definition at line 225 of file Tuple.hpp.

References INBOUNDS.

Referenced by m::DSVReader::operator()(), and m::StackMachine::operator()().

◆ operator!=()

bool m::Tuple::operator!= ( const Tuple other) const
inline

Definition at line 311 of file Tuple.hpp.

◆ operator=() [1/2]

Tuple & m::Tuple::operator= ( const Tuple )
delete

◆ operator=() [2/2]

Tuple & m::Tuple::operator= ( Tuple &&  other)
inline

Definition at line 216 of file Tuple.hpp.

References m::swap().

◆ operator==()

M_LCOV_EXCL_STOP bool m::Tuple::operator== ( const Tuple other) const
inline

Definition at line 302 of file Tuple.hpp.

References get(), and null_mask_.

◆ operator[]() [1/2]

Value & m::Tuple::operator[] ( std::size_t  idx)
inline

Returns a reference to the Value at index idx.

Ignores the respective NULL bit.

Definition at line 254 of file Tuple.hpp.

References INBOUNDS.

◆ operator[]() [2/2]

const Value & m::Tuple::operator[] ( std::size_t  idx) const
inline

Returns the Value at index idx.

Ignores the respective NULL bit.

Definition at line 260 of file Tuple.hpp.

◆ print()

M_LCOV_EXCL_START void Tuple::print ( std::ostream &  out,
const Schema schema 
) const

Print this Tuple using the given schema.

Definition at line 139 of file Tuple.cpp.

References is_null(), m::Schema::num_entries(), m::Value::print(), and values_.

◆ set() [1/2]

void m::Tuple::set ( std::size_t  idx,
Value  val 
)
inline

Assigns the Value val to this Tuple at index idx and clears the respective NULL bit.

Definition at line 240 of file Tuple.hpp.

References INBOUNDS.

Referenced by clone(), m::InsertRecords::execute(), m::DSVReader::operator()(), m::StackMachine::operator()(), and m::wasm::detail::read_result_set().

◆ set() [2/2]

void m::Tuple::set ( std::size_t  idx,
Value  val,
bool  is_null 
)
inline

Assigns the Value val to this Tuple at index idx and sets the respective NULL bit to is_null.

Definition at line 247 of file Tuple.hpp.

References INBOUNDS.

Friends And Related Function Documentation

◆ operator<<

M_LCOV_EXCL_START friend std::ostream & operator<< ( std::ostream &  out,
const Tuple tup 
)
friend

Definition at line 283 of file Tuple.hpp.

◆ swap

void swap ( Tuple first,
Tuple second 
)
friend

Definition at line 184 of file Tuple.hpp.

Field Documentation

◆ null_mask_

SmallBitset m::Tuple::null_mask_ = SmallBitset(-1UL)
private

a bit mask for the NULL values; 1 represents NULL

Definition at line 195 of file Tuple.hpp.

Referenced by std::hash< m::Tuple >::operator()(), and operator==().

◆ values_

Value* m::Tuple::values_ = nullptr
private

the Values in this Tuple

Definition at line 194 of file Tuple.hpp.

Referenced by print().


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