Tabular-C++: Overview and Guide
Matthew Smith
Defining Tables Inline
Once you are comfortable with using external Python modules to define tables, you might also want to try a different method. We may define tables inline,
//FILE: /include/example/example.hpp
//...
/*TABCPP_OPEN
from tabcpp import *
tables = [
{
'name': 'Points',
'fields': [
field('float', 'x'),
field('float', 'y')
],
'key': key('auto', 'int', 'id')
}
]
TABCPP_CLOSE*/
Running the command,
$ tabcpp.sh create include/example example.hpp
will then create a new header file example_tables.hpp
, defining the table.
//TABLE_BEGIN <table-name>
and //TABLE_END <table-name>
, and use the command,
$ tabcpp.sh realise include/example example.hpp
Previous: Interacting with Tables ;