Class DataIO

Nested Relationships

Nested Types

Class Documentation

class DataIO

Public Functions

DataIO(std::string filename, std::ios_base::openmode ios_mode = std::ios::in | std::ios::out)
~DataIO()
Header loadHeader()

Load the header from file.

Returns:

Header

YAML::Node loadMeta()

Get all meta data as YAML node.

Returns:

YAML::Node

std::vector<size_t> loadShape()

Load the shape from file.

Returns:

std::vector<size_t>

std::string loadType()

Returns type of the elements.

if(dataIOTypeName<float>() == io.loadType()) { data = io.load<float>(); }

Returns:

std::string

template<typename T>
boost::shared_array<T> load()
Template Parameters:

T

Returns:

boost::shared_array<T>

template<typename T>
boost::shared_array<T> load(std::vector<size_t> &shape)

Load data and write shape to “shape”.

Template Parameters:

T – type of the data. Can be obtained by reading the meta data first

Parameters:

shape – shape of the data

Returns:

boost::shared_array<T> returned data

template<typename T>
void save(const std::vector<size_t> &shape, const boost::shared_array<T> &data)

Save multidiomensional data of type T and shape “shape”.

Template Parameters:

T – typename of data elements

Parameters:
  • shape – multidimensional shape

  • data – data buffer

int version() const

Version of the IO. Update in cpp to signal a version change.

Returns:

int the version

struct Header

Public Members

char MAGIC[4]
int VERSION
long unsigned int JSON_BYTES
long unsigned int DATA_BYTES