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< std::string > Fields
 
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)
 
DatumAddVal (std::string field, boost::spirit::hold_any val, std::vector< int > *shape=NULL)
 
const Fieldsfields ()
 
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

◆ Entry

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

Definition at line 19 of file datum.h.

◆ Fields

typedef std::vector<std::string> cyclus::Datum::Fields

Definition at line 23 of file datum.h.

◆ Shape

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

Definition at line 21 of file datum.h.

◆ Shapes

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

Definition at line 22 of file datum.h.

◆ Vals

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

Definition at line 20 of file datum.h.

Constructor & Destructor Documentation

◆ ~Datum()

cyclus::Datum::~Datum ( )
virtual

Definition at line 50 of file datum.cc.

Member Function Documentation

◆ AddVal() [1/2]

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 22 of file datum.cc.

◆ AddVal() [2/2]

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

Definition at line 28 of file datum.cc.

◆ fields()

const Datum::Fields & cyclus::Datum::fields ( )

Returns a vector of all field names that have been added to this datum.

Definition at line 64 of file datum.cc.

◆ operator delete()

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

Definition at line 92 of file datum.cc.

◆ operator new()

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

Definition at line 69 of file datum.cc.

◆ Record()

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 35 of file datum.cc.

◆ shapes()

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 60 of file datum.cc.

◆ title()

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

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

Definition at line 52 of file datum.cc.

◆ vals()

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

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

Definition at line 56 of file datum.cc.


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