CYCLUS
Public Types | Public Member Functions | Static Public Member Functions | List of all members
cyclus::Datum Class Reference

Detailed Description

Used to specify and send a collection of key-value pairs to the Recorder for recording.

Definition at line 15 of file datum.h.

#include <datum.h>

Public Types

typedef std::pair< const char *, boost::spirit::hold_anyEntry
 
typedef std::vector< int > Shape
 
typedef std::vector< ShapeShapes
 
typedef std::vector< EntryVals
 

Public Member Functions

DatumAddVal (const char *field, boost::spirit::hold_any val, std::vector< int > *shape=NULL)
 
void Record ()
 
const Shapesshapes ()
 
std::string title ()
 
const Valsvals ()
 
virtual ~Datum ()
 

Static Public Member Functions

static void operator delete (void *rawMemory) throw ()
 
static void * operator new (size_t size)
 

Member Typedef Documentation

typedef std::pair<const char*, boost::spirit::hold_any> cyclus::Datum::Entry

Definition at line 19 of file datum.h.

typedef std::vector<int> cyclus::Datum::Shape

Definition at line 21 of file datum.h.

typedef std::vector<Shape> cyclus::Datum::Shapes

Definition at line 22 of file datum.h.

typedef std::vector<Entry> cyclus::Datum::Vals

Definition at line 20 of file datum.h.

Constructor & Destructor Documentation

cyclus::Datum::~Datum ( )
virtual

Definition at line 38 of file datum.cc.

Member Function Documentation

Datum * cyclus::Datum::AddVal ( const char *  field,
boost::spirit::hold_any  val,
std::vector< int > *  shape = NULL 
)

Add an arbitrary field-value pair to the datum.

Parameters
fielda label or key for a value. Loosely analogous to a column label.
vala value of any type (int, bool, string, vector) supported by the backends being used.
shapea pointer to a vector of ints that represents the maximum shape for this field. This is only useful for variable length data types such as string and blob. If a shape is provided, this field and value is interpreted as having a fixed length (of the value given). If the pointer is NULL or the entry is less than one (<1), the field is interpreted as inherently variable length, which may affect persistance. This is a vector of ints (a shape) rather than an int (a length) to accomodate nested data types, such as a vector of vectors of doubles or a map of strings to ints. Use NULL as the shape for fixed length data types such as int, float, double, etc.
Warning
for the val argument - what variable types are supported depends on what the backend(s) in use are designed to handle.

Definition at line 12 of file datum.cc.

void cyclus::Datum::operator delete ( void *  rawMemory)
throw (
)
static

Definition at line 76 of file datum.cc.

void * cyclus::Datum::operator new ( size_t  size)
static

Definition at line 53 of file datum.cc.

void cyclus::Datum::Record ( )

Record this datum to its Recorder.

Recorded Datum objects of the same title (e.g. same table) must not contain any fields that were not present in the first datum recorded of that title.

Definition at line 24 of file datum.cc.

const Datum::Shapes & cyclus::Datum::shapes ( )

Returns a vector of all shapes (pointers to vectors of ints) that have been added to this datum.

The length of shapes must match the length of vals.

Definition at line 48 of file datum.cc.

std::string cyclus::Datum::title ( )

Returns the datum's title as specified during the datum's creation.

Definition at line 40 of file datum.cc.

const Datum::Vals & cyclus::Datum::vals ( )

Returns a vector of all field-value pairs that have been added to this datum.

Definition at line 44 of file datum.cc.


The documentation for this class was generated from the following files: