mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Types | Private Attributes
m::ConcreteTable Struct Referenceabstract

Basic implementation of Table. More...

#include <Schema.hpp>

Inheritance diagram for m::ConcreteTable:
[legend]
Collaboration diagram for m::ConcreteTable:
[legend]

Public Types

using iterator = the_iterator< true, false >
 
using hidden_iterator = the_iterator< false, true >
 
using all_iterator = the_iterator< true, true >
 

Public Member Functions

 ConcreteTable (ThreadSafePooledString name)
 
virtual ~ConcreteTable ()=default
 
std::size_t num_attrs () const override
 Returns the number of non-hidden attributes in this table.
 
std::size_t num_hidden_attrs () const override
 Returns the number of hidden attributes in this table.
 
std::size_t num_all_attrs () const override
 Returns the number of attributes in this table.
 
virtual iterator begin () const override
 
virtual iterator end () const override
 
virtual iterator cbegin () const override
 
virtual iterator cend () const override
 
virtual hidden_iterator begin_hidden () const override
 
virtual hidden_iterator end_hidden () const override
 
virtual hidden_iterator cbegin_hidden () const override
 
virtual hidden_iterator cend_hidden () const override
 
virtual all_iterator begin_all () const override
 
virtual all_iterator end_all () const override
 
virtual all_iterator cbegin_all () const override
 
virtual all_iterator cend_all () const override
 
Attributeat (std::size_t id) override
 Returns the attribute with the given id.
 
const Attributeat (std::size_t id) const override
 
Attributeoperator[] (std::size_t id) override
 Returns the attribute with the given id.
 
const Attributeoperator[] (std::size_t id) const override
 
Attributeat (const ThreadSafePooledString &name) override
 Returns the attribute with the given name.
 
const Attributeat (const ThreadSafePooledString &name) const override
 
Attributeoperator[] (const ThreadSafePooledString &name) override
 Returns the attribute with the given name.
 
const Attributeoperator[] (const ThreadSafePooledString &name) const override
 
bool has_attribute (const ThreadSafePooledString &name) const override
 Returns true iff the table has an attribute name.
 
bool operator== (const Table &other) override
 Returns true iff the Table other is the same as this, false otherwise.
 
bool operator== (const Table &other) const override
 
const ThreadSafePooledStringname () const override
 Returns the name of the Table.
 
Storestore () const override
 Returns a reference to the backing store.
 
void store (std::unique_ptr< Store > new_store) override
 Sets the backing store for this table.
 
const storage::DataLayoutlayout () const override
 Returns a reference to the physical data layout.
 
void layout (storage::DataLayout &&new_layout) override
 Sets the physical data layout for this table.
 
virtual void layout (const storage::DataLayoutFactory &factory) override
 Sets the physical data layout for this table by calling factory.make().
 
std::vector< std::reference_wrapper< const Attribute > > primary_key () const override
 Returns all attributes forming the primary key.
 
void add_primary_key (const ThreadSafePooledString &name) override
 Adds an attribute with the given name to the primary key of this table.
 
void push_back (ThreadSafePooledString name, const PrimitiveType *type) override
 Adds a new attribute with the given name and type to the table.
 
Schema schema (const ThreadSafePooledOptionalString &alias={}) const override
 Returns a Schema for this Table given the alias alias.
 
size_t convert_id (size_t id) override
 Converts the id an non-hidden attribute would have in a table without any hidden attributes and returns the actual id of that attribute.
 
virtual void dump (std::ostream &out) const override
 
virtual void dump () const override
 
virtual Schema schema (const ThreadSafePooledOptionalString &alias={}) const =0
 Returns a Schema for this Table given the alias alias.
 

Protected Types

using table_type = std::vector< Attribute >
 

Private Attributes

ThreadSafePooledString name_
 the name of the table
 
table_type attrs_
 the attributes of this table, maintained as a sorted set
 
std::unordered_map< ThreadSafePooledString, table_type::size_type > name_to_attr_
 maps attribute names to attributes
 
std::unique_ptr< Storestore_
 the store backing this table; may be nullptr
 
storage::DataLayout layout_
 the physical data layout for this table
 
SmallBitset primary_key_
 the primary key of this table, maintained as a SmallBitset over attribute id's
 

Detailed Description

Basic implementation of Table.

Definition at line 609 of file Schema.hpp.

Member Typedef Documentation

◆ all_iterator

using m::Table::all_iterator = the_iterator<true, true>
inherited

Definition at line 524 of file Schema.hpp.

◆ hidden_iterator

using m::Table::hidden_iterator = the_iterator<false, true>
inherited

Definition at line 523 of file Schema.hpp.

◆ iterator

using m::Table::iterator = the_iterator<true, false>
inherited

Definition at line 522 of file Schema.hpp.

◆ table_type

using m::Table::table_type = std::vector<Attribute>
protectedinherited

Definition at line 390 of file Schema.hpp.

Constructor & Destructor Documentation

◆ ConcreteTable()

m::ConcreteTable::ConcreteTable ( ThreadSafePooledString  name)
inline

Definition at line 620 of file Schema.hpp.

◆ ~ConcreteTable()

virtual m::ConcreteTable::~ConcreteTable ( )
virtualdefault

Member Function Documentation

◆ add_primary_key()

void m::ConcreteTable::add_primary_key ( const ThreadSafePooledString name)
inlineoverridevirtual

Adds an attribute with the given name to the primary key of this table.

Throws std::out_of_range if no attribute with the given name exists.

Implements m::Table.

Definition at line 717 of file Schema.hpp.

◆ at() [1/4]

const Attribute & m::ConcreteTable::at ( const ThreadSafePooledString name) const
inlineoverridevirtual

Implements m::Table.

Definition at line 675 of file Schema.hpp.

References at().

Referenced by at().

◆ at() [2/4]

Attribute & m::ConcreteTable::at ( const ThreadSafePooledString name)
inlineoverridevirtual

Returns the attribute with the given name.

Throws std::out_of_range if no attribute with the given name exists.

Implements m::Table.

Definition at line 668 of file Schema.hpp.

References M_insist.

◆ at() [3/4]

const Attribute & m::ConcreteTable::at ( std::size_t  id) const
inlineoverridevirtual

Implements m::Table.

Definition at line 656 of file Schema.hpp.

References at().

Referenced by at().

◆ at() [4/4]

Attribute & m::ConcreteTable::at ( std::size_t  id)
inlineoverridevirtual

Returns the attribute with the given id.

Throws std::out_of_range if no attribute with the given id exists.

Implements m::Table.

Definition at line 649 of file Schema.hpp.

References id, and M_insist.

◆ begin()

virtual iterator m::ConcreteTable::begin ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 632 of file Schema.hpp.

◆ begin_all()

virtual all_iterator m::ConcreteTable::begin_all ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 642 of file Schema.hpp.

◆ begin_hidden()

virtual hidden_iterator m::ConcreteTable::begin_hidden ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 637 of file Schema.hpp.

◆ cbegin()

virtual iterator m::ConcreteTable::cbegin ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 634 of file Schema.hpp.

◆ cbegin_all()

virtual all_iterator m::ConcreteTable::cbegin_all ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 644 of file Schema.hpp.

◆ cbegin_hidden()

virtual hidden_iterator m::ConcreteTable::cbegin_hidden ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 639 of file Schema.hpp.

◆ cend()

virtual iterator m::ConcreteTable::cend ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 635 of file Schema.hpp.

◆ cend_all()

virtual all_iterator m::ConcreteTable::cend_all ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 645 of file Schema.hpp.

◆ cend_hidden()

virtual hidden_iterator m::ConcreteTable::cend_hidden ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 640 of file Schema.hpp.

◆ convert_id()

size_t m::ConcreteTable::convert_id ( size_t  id)
inlineoverridevirtual

Converts the id an non-hidden attribute would have in a table without any hidden attributes and returns the actual id of that attribute.

Implements m::Table.

Definition at line 736 of file Schema.hpp.

References id.

◆ dump() [1/2]

void ConcreteTable::dump ( ) const
overridevirtual

Implements m::Table.

Definition at line 115 of file Schema.cpp.

References m::Schema::dump().

◆ dump() [2/2]

M_LCOV_EXCL_START void ConcreteTable::dump ( std::ostream &  out) const
overridevirtual

Implements m::Table.

Definition at line 107 of file Schema.cpp.

◆ end()

virtual iterator m::ConcreteTable::end ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 633 of file Schema.hpp.

◆ end_all()

virtual all_iterator m::ConcreteTable::end_all ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 643 of file Schema.hpp.

◆ end_hidden()

virtual hidden_iterator m::ConcreteTable::end_hidden ( ) const
inlineoverridevirtual

Implements m::Table.

Definition at line 638 of file Schema.hpp.

◆ has_attribute()

bool m::ConcreteTable::has_attribute ( const ThreadSafePooledString name) const
inlineoverridevirtual

Returns true iff the table has an attribute name.

Implements m::Table.

Definition at line 681 of file Schema.hpp.

◆ layout() [1/3]

const storage::DataLayout & m::ConcreteTable::layout ( ) const
inlineoverridevirtual

Returns a reference to the physical data layout.

Implements m::Table.

Definition at line 702 of file Schema.hpp.

References M_insist.

◆ layout() [2/3]

void ConcreteTable::layout ( const storage::DataLayoutFactory factory)
overridevirtual

Sets the physical data layout for this table by calling factory.make().

Implements m::Table.

Definition at line 101 of file Schema.cpp.

References m::storage::DataLayoutFactory::make().

◆ layout() [3/3]

void m::ConcreteTable::layout ( storage::DataLayout &&  new_layout)
inlineoverridevirtual

Sets the physical data layout for this table.

Implements m::Table.

Definition at line 704 of file Schema.hpp.

◆ name()

const ThreadSafePooledString & m::ConcreteTable::name ( ) const
inlineoverridevirtual

Returns the name of the Table.

Implements m::Table.

Definition at line 694 of file Schema.hpp.

◆ num_all_attrs()

std::size_t m::ConcreteTable::num_all_attrs ( ) const
inlineoverridevirtual

Returns the number of attributes in this table.

Implements m::Table.

Definition at line 630 of file Schema.hpp.

◆ num_attrs()

std::size_t m::ConcreteTable::num_attrs ( ) const
inlineoverridevirtual

Returns the number of non-hidden attributes in this table.

Implements m::Table.

Definition at line 624 of file Schema.hpp.

◆ num_hidden_attrs()

std::size_t m::ConcreteTable::num_hidden_attrs ( ) const
inlineoverridevirtual

Returns the number of hidden attributes in this table.

Implements m::Table.

Definition at line 627 of file Schema.hpp.

◆ operator==() [1/2]

bool m::ConcreteTable::operator== ( const Table other) const
inlineoverridevirtual

Implements m::Table.

Definition at line 691 of file Schema.hpp.

◆ operator==() [2/2]

bool m::ConcreteTable::operator== ( const Table other)
inlineoverridevirtual

Returns true iff the Table other is the same as this, false otherwise.

Implements m::Table.

Definition at line 684 of file Schema.hpp.

References M_unreachable.

◆ operator[]() [1/4]

const Attribute & m::ConcreteTable::operator[] ( const ThreadSafePooledString name) const
inlineoverridevirtual

Implements m::Table.

Definition at line 678 of file Schema.hpp.

◆ operator[]() [2/4]

Attribute & m::ConcreteTable::operator[] ( const ThreadSafePooledString name)
inlineoverridevirtual

Returns the attribute with the given name.

Implements m::Table.

Definition at line 677 of file Schema.hpp.

References operator[]().

Referenced by operator[]().

◆ operator[]() [3/4]

const Attribute & m::ConcreteTable::operator[] ( std::size_t  id) const
inlineoverridevirtual

Implements m::Table.

Definition at line 664 of file Schema.hpp.

◆ operator[]() [4/4]

Attribute & m::ConcreteTable::operator[] ( std::size_t  id)
inlineoverridevirtual

Returns the attribute with the given id.

Implements m::Table.

Definition at line 658 of file Schema.hpp.

References id, and M_insist.

◆ primary_key()

std::vector< std::reference_wrapper< const Attribute > > m::ConcreteTable::primary_key ( ) const
inlineoverridevirtual

Returns all attributes forming the primary key.

Implements m::Table.

Definition at line 709 of file Schema.hpp.

◆ push_back()

void m::ConcreteTable::push_back ( ThreadSafePooledString  name,
const PrimitiveType type 
)
inlineoverridevirtual

Adds a new attribute with the given name and type to the table.

Throws std::invalid_argument if the name is already in use.

Implements m::Table.

Definition at line 724 of file Schema.hpp.

◆ schema() [1/2]

virtual Schema m::Table::schema ( const ThreadSafePooledOptionalString alias = {}) const
pure virtualinherited

Returns a Schema for this Table given the alias alias.

Implemented in m::TableDecorator.

Referenced by m::ScanOperator::ScanOperator().

◆ schema() [2/2]

M_LCOV_EXCL_STOP Schema ConcreteTable::schema ( const ThreadSafePooledOptionalString alias = {}) const
override

◆ store() [1/2]

Store & m::ConcreteTable::store ( ) const
inlineoverridevirtual

Returns a reference to the backing store.

Implements m::Table.

Definition at line 697 of file Schema.hpp.

◆ store() [2/2]

void m::ConcreteTable::store ( std::unique_ptr< Store new_store)
inlineoverridevirtual

Sets the backing store for this table.

new_store must not be nullptr.

Implements m::Table.

Definition at line 699 of file Schema.hpp.

References m::swap().

Field Documentation

◆ attrs_

table_type m::ConcreteTable::attrs_
private

the attributes of this table, maintained as a sorted set

Definition at line 613 of file Schema.hpp.

◆ layout_

storage::DataLayout m::ConcreteTable::layout_
private

the physical data layout for this table

Definition at line 616 of file Schema.hpp.

◆ name_

ThreadSafePooledString m::ConcreteTable::name_
private

the name of the table

Definition at line 612 of file Schema.hpp.

◆ name_to_attr_

std::unordered_map<ThreadSafePooledString, table_type::size_type> m::ConcreteTable::name_to_attr_
private

maps attribute names to attributes

Definition at line 614 of file Schema.hpp.

◆ primary_key_

SmallBitset m::ConcreteTable::primary_key_
private

the primary key of this table, maintained as a SmallBitset over attribute id's

Definition at line 617 of file Schema.hpp.

◆ store_

std::unique_ptr<Store> m::ConcreteTable::store_
private

the store backing this table; may be nullptr

Definition at line 615 of file Schema.hpp.


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