matador::basic_table Class Referenceabstract

Base class for kind of tables. More...

#include <basic_table.hpp>

Inherited by matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.

Public Types

typedef std::shared_ptr< basic_tabletable_ptr
 
typedef std::unordered_map< std::string, table_ptrt_table_map
 
typedef std::unordered_map< std::string, detail::t_identifier_multimap > t_relation_item_map
 
typedef std::unordered_map< std::string, std::shared_ptr< detail::basic_relation_data > > t_relation_data_map
 

Public Member Functions

 basic_table (prototype_node &node, persistence &p)
 Creates a basic_table.
 
std::string name () const
 Returns the name of the table.
 
virtual void create (connection &conn)=0
 Interface for creating a table.
 
virtual void drop (connection &conn)=0
 Interface for droping a table.
 
virtual void load (object_store &p)=0
 Interface for loading a table.
 
virtual void insert (object_proxy *proxy)=0
 Interface for inserting an object.
 
virtual void update (object_proxy *proxy)=0
 Interface for updating an object.
 
virtual void remove (object_proxy *proxy)=0
 Interface for deleting an object.
 
bool is_loaded () const
 Returns true if the table is laready loaded.
 
prototype_nodenode ()
 Returns the underlaying prototype node.
 
const prototype_nodenode () const
 Returns the underlaying prototype node.
 
virtual void reset ()
 Marks the table as not loaded.
 
persistencepersistence_unit ()
 Access the underlaying persistence unit object.
 
const persistencepersistence_unit () const
 Access the underlaying persistence unit object.
 

Detailed Description

Base class for kind of tables.

This class acts as a base class for all kind of tables (common table and relation table)

Member Typedef Documentation

◆ t_relation_data_map

typedef std::unordered_map<std::string, std::shared_ptr<detail::basic_relation_data> > matador::basic_table::t_relation_data_map

Shortcut to unordered relation data map

◆ t_relation_item_map

typedef std::unordered_map<std::string, detail::t_identifier_multimap> matador::basic_table::t_relation_item_map

Shortcut to an unordered identifier multimap

◆ t_table_map

typedef std::unordered_map<std::string, table_ptr> matador::basic_table::t_table_map

Shortcut to an unordered map of table shared pointer

◆ table_ptr

typedef std::shared_ptr<basic_table> matador::basic_table::table_ptr

Shortcut to table shared pointer

Constructor & Destructor Documentation

◆ basic_table()

matador::basic_table::basic_table ( prototype_node node,
persistence p 
)

Creates a basic_table.

Creates a basic_table for the given prototype_node and the persistence object

Parameters
nodeThe underlying prototype_node
pThe underlying persistence object

Member Function Documentation

◆ create()

virtual void matador::basic_table::create ( connection conn)
pure virtual

Interface for creating a table.

Interface for creating a table for the given database connection.

Parameters
connThe database connection

Implemented in matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.

◆ drop()

virtual void matador::basic_table::drop ( connection conn)
pure virtual

Interface for droping a table.

Interface for droping a table for the given database connection.

Parameters
connThe database connection

Implemented in matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.

◆ insert()

virtual void matador::basic_table::insert ( object_proxy *  proxy)
pure virtual

Interface for inserting an object.

Interface for inserting an object represented by the given object_proxy

Parameters
proxyThe proxy representing the object to be inserted

Implemented in matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.

◆ is_loaded()

bool matador::basic_table::is_loaded ( ) const

Returns true if the table is laready loaded.

Returns
True if the table is laready loaded

◆ load()

virtual void matador::basic_table::load ( object_store p)
pure virtual

Interface for loading a table.

Interface for loading a table into the given object_store.

Parameters
pThe object_store to load the table into

Implemented in matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.

◆ name()

std::string matador::basic_table::name ( ) const

Returns the name of the table.

Returns
The name of the table

◆ node() [1/2]

prototype_node & matador::basic_table::node ( )

Returns the underlaying prototype node.

Returns
The underlaying prototype node

◆ node() [2/2]

const prototype_node & matador::basic_table::node ( ) const

Returns the underlaying prototype node.

Returns
The underlaying prototype node

◆ persistence_unit() [1/2]

persistence & matador::basic_table::persistence_unit ( )

Access the underlaying persistence unit object.

Returns
The underlaying persistence unit object

◆ persistence_unit() [2/2]

const persistence & matador::basic_table::persistence_unit ( ) const

Access the underlaying persistence unit object.

Returns
The underlaying persistence unit object

◆ remove()

virtual void matador::basic_table::remove ( object_proxy *  proxy)
pure virtual

Interface for deleting an object.

Interface for deleting an object represented by the given object_proxy

Parameters
proxyThe proxy representing the object to be deleted

Implemented in matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.

◆ reset()

virtual void matador::basic_table::reset ( )
virtual

◆ update()

virtual void matador::basic_table::update ( object_proxy *  proxy)
pure virtual

Interface for updating an object.

Interface for updating an object represented by the given object_proxy

Parameters
proxyThe proxy representing the object to be updated

Implemented in matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.


The documentation for this class was generated from the following file:
  • matador/orm/basic_table.hpp