Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network

  Advanced Search  

Template Metaprogramming an Object Interface to Relational Tables

Summary: Template Metaprogramming an Object Interface to
Relational Tables
Giuseppe Attardi, Antonio Cisternino
Dipartimento di Informatica, corso Italia 40, I-56125 Pisa, Italy
Abstract. We present a general technique to support reflection in C++, exploit-
ing template metaprogramming techniques. The technique is used for building
an object interface to relational database tables. By just annotating a class defi-
nition with meta information, such as storage attributes or index properties of
fields, a programmer can define objects that can be stored, fetched or searched
in a database table. A high-performance, full text search engine has been built
with this technique.
An object oriented interface library to a relational database table must be capable
of storing objects of any class into its rows. The library must therefore know the
structure of the objects in order to perform serialization. However table schema defi-
nition and table usage are independent operations, of which the compiler is unaware.
Hence data operations require detailed instructions for reconstructing objects fetched
form a table or supplying detailed information about their class. This can be avoided
if the library can exploit introspection [1] for determining the attributes of a class and


Source: Attardi, Giuseppe - Dipartimento di Informatica, UniversitÓ di Pisa


Collections: Computer Technologies and Information Sciences