Description Format

Arbor provides readers and writers for describing label dictionaries, decoration objects, morphologies and cable cells, referred to here as arbor-components.

A detailed description of the s-expression format used to describe each of these components can be found here.

Reading and writing of the arbor-component description format is delegated to the arborio library and the responsible classes and functions are present in the arborio namespace.

The arbor-components and meta-data

using cable_cell_variant = std::variant<arb::morphology, arb::label_dict, arb::decor, arb::cable_cell>
template<typename T>
using parse_hopefully = arb::util::expected<T, cableio_parse_error>

arborio::cableio_parse_error is derived from arb::arbor_exception which in turn is derived from std::runtime_error. It contains information about the line and position of an encountered error in a document.

arb::util::expected contains either an object of type T or an error object.

class meta_data
std::string version

Stores the version of the format being used.

class cable_cell_component
meta_data meta

Stores meta-data pertaining to the description of a cable cell component.

cable_cell_variant component

Stores one of decor, label_dict, morphology or cable_cell.

Reading arbor-components

parse_hopefully<cable_cell_component> parse_component(const std::string&)

This function will attempt to construct a cable_cell_component object by parsing the contents of a string. It will return a parse_hopefully containing the constructed object, or, if parsing fails, a helpful cableio_parse_error.

parse_hopefully<cable_cell_component> parse_component(std::istream&)

Performs the same functionality as parse_component above, but starting from std::istream.

Writing arbor-components

std::ostream &write_component(std::ostream&, const cable_cell_component&)

Writes the cable_cell_component object to the given std::ostream.

std::ostream &write_component(std::ostream &o, const arb::decor &x, const meta_data &m = {})

Constructs a cable_cell_component from a decor object, and optional meta_data. If no meta_data is provided, the most recent version of the format is used to create it. The resulting object is written to the given std::ostream.

std::ostream &write_component(std::ostream &o, const arb::label_dict &x, const meta_data &m = {})

Constructs a cable_cell_component from a label_dict object, and optional meta_data. If no meta_data is provided, the most recent version of the format is used to create it. The resulting object is written to the given std::ostream.

std::ostream &write_component(std::ostream &o, const arb::morphology &x, const meta_data &m = {})

Constructs a cable_cell_component from a morphology object, and optional meta_data. If no meta_data is provided, the most recent version of the format is used to create it. The resulting object is written to the given std::ostream.

std::ostream &write_component(std::ostream &o, const arb::cable_cell &x, const meta_data &m = {})

Constructs a cable_cell_component from a cable_cell object, and optional meta_data. If no meta_data is provided, the most recent version of the format is used to create it. The resulting object is written to the given std::ostream.