taco-db  0.1.0
Classes | Namespaces | Typedefs
datum.h File Reference

This file contains the definition of the Datum and DatumRef structures for storing and passing C++ objects of certain C++ types that are used as runtime representation of the objects of SQL types in the database. More...

Go to the source code of this file.

Classes

union  taco::datum_impl::DatumFloatConversion
 Note from PostgreSQL: Float <-> Datum conversions. More...
 
union  taco::datum_impl::DatumDoubleConversion
 Note from PostgreSQL: Float <-> Datum conversions. More...
 
class  taco::datum_impl::NonVarlenGetters< DatumImpl >
 
class  taco::Datum
 A Datum stores and possibly manage the memory resource of a read-only value of a plain fixed-length C++ type, a null-terminated string (cstring), or an object of a variable-length type. More...
 
class  taco::datum_impl::DatumRefVarlenGetters< DatumImpl >
 
class  taco::DatumRef
 A DatumRef object is a read-only reference to an C++ object of a supported runtime type. More...
 
class  taco::NullableDatumRef
 
struct  taco::DataArray
 DataArray is a plain byte array that can be stored as a Datum itself and stores the data of a few datum where we do not want to bother with creating a schema. More...
 

Namespaces

 taco
 
 taco::datum_impl
 The private definitions of datum classes.
 

Typedefs

typedef uintptr_t taco::datum_impl::DatumRep
 

Detailed Description

This file contains the definition of the Datum and DatumRef structures for storing and passing C++ objects of certain C++ types that are used as runtime representation of the objects of SQL types in the database.

A Datum stores and manages the memory resource of a read-only C++ object and a DatumRef is a reference to a read-only object. That means one may not make in-place updates to an object managed or referenced by these classes, rather has to create a new one for an updated value. It is meant to explicitly manage the ownership of objects on heap allocated memory and is designed to support the RAII idiom.

The design of DatumRef is inspired by the Datum in PostgreSQL but we take a different approach towards memory management. Here, a heap allocated object managed in Datum is usually tied to an object that usually reclaims the memory when it reaches the end of its life cycle. In PostgreSQL, a heap allocated datum are usually reclaimed when a memory pool reaches the end of its life cycle, so that objects are almost never explicitly deallocated.

Part of the code is based on postgres.h in PostgreSQL. See COPYRIGHT for a copyright notice for code copied or derived from PostgreSQL.

This file does not have a header guard intentionally. This must be included indirectly from base/tdb_base.h.