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_table > | table_ptr |
typedef std::unordered_map< std::string, table_ptr > | t_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_node & | node () |
Returns the underlaying prototype node. | |
const prototype_node & | node () const |
Returns the underlaying prototype node. | |
virtual void | reset () |
Marks the table as not loaded. | |
persistence & | persistence_unit () |
Access the underlaying persistence unit object. | |
const persistence & | persistence_unit () const |
Access the underlaying persistence unit object. | |
Base class for kind of tables.
This class acts as a base class for all kind of tables (common table and relation table)
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
typedef std::unordered_map<std::string, detail::t_identifier_multimap> matador::basic_table::t_relation_item_map |
Shortcut to an unordered identifier multimap
typedef std::unordered_map<std::string, table_ptr> matador::basic_table::t_table_map |
Shortcut to an unordered map of table shared pointer
typedef std::shared_ptr<basic_table> matador::basic_table::table_ptr |
Shortcut to table shared pointer
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
node | The underlying prototype_node |
p | The underlying persistence object |
|
pure virtual |
Interface for creating a table.
Interface for creating a table for the given database connection.
conn | The database connection |
Implemented in matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.
|
pure virtual |
Interface for droping a table.
Interface for droping a table for the given database connection.
conn | The database connection |
Implemented in matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.
|
pure virtual |
Interface for inserting an object.
Interface for inserting an object represented by the given object_proxy
proxy | The 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 >.
bool matador::basic_table::is_loaded | ( | ) | const |
Returns true if the table is laready loaded.
|
pure virtual |
Interface for loading a table.
Interface for loading a table into the given object_store.
p | The 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 >.
std::string matador::basic_table::name | ( | ) | const |
Returns the name of the table.
prototype_node & matador::basic_table::node | ( | ) |
Returns the underlaying prototype node.
const prototype_node & matador::basic_table::node | ( | ) | const |
Returns the underlaying prototype node.
persistence & matador::basic_table::persistence_unit | ( | ) |
Access the underlaying persistence unit object.
const persistence & matador::basic_table::persistence_unit | ( | ) | const |
Access the underlaying persistence unit object.
|
pure virtual |
Interface for deleting an object.
Interface for deleting an object represented by the given object_proxy
proxy | The 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 >.
|
virtual |
Marks the table as not loaded.
Reimplemented in matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >.
|
pure virtual |
Interface for updating an object.
Interface for updating an object represented by the given object_proxy
proxy | The 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 >.