taco-db  0.1.0
TableDesc.h
Go to the documentation of this file.
1 #ifndef CATALOG_TABLE_DESC_H
2 #define CATALOG_TABLE_DESC_H
3 
4 #include "tdb.h"
5 
6 #include "catalog/Schema.h"
7 #include "catalog/systables.h"
8 
9 namespace taco {
10 
11 class TableDesc {
12 public:
18  static TableDesc *Create(std::shared_ptr<const SysTable_Table> table,
19  const std::vector<const SysTable_Column*> &columns);
20 
22  static TableDesc *Create(std::shared_ptr<const SysTable_Table> table,
23  std::unique_ptr<Schema> schema);
24 
31  const SysTable_Table *
32  GetTableEntry() const {
33  return m_table.get();
34  }
35 
40  const Schema*
41  GetSchema() const {
42  return m_schema.get();
43  }
44 
45 private:
46  TableDesc(std::shared_ptr<const SysTable_Table> table,
47  std::unique_ptr<Schema> schema):
48  m_table(std::move(table)),
49  m_schema(std::move(schema)) {}
50 
51  std::shared_ptr<const SysTable_Table> m_table;
52  std::unique_ptr<Schema> m_schema;
53 };
54 
55 } // namespace taco
56 
57 #endif // CATALOG_TABLE_DESC_H
A Schema object stores the information for accessing an ordered set of typed fields either from a dis...
Definition: Schema.h:39
SysTable_Table is an in-memory cached record in the system catalog SysTable_Table.
Definition: Table.h:16
Definition: TableDesc.h:11
static TableDesc * Create(std::shared_ptr< const SysTable_Table > table, const std::vector< const SysTable_Column * > &columns)
Creates a new table descriptor by building the schema object constructed from the columns (which perf...
Definition: TableDesc.cpp:6
TableDesc(std::shared_ptr< const SysTable_Table > table, std::unique_ptr< Schema > schema)
Definition: TableDesc.h:46
std::unique_ptr< Schema > m_schema
Definition: TableDesc.h:52
const SysTable_Table * GetTableEntry() const
Returns the cached Table entry associated with this table descriptor.
Definition: TableDesc.h:32
const Schema * GetSchema() const
Returns the cached table schema, which we guanrantee ‘IsLayoutComputed() == true’.
Definition: TableDesc.h:41
std::shared_ptr< const SysTable_Table > m_table
Definition: TableDesc.h:51
Definition: Record.h:148
Definition: datum.h:28
This header file includes all internal struct representation of system catalog records.