C++ API Reference

namespace BAG

Forward declarations of BAG C++ classes.

Typedefs

using Record = std::vector<CompoundDataType>
using Records = std::vector<Record>
using DataType = BAG_DATA_TYPE

The types of data.

using LayerType = BAG_LAYER_TYPE

The types of layers.

using GroupType = BAG_GROUP_TYPE

The group types.

using OpenMode = BAG_OPEN_MODE

The open mode when opening a BAG.

using TrackingItem = BagTrackingItem

The type of item in a tracking list.

using VerticalDatumCorrections = BagVerticalDatumCorrections
using VerticalDatumCorrectionsGridded = BagVerticalDatumCorrectionsGridded
using VRMetadataItem = BagVRMetadataItem

The type of item in a variable resolution metadata layer.

using VRNodeItem = BagVRNodeItem

The type of item in a variable resolution node layer.

using VRRefinementsItem = BagVRRefinementsItem

The type of item in a variable resolution refinements layer.

using VRTrackingItem = BagVRTrackingItem

The type of item in a variable resolution tracking list.

using RecordDefinition = std::vector<FieldDefinition>
using GeorefMetadataProfile = GEOREF_METADATA_PROFILE

Enums

enum class BagDatum

Legacy BAG datum definition.

Values:

enumerator wgs84

WGS 84.

enumerator wgs72

WGS 72.

enumerator nad83

NAD 83.

enumerator unknown

Unknown.

enum class CoordinateType

Legacy Coordinate Type Enumeration.

Values:

enumerator Geodetic
enumerator GEOREF
enumerator Geocentric
enumerator Local_Cartesian
enumerator MGRS
enumerator UTM
enumerator UPS
enumerator Albers_Equal_Area_Conic
enumerator Azimuthal_Equidistant
enumerator BNG
enumerator Bonne
enumerator Cassini
enumerator Cylindrical_Equal_Area
enumerator Eckert4
enumerator Eckert6
enumerator Equidistant_Cylindrical
enumerator Gnomonic
enumerator Lambert_Conformal_Conic
enumerator Mercator
enumerator Miller_Cylindrical
enumerator Mollweide
enumerator Neys
enumerator NZMG
enumerator Oblique_Mercator
enumerator Orthographic
enumerator Polar_Stereo
enumerator Polyconic
enumerator Sinusoidal
enumerator Stereographic
enumerator Transverse_Cylindrical_Equal_Area
enumerator Transverse_Mercator
enumerator Van_der_Grinten
enumerator Unknown

Functions

AttributeInfo getAttributeInfo(LayerType layerType)

Retrieve the attribute information about the specified layer type.

Retrieve the simple layer attribute information.

This function retrieves the attribute information about the specified Simple
Layer.  If the specified layer is not supported, an UnknownSimpleLayerType
exception is thrown.

Parameters:

layerType – The type of simple layer. Supported types: Elevation, Uncertainty, Hypothesis_Strength, Num_Hypotheses, Shoal_Elevation, Std_Dev, Num_Soundings, Average_Elevation, and Nominal_Elevation.

Returns:

The attribute information about the specified simple layer.

template<typename T>
T get(const CompoundDataType &v)

A generic way to get the value in a CompoundDataType.

Parameters:

v – The CompoundDataType to return the value of.

Returns:

The template parameter type specified.

::H5::CompType createH5compType(LayerType layerType, GroupType groupType)

Create an HDF5 CompType based on the layer and group types.

Parameters:
  • layerType – The type of layer. The supported types are NODE and ELEVATION.

  • groupType – The group type of the layer. For NODE, the supported types are: Hypothesis_Strength, Num_Hypotheses. For ELEVATION, the supported types are: Shoal_Elevation, Std_Dev, Num_Soundings.

Returns:

The compound type of the specified layer and group type.

::H5::CompType createH5fileCompType(const RecordDefinition &definition)

Create an HDF5 CompType used for file I/O based upon the Record Definition.

Parameters:

definition – The list of fields making up the record.

Returns:

The HDF5 CompType to be used when reading and writing to an HDF file.

::H5::CompType createH5memoryCompType(const RecordDefinition &definition)

Create an HDF5 CompType to be used in memory based upon the Record Definition.

Parameters:

definition – The list of fields making up the record.

Returns:

The HDF5 CompType to be used when reading and writing from memory.

uint64_t getChunkSize(const ::H5::H5File &h5file, const std::string &path)

Get the chunk size from an HDF5 file.

Parameters:
  • h5file – The HDF5 file.

  • path – The path to the HDF5 DataSet.

Returns:

The chunk size of the specified HDF5 DataSet in the HDF5 file. 0 if the HDF5 DataSet does not use chunking.

int getCompressionLevel(const ::H5::H5File &h5file, const std::string &path)

Get the compression level from an HDF5 file.

Parameters:
  • h5file – The HDF5 file.

  • path – The path to the HDF5 DataSet.

Returns:

The compression level of the specified HDF5 DataSet in the HDF5 file. 0 if the HDF5 DataSet is not compressed.

size_t getRecordSize(const RecordDefinition &definition)

Get the size of a record in memory.

Parameters:

definition – The list of fields in the record.

Returns:

The record size in memory, ignoring alignment.

const ::H5::AtomType &getH5fileType(DataType type)

Determine the HDF5 file DataType from the specified data type.

Parameters:

type – The data type to be matched.

Returns:

The matching HDF5 type used in file reading and writing.

const ::H5::AtomType &getH5memoryType(DataType type)

Determine the HDF5 memory DataType from the specified DataType.

Parameters:

type – The data type to be matched.

Returns:

The matching HDF5 type used in memory.

::H5::Attribute createAttribute(const ::H5::DataSet &h5dataSet, const ::H5::PredType &attributeType, const char *path)

Create an attribute on an HDF5 DataSet.

Parameters:
  • h5dataSet – The HDF5 DataSet to create the attribute on.

  • attributeType – The HDF5 type of the attribute.

  • path – The HDF5 path of the attribute. The path cannot be nullptr.

Returns:

The new HDF5 attribute.

void createAttributes(const ::H5::DataSet &h5dataSet, const ::H5::PredType &attributeType, const std::vector<const char*> &paths)

Create attributes on an HDF5 DataSet.

Parameters:
  • h5dataSet – The HDF5 DataSet to create the attributes on.

  • attributeType – The HDF5 type of the attributes.

  • paths – The HDF5 paths of the attributes. If no paths are provided, no attributes are written. If a path is nullptr, that attribute is not written.

template<typename T>
void writeAttribute(const ::H5::DataSet &h5dataSet, const ::H5::PredType &attributeType, T value, const char *path)

Write an attribute to the specified HDF5 DataSet.

Parameters:
  • h5dataSet – The HDF5 DataSet to create the attribute on.

  • attributeType – The HDF5 type of the attribute.

  • valiue – The value of the attribute.

  • path – The HDF5 path of the attribute. The path cannot be nullptr.

template<typename T>
void writeAttributes(const ::H5::DataSet &h5dataSet, const ::H5::PredType &attributeType, T value, const std::vector<const char*> &paths)

Write attributes to an HDF5 DataSet.

Parameters:
  • h5dataSet – The HDF5 DataSet to create the attributes on.

  • attributeType – The HDF5 type of the attributes.

  • paths – The HDF5 paths of the attributes. If no paths are provided, no attributes are written. If a path is nullptr, that attribute is not written.

template void writeAttribute< float > (const ::H5::DataSet &h5dataSet, const ::H5::PredType &attributeType, float value, const char *path)

Write a float point value to an attribute.

template void writeAttribute< uint32_t > (const ::H5::DataSet &h5dataSet, const ::H5::PredType &attributeType, uint32_t value, const char *path)

Write an unsigned 32 bit integer value to an attribute.

template void writeAttributes< float > (const ::H5::DataSet &h5dataSet, const ::H5::PredType &attributeType, float value, const std::vector< const char * > &paths)

Write a floating point value to multiple attributes.

template void writeAttributes< uint32_t > (const ::H5::DataSet &h5dataSet, const ::H5::PredType &attributeType, uint32_t value, const std::vector< const char * > &paths)

Write an unsigned 32 bit integer value to multiple attributes.

CoordinateType bagCoordsys(const char *str) noexcept
BagDatum bagDatumID(const char *str) noexcept
BagError bagLegacyToWkt(const BagLegacyReferenceSystem &system, char *hBuffer, size_t hBufferSize, char *vBuffer, size_t vBufferSize)
xmlDoc *createNewDocument()

Create a new XML document and configure it for the BAG metadata profile.

Returns:

  • The new XML document.

bool addResponsibleParty(xmlNode &parentNode, const BagResponsibleParty &responsiblePartyStruct)

Add the BagResponsibleParty information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • responsiblePartyStruct

    • The structure to be added to parentNode.

Returns:

  • True if the structure is added, False if an error occurs.

bool addCitation(xmlNode &parentNode, const char *title, const char *date, const char *dateType, const BagResponsibleParty *responsibleParties, uint32_t numberOfParties)

Add the citation information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • title

    • The title of the person for the citation.

  • date

    • The date of the citation.

  • dateType

    • The type of date in date.

  • responsibleParties

    • The array of responsible parties.

  • numberOfParties

    • The number of elements in responsibleParties.

Returns:

  • True if the structure is added, False if an error occurs.

bool addDataIdentification(xmlNode &parentNode, const BagIdentification &identificationInfo)

Add the BagIdentification information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • identificationInfo

    • The identification information to be added to parentNode

Returns:

  • True if the structure is added, False if an error occurs.

bool addSecurityConstraints(xmlNode &parentNode, const BagSecurityConstraints &securityConstraints)

Add the BagSecurityConstraints information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • securityConstraints

    • The security constraint information to be added to parentNode

Returns:

  • True if the structure is added, False if an error occurs.

bool addLegalConstraints(xmlNode &parentNode, const BagLegalConstraints &legalConstraints)

Add the BagLegalConstraints information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • legalConstraints

    • The legal constraint information to be added to parentNode

Returns:

  • True if the structure is added, False if an error occurs.

bool addProcessSource(xmlNode &parentNode, const BagSource &source)

Add the BagSource information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • source

    • The process source information to be added to parentNode

Returns:

  • True if the structure is added, False if an error occurs.

bool addProcessStep(xmlNode &parentNode, const BagProcessStep &processInfo)

Add the BagProcessStep information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • processInfo

    • The process step information to be added to parentNode

Returns:

  • True if the structure is added, False if an error occurs.

bool addDataQuality(xmlNode &parentNode, const BagDataQuality &dataQuality)

Add the BagDataQuality information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • dataQuality

    • The data quality information to be added to parentNode

Returns:

  • True if the structure is added, False if an error occurs.

bool addSpatialRepresentation(xmlNode &parentNode, const BagSpatialRepresentation &spatialRepresentationInfo)

Add the BagSpatialRepresentation information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • spatialRepresentationInfo

    • The spatial representation information to be added to parentNode

Returns:

  • True if the structure is added, False if an error occurs.

bool addReferenceSystem(xmlNode &parentNode, const BagReferenceSystem &system)

Add the BagReferenceSystem information to the parent XML node.

Parameters:
  • parentNode

    • The parent XML node to be modified.

  • system

    • The reference system information to be added to parentNode

Returns:

  • True if the structure is added, False if an error occurs.

std::string exportMetadataToXML(const BagMetadata &metadata)

Export the Metadata to a string.

Parameters:

metadata

  • The metadata information to be exported.

Returns:

  • The metadata as XML in a string.

std::string bagGetHomeFolder()

Get the current setting for the BAG_HOME directory.

Returns:

  • If the user has called bagSetHomeFolder(), then that value is returned, otherwise, getenv(“BAG_HOME”) is returned.

void bagSetHomeFolder(const char *homeFolder)

Set the location of the BAG ‘home’ directory.

Parameters:

homeFolder

  • The new location for the BAG home directory.

bool decodeResponsibleParty(xmlNode &node, BagResponsibleParty &responsibleParty, uint16_t schemaVersion)

Decode a BagResponsibleParty from the supplied XML node.

Parameters:
  • node

    • The XML node containing the responsible party information.

  • responsibleParty

    • Modified to contain the responsible party information from node.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if an error occurs.

bool decodeLegalConstraints(xmlNode &node, BagLegalConstraints &legalConstraints, uint16_t schemaVersion)

Decode a BagLegalConstraints from the supplied XML node.

Parameters:
  • node

    • The XML node containing the legal constraints information.

  • legalConstraints

    • Modified to contain the legal constraints information from node.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if an error occurs.

bool decodeSecurityConstraints(xmlNode &node, BagSecurityConstraints &securityConstraints, uint16_t schemaVersion)

Decode a BagSecurityConstraints from the supplied XML node.

Parameters:
  • node

    • The XML node containing the security constraints information.

  • securityConstraints

    • Modified to contain the security constraints information from node.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if an error occurs.

bool decodeSourceInfo(xmlNode &node, BagSource &sourceInfo, uint16_t schemaVersion)

Decode a BagSource from the supplied XML node.

Parameters:
  • node

    • The XML node containing the source information.

  • sourceInfo

    • Modified to contain the source information from node.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if an error occurs.

bool decodeProcessStep(xmlNode &node, BagProcessStep &processStep, uint16_t schemaVersion)

Decode a BagProcessStep from the supplied XML node.

Parameters:
  • node

    • The XML node containing the process information.

  • processStep

    • Modified to contain the process information from node.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if an error occurs.

bool decodeDataQualityInfo(xmlNode &node, BagDataQuality &dataQualityInfo, uint16_t schemaVersion)

Decode a BagDataQuality from the supplied XML node.

Parameters:
  • node

    • The XML node containing the data quality information.

  • dataQualityInfo

    • Modified to contain the data quality information from node.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if an error occurs.

bool decodeSpatialRepresentationInfo(xmlNode &node, BagSpatialRepresentation &spatialRepresentationInfo, uint16_t schemaVersion)

Decode a BagSpatialRepresentation from the supplied XML node.

Parameters:
  • node

    • The XML node containing the spatial representation information.

  • spatialRepresentationInfo

    • Modified to contain the spatial representation information from node.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if an error occurs.

bool decodeDataIdentificationInfo(xmlNode &node, BagIdentification &dataIdentificationInfo, uint16_t schemaVersion)

Decode a BagIdentification from the supplied XML node.

Parameters:
  • node

    • The XML node containing the data identification information.

  • dataIdentificationInfo

    • Modified to contain the data identification information from node.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if an error occurs.

bool decodeReferenceSystemInfoFromSpatial(const BagSpatialRepresentation *spatialRepresentationInfo, BagReferenceSystem *referenceSystemInfo, uint16_t)

Decode a BagReferenceSystem from a BagSpatialRepresentation, the narrowly defined as the parsing of an EPSG code from the transformationDimensionDescription tag

Parameters:
  • spatialRepresentationInfo

    • Spatial representation information input.

  • referenceSystemInfo

    • Modified to contain the reference system information from spatialRepresentationInfo->transformationDimensionDescription.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if the optional tag is not present in the header or an error occurs.

bool decodeReferenceSystemInfo(xmlNode &node, BagReferenceSystem &referenceSystemInfo, uint16_t schemaVersion)

Decode a BagReferenceSystem from the supplied XML node.

Parameters:
  • node

    • The XML node containing the reference system information.

  • referenceSystemInfo

    • Modified to contain the reference system information from node.

  • schemaVersion

    • The version of the schema stored in node.

Returns:

  • True if the information was found and decoded properly, False if an error occurs.

BagError validateSchema(xmlDoc &metadataDocument)

Validate an XML document against the current BAG metadata schema.

Parameters:

metadataDocument

  • The document to be validated.

Returns:

  • BAG_SUCCESS if the document passes schema validation, a BAG error code if an error occurs.

BagError bagImportMetadataFromXmlV1(const xmlDoc &document, BagMetadata &metadata)

Import the BAG_METADATA from a version 1 schema.

Imports the metadata from a 'version 1' BAG schema.  Version 1 schemas
were used in BAG versions 1.0 - 1.4.  Version 2 schemas are used in
BAG version 1.5 and newer.

Parameters:
  • document

    • The XML document containing the ‘version 1’ schema.

  • metadata

    • Modified to contain the BAG metadata information from document. Input should not be NULL.

Returns:

  • BAG_SUCCESS if the information is successfully extracted from document, an error code otherwise.

BagError bagImportMetadataFromXmlV2(const xmlDoc &document, BagMetadata &metadata)

Import the BAG_METADATA from a version 2 schema.

Imports the metadata from a 'version 2' BAG schema.  Version 2 schemas
are used in BAG version 1.5 and newer.

Parameters:
  • document

    • The XML document containing the ‘version 2’ schema.

  • metadata

    • Modified to contain the BAG metadata information from document. Input should not be NULL.

Returns:

  • BAG_SUCCESS if the information is successfully extracted from document, an error code otherwise.

BagError bagImportMetadataFromXml(xmlDoc &document, BagMetadata &metadata, bool doValidation)

Import the BAG_METADATA from an XML document.

Imports the BAG metadata information from any supported schema version.

Parameters:
  • document

    • The XML document containing the ‘version 2’ schema.

  • metadata

    • Modified to contain the BAG metadata information from document. Input should not be NULL.

  • doValidation

    • True to perform the schema validation (conformance test). False to simply extract the data.

Returns:

  • BAG_SUCCESS on success. A BAG error code is returned if there is an error, or if schema validation fails (only if doValidation is True).

BagError bagImportMetadataFromXmlBuffer(const char *xmlBuffer, int bufferSize, BagMetadata &metadata, bool doValidation)

Import the BAG_METADATA from an XML document stored in a character buffer.

Imports the BAG metadata information from any supported schema version.

Parameters:
  • xmlBuffer

    • The character buffer containing the XML document to be used for import. Input should not be NULL.

  • bufferSize

    • The size in bytes of the xmlBuffer.

  • metadata

    • Modified to contain the BAG metadata information from xmlBuffer. Input should not be NULL.

  • doValidation

    • True to perform the schema validation (conformance test). False to simply extract the data.

Returns:

  • BAG_SUCCESS if the information is successfully extracted from xmlBuffer, an error code otherwise. If doValidation is True, an error will be returned if the validation fails.

BagError bagImportMetadataFromXmlFile(const char *fileName, BagMetadata &metadata, bool doValidation)

Import the BAG_METADATA from an XML file.

Imports the BAG metadata information from any supported schema version.

Parameters:
  • fileName

    • The fully qualified name of the XML file to be read.

  • metadata

    • Modified to contain the BAG metadata information from fileName. Input should not be NULL.

  • doValidation

    • True to perform the schema validation (conformance test). False to simply extract the data.

Returns:

  • BAG_SUCCESS if the information is successfully extracted from xmlBuffer, an error code otherwise. If doValidation is True, an error will be returned if the validation fails.

const Record CreateRecord_NOAA_OCS_2022_10(bool significantFeatures, bool featureLeastDepth, float featureSize, float featureSizeVar, bool coverage, bool bathyCoverage, float horizontalUncertFixed, float horizontalUncertVar, std::string surveyDateStart, std::string surveyDateEnd, std::string sourceInstitution, std::string sourceSurveyID, uint32_t sourceSurveyIndex, std::string licenseName, std::string licenseURL)
inline bool operator==(const VRTrackingItem &lhs, const VRTrackingItem &rhs) noexcept
inline bool operator==(const FieldDefinition &lhs, const FieldDefinition &rhs) noexcept

The type of a record definition (used with Georef_Metadata Layers).

inline bool operator!=(const FieldDefinition &lhs, const FieldDefinition &rhs) noexcept
inline bool operator==(const RecordDefinition &lhs, const RecordDefinition &rhs)
template<typename T, typename U>
inline bool weak_ptr_equals(const std::weak_ptr<T> &t, const std::weak_ptr<U> &u)

Variables

constexpr hsize_t kMetadataChunkSize = 1024

The HDF5 chunk size of the metadata.

const std::unordered_map<GeorefMetadataProfile, std::string> kGeorefMetadataProfileMapString{{UNKNOWN_METADATA_PROFILE, UNKOWN_METADATA_PROFILE_NAME}, {NOAA_OCS_2022_10_METADATA_PROFILE, NOAA_OCS_2022_10_METADATA_PROFILE_NAME}}
const std::unordered_map<std::string, GeorefMetadataProfile> kStringMapGeorefMetadataProfile{{UNKOWN_METADATA_PROFILE_NAME, UNKNOWN_METADATA_PROFILE}, {NOAA_OCS_2022_10_METADATA_PROFILE_NAME, NOAA_OCS_2022_10_METADATA_PROFILE}}
const RecordDefinition METADATA_DEFINITION_UNKNOWN = RecordDefinition()
const RecordDefinition METADATA_DEFINITION_NOAA_OCS_2022_10 = {{"significant_features", DT_BOOLEAN}, {"feature_least_depth", DT_BOOLEAN}, {"feature_size", DT_FLOAT32}, {"feature_size_var", DT_FLOAT32}, {"coverage", DT_BOOLEAN}, {"bathy_coverage", DT_BOOLEAN}, {"horizontal_uncert_fixed", DT_FLOAT32}, {"horizontal_uncert_var", DT_FLOAT32}, {"survey_date_start", DT_STRING}, {"survey_date_end", DT_STRING}, {"source_institution", DT_STRING}, {"source_survey_id", DT_STRING}, {"source_survey_index", DT_UINT32}, {"license_name", DT_STRING}, {"license_url", DT_STRING}}
const std::unordered_map<GeorefMetadataProfile, RecordDefinition> kGeorefMetadataProfileMapKnownRecordDefinition{{NOAA_OCS_2022_10_METADATA_PROFILE, METADATA_DEFINITION_NOAA_OCS_2022_10}}
constexpr int kMaxCompressionLevel = 9

The maximum compression level supported by HDF5.

constexpr uint16_t kMaxDatumsLength = 256

The maximum length of the list of datums.

constexpr int32_t kSearchRadius = 3

The radius to use while searching for nearest neighbours.

constexpr hsize_t kChunkSize = 10

The HDF5 DataSet chunk size.

static constexpr int kRank = 2
static constexpr uint32_t kInvalidLayerId = std::numeric_limits<uint32_t>::max()

An invalid layer id.

const std::unordered_map<LayerType, std::string> kLayerTypeMapString{{Elevation, "Elevation"}, {Uncertainty, "Uncertainty"}, {Hypothesis_Strength, "Hypothesis_Strength"}, {Num_Hypotheses, "Num_Hypotheses"}, {Shoal_Elevation, "Shoal_Elevation"}, {Std_Dev, "Std_Dev"}, {Num_Soundings, "Num_Soundings"}, {Average_Elevation, "Average_Elevation"}, {Nominal_Elevation, "Nominal_Elevation"}, {Surface_Correction, "Surface_Correction"}, {VarRes_Metadata, "Variable_Resolution_Metadata"}, {VarRes_Refinement, "Variable_Resolution_Refinement"}, {VarRes_Node, "Variable_Resolution_Node"},}

A default layer name for each layer.

struct AttributeInfo
#include <bag_attributeinfo.h>

This structure contains simple layer attribute information.

Public Members

const char *minName = nullptr

The minimum value attribute name.

const char *maxName = nullptr

The maximum value attribute name.

const char *path = nullptr

The HDF5 path to the attribute.

const ::H5::PredType &h5type

The HDF5 type the attribute is.

class CompoundDataType
#include <bag_compounddatatype.h>

This class is a tagged union (aka variant).

The supported types of this tagged union are: DT_FLOAT32, DT_UINT32, DT_BOOLEAN, DT_STRING

Public Functions

inline CompoundDataType()

The default constructor.

inline explicit CompoundDataType(float value) noexcept

A constructor that takes a float and populates members appropriately.

Parameters:

value – A 32 bit floating point.

inline explicit CompoundDataType(uint32_t value) noexcept

A constructor that takes an unsigned 32 bit integer and populates members appropriately.

Parameters:

value – A 32 bit unsigned integer.

inline explicit CompoundDataType(bool value) noexcept

A constructor that takes a boolean and populates members appropriately.

Parameters:

value – A boolean.

inline explicit CompoundDataType(std::string value) noexcept

A constructor that takes a string and populates members appropriately.

Parameters:

value – A string.

inline CompoundDataType(const CompoundDataType &other)

Copy constructor.

Parameters:

other – The object to be copied.

inline CompoundDataType(CompoundDataType &&other)

Move constructor.

Parameters:

other – The object to be moved from.

inline ~CompoundDataType() noexcept

Destructor.

inline CompoundDataType &operator=(const CompoundDataType &rhs)

Copy assignment operator.

Parameters:

rhs – The object to be copied.

Returns:

The newly assigned to object.

inline CompoundDataType &operator=(CompoundDataType &&rhs)

Move assignment operator.

Parameters:

rhs – The object to be moved from.

Returns:

The newly assigned to object.

inline CompoundDataType &operator=(float rhs) noexcept

Floating point assignment operator.

Parameters:

rhs – The object to copy.

Returns:

The newly assigned to object.

inline CompoundDataType &operator=(uint32_t rhs) noexcept

32 bit unsigned integer assignment operator.

Parameters:

rhs – The object to copy.

Returns:

The newly assigned to object.

inline CompoundDataType &operator=(bool rhs) noexcept

Boolean assignment operator.

Parameters:

rhs – The object to copy.

Returns:

The newly assigned to object.

inline CompoundDataType &operator=(std::string rhs) noexcept

String assignment operator.

Parameters:

rhs – The object to copy.

Returns:

The newly assigned to object.

inline bool operator==(const CompoundDataType &rhs) const noexcept

Is equal operator.

Parameters:

rhs – The object to compare with.

Returns:

true if rhs is equal; false otherwise

inline float asFloat() const

Retrieve the value as a float point.

Retrieve the value as a floating point.  Throw an exception if it is not
a floating point.

Returns:

The value as a floating point.

inline uint32_t asUInt32() const

Retrieve the value as a 32 bit unsigned integer.

Retrieve the value as a 32 bit unsigned integer.  Throw an exception if
it is not a 32 bit unsigned integer.

Returns:

The value as a 32 bit unsigned integer.

inline bool asBool() const

Retrieve the value as a boolean.

Retrieve the value as a boolean.  Throw an exception if it is not a
boolean.

Returns:

The value as a boolean.

inline const std::string &asString() const &

Retrieve the value as a constant string.

Retrieve the value as a string.  Throw an exception if it is not a
string.

Returns:

The value as a string.

inline std::string &asString() &

Retrieve the value as a mutable string.

Retrieve the value as a string.  Throw an exception if it is not a
string.

Returns:

The value as a string.

inline DataType getType() const noexcept

Retrieve the type of value being stored.

Returns:

The type of the value being stored.

Private Members

DataType type = DT_UNKNOWN_DATA_TYPE

The type of the tagged union.

union Data

The union that holds the different values.

Public Functions

inline Data()
inline Data(float f)
inline Data(uint32_t ui32)
inline Data(bool b)
inline Data(std::string s)
inline ~Data()

Public Members

float m_f
uint32_t m_ui32
bool m_b
std::string m_s
class Dataset : public std::enable_shared_from_this<Dataset>
#include <bag_dataset.h>

The interface for the BAG.

This is the BAG Dataset. It is responsible for creating or reading a BAG. It contains the layers and metadata. It has a descriptor for general details.

It is the only way layers can be created. It is meant to be the interface to the BAG, and answer questions about said BAG.

Public Functions

void close()

Close a BAG dataset. Closes the underlying HDF5 file.

Layer &getLayer(uint32_t id) &

Retrieve a layer by its unique id.

Retrieve a layer by its unique id.  If it is not found, an InvalidLayerId
exception is thrown.

Parameters:

id – The unique id of the layer.

Returns:

The layer specified by the id.

const Layer &getLayer(uint32_t id) const &

Retrieve a layer by its unique id.

Retrieve a layer by its unique id.  If it is not found, an InvalidLayerId
exception is thrown.

Parameters:

id – The unique id of the layer.

Returns:

The layer specified by the id.

std::shared_ptr<Layer> getLayer(LayerType type, const std::string &name) &

Retrieve a layer based on type and case-insensitive name.

Parameters:
  • type – The layer type.

  • name – The optional, case-insensitive name. If the layer type is Georef_Metadata, the name must be the simple layer it refers to.

Returns:

The specified layer. nullptr if no layer is found.

std::shared_ptr<const Layer> getLayer(LayerType type, const std::string &name) const &

Retrieve a layer based on type and case-insensitive name.

Parameters:
  • type – The layer type.

  • name – The optional, case-insensitive name. If the layer type is Georef_Metadata, the name must be the simple layer it refers to.

std::vector<std::shared_ptr<const Layer>> getLayers() const &

Retrieve all the layers.

Returns:

All the layers.

std::vector<LayerType> getLayerTypes() const

Retrieve the layer types.

Returns:

The layer types. If multiple georeferenced metadata layers exist, Compound_Layer will only be present once.

Layer &createSimpleLayer(LayerType type, uint64_t chunkSize, int compressionLevel) &

Create an optional simple layer.

Parameters:
  • type – The type of layer to create. The layer cannot currently exist.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new layer.

GeorefMetadataLayer &createGeorefMetadataLayer(DataType keyType, GeorefMetadataProfile profile, const std::string &name, const RecordDefinition &definition, uint64_t chunkSize, int compressionLevel) &

Create a georeferenced metadata layer.

Parameters:
  • keyType – The type of key the georeferenced metadata layer will use. Valid values are: DT_UINT8, DT_UINT16, DT_UINT32 or DT_UINT64

  • name – The name of the simple layer this georeferenced metadata layer has metadata for.

  • definition – The list of fields defining a record of the georeferenced metadata layer.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new georeferenced metadata layer.

GeorefMetadataLayer &createGeorefMetadataLayer(GeorefMetadataProfile profile, const std::string &name, uint64_t chunkSize, int compressionLevel, DataType keyType = DT_UINT16) &

Convenience method for creating a georeferenced metadata layer with a known metadata profile. Will use the RecordDefinition appropriate to the known profile.

Parameters:
  • profile – The metadata profile to assign to the georeferenced metadata layer.

  • name – The name of the simple layer this georeferenced metadata layer has metadata for.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

  • keyType – The type of key the georeferenced metadata layer will use. Valid values are: DT_UINT8, DT_UINT16, DT_UINT32 or DT_UINT64 Default value: DT_UINT16

Throws:

UknownMetadataProfile – if profile is not a known metadata profile

Returns:

The new georeferenced metadata layer.

SurfaceCorrections &createSurfaceCorrections(BAG_SURFACE_CORRECTION_TOPOGRAPHY type, uint8_t numCorrectors, uint64_t chunkSize, int compressionLevel) &

Create optional surface corrections layer.

Parameters:
  • type – The type of topography. Gridded (BAG_SURFACE_GRID_EXTENTS) or sparse (BAG_SURFACE_IRREGULARLY_SPACED).

  • numCorrectors – The number of correctors to use (1-10).

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new surface corrections layer.

void createVR(uint64_t chunkSize, int compressionLevel, bool makeNode)

Create optional variable resolution layers.

Parameters:
  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

const Metadata &getMetadata() const & noexcept

Retrieve the metadta.

Returns:

The metadata.

TrackingList &getTrackingList() & noexcept

Retrieve the tracking list.

Returns:

The tracking list.

const TrackingList &getTrackingList() const & noexcept

Retrieve the tracking list.

Returns:

The tracking list.

std::shared_ptr<GeorefMetadataLayer> getGeorefMetadataLayer(const std::string &name) & noexcept

Retrieve an optional georeferenced metadata layer by name.

Parameters:

name – The name of the simple layer the georeferenced metadata layer has metadata for.

Returns:

The specified georeferenced metadata layer, if it exists. nullptr otherwise

std::shared_ptr<const GeorefMetadataLayer> getGeorefMetadataLayer(const std::string &name) const & noexcept

Retrieve an optional georeferenced metadata layer by name.

Parameters:

name – The name of the simple layer the georeferenced metadata layer has metadata for.

Returns:

x The specified georeferenced metadata layer, if it exists. nullptr otherwise

std::vector<std::shared_ptr<GeorefMetadataLayer>> getGeorefMetadataLayers() & noexcept

Retrieve all the georeferenced metadata layers.

Returns:

All the georeferenced metadata layers.

std::shared_ptr<SurfaceCorrections> getSurfaceCorrections() & noexcept

Retrieve the optional surface corrections layer.

Returns:

The optional surface corrections layer.

std::shared_ptr<const SurfaceCorrections> getSurfaceCorrections() const & noexcept

Retrieve the optional surface corrections layer.

Returns:

The optional surface corrections layer.

std::shared_ptr<SimpleLayer> getSimpleLayer(LayerType type) & noexcept

Retrieve the specified simple layer.

Parameters:

type – The layer type.

Returns:

The specified simple l ayer. nullptr if the layer does not exist.

std::shared_ptr<const SimpleLayer> getSimpleLayer(LayerType type) const & noexcept

Retrieve the specified simple layer.

Parameters:

type – The layer type.

Returns:

The specified simple l ayer. nullptr if the layer does not exist.

std::shared_ptr<VRMetadata> getVRMetadata() & noexcept

Retrieve the optional variable resolution metadata.

Returns:

The optional variable resolution metadata.

std::shared_ptr<const VRMetadata> getVRMetadata() const & noexcept

Retrieve the optional variable resolution metadata.

Returns:

The optional variable resolution metadata.

std::shared_ptr<VRNode> getVRNode() & noexcept

Retrieve the optional variable resolution node group.

Returns:

The optional variable resolution node group.

std::shared_ptr<const VRNode> getVRNode() const & noexcept

Retrieve the optional variable resolution node group.

Returns:

The optional variable resolution node group.

std::shared_ptr<VRRefinements> getVRRefinements() & noexcept

Retrieve the optional variable resolution refinements.

Returns:

The optional variable resolution refinements.

std::shared_ptr<const VRRefinements> getVRRefinements() const & noexcept

Retrieve the optional variable resolution refinements.

Returns:

The optional variable resolution refinements.

std::shared_ptr<VRTrackingList> getVRTrackingList() & noexcept

Retrieve the optional variable resolution tracking list.

Returns:

The optional variable resolution tracking list.

std::shared_ptr<const VRTrackingList> getVRTrackingList() const & noexcept

Retrieve the optional variable resolution tracking list.

Returns:

The optional variable resolution tracking list.

Descriptor &getDescriptor() & noexcept

Retrieve the dataset’s descriptor.

Returns:

The dataset’s descriptor.

const Descriptor &getDescriptor() const & noexcept

Retrieve the dataset’s descriptor.

Returns:

The dataset’s descriptor.

std::tuple<double, double> gridToGeo(uint32_t row, uint32_t column) const noexcept

Convert a grid position to a geographic location.

Parameters:
  • row – The grid row.

  • column – The grid column.

Returns:

The geographic position.

std::tuple<uint32_t, uint32_t> geoToGrid(double x, double y) const noexcept

Convert a geographic location to grid position.

Parameters:
  • x – The X of the geographic location.

  • y – The Y of the geographic location.

Returns:

The grid position (row, column).

Public Static Functions

static std::shared_ptr<Dataset> open(const std::string &fileName, OpenMode openMode)

Open an existing BAG.

Parameters:
  • fileName – The name of the BAG.

  • openMode – The mode to open the BAG with.

Returns:

The BAG Dataset.

static std::shared_ptr<Dataset> create(const std::string &fileName, Metadata &&metadata, uint64_t chunkSize = 100, int compressionLevel = 5)

Create a BAG.

Parameters:
  • fileName – The name of the BAG.

  • metadata – The metadata describing the BAG. This parameter will be moved, and not usable after.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The BAG Dataset.

Private Functions

uint32_t getNextId() const noexcept

Retrieve the next unique layer id.

Returns:

The next unique layer id.

void readDataset(const std::string &fileName, OpenMode openMode)

Read an existing BAG.

Parameters:
  • fileName – The name of the BAG.

  • openMode – The mode to open the BAG with.

void createDataset(const std::string &fileName, Metadata &&metadata, uint64_t chunkSize, int compressionLevel)

Create a new Dataset.

Parameters:
  • fileName – The name of the new BAG.

  • metadata – The metadata to be used by the BAG.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

std::tuple<bool, float, float> getMinMax(LayerType type, const std::string &path = {}) const

Retrieve the minimum and maximum values of a simple layer.

Parameters:
  • type – The type of simple layer.

  • path – The optional internal HDF5 path to use.

Returns:

A tuple of results. The first value in the tuple indicates whether a value was found or not. If the first value is true, the second value is the minimum, and the third value is the maximum. If the first value is false, the second and third values are undefined.

::H5::H5File &getH5file() const & noexcept

Retrieve the HDF5 file that contains this BAG.

Returns:

The HDF5 file that contains to this BAG.

Layer &addLayer(std::shared_ptr<Layer> layer) &

Add a layer to this dataset.

Parameters:

newLayer – The new layer.

Returns:

A reference to the new layer.

Private Members

std::unique_ptr<::H5::H5File, DeleteH5File> m_pH5file

The HDF5 file that the BAG is stored in.

std::vector<std::shared_ptr<Layer>> m_layers

The mandatory and optional layers found in the BAG, including ones created after opening.

std::unique_ptr<Metadata> m_pMetadata

The metadata.

std::unique_ptr<TrackingList> m_pTrackingList

The tracking list.

Descriptor m_descriptor

The descriptor.

std::shared_ptr<VRTrackingList> m_pVRTrackingList

The optional VR tracking list.

struct DeleteH5File

Custom deleter to not require knowledge of ::H5::H5File destructor here.

Public Functions

void operator()(::H5::H5File *ptr) noexcept

Custom deleter to not expose the HDF5 dependency to the user.

Parameters:

ptr – The H5File to be deleted.

struct DeleteH5dataSet
#include <bag_deleteh5dataset.h>

Custom deleter for use with std::unique_ptr, to keep HDF5 dependencies out of header files.

Public Functions

void operator()(::H5::DataSet *ptr) noexcept

A specialized deleter to avoid needing definitions of HDF5 classes in header files.

Parameters:

ptr – A pointer to an HDF5 DataSet.

class Descriptor
#include <bag_descriptor.h>

Describe a BAG.

Public Functions

explicit Descriptor(const Metadata &metadata)

Constructor.

Parameters:

metadata – The metadata.

std::vector<LayerType> getLayerTypes() const

Retrieve all the layer types the descriptor is aware of.

Returns:

All the unique layer types the descriptor is aware of. If multiple georeferenced metadata layers are present, the type is only provided once.

bool isReadOnly() const noexcept

Retrieve the read only flag value.

Returns:

true if the BAG is read only. false otherwise.

std::vector<uint32_t> getLayerIds() const noexcept

Retrieve a list of layer ids.

Returns:

A list of layer ids.

const std::vector<std::weak_ptr<const LayerDescriptor>> &getLayerDescriptors() const & noexcept

Retrieve all the layer descriptors.

Returns:

All the layer descriptors.

const LayerDescriptor &getLayerDescriptor(uint32_t id) const &

Retrieve the layer descriptor by id.

Parameters:

id – The layer id of the desired layer descriptor.

Returns:

The specified layer descriptor. An exception will be thrown if the layer id does not exist.

const LayerDescriptor *getLayerDescriptor(LayerType type, const std::string &name) const &

Retrieve the specified layer descriptor by type and name.

Parameters:
  • type – The descriptor of the layer specified by type.

  • name – The case-insensitive name of the layer. Optional for all but georeferenced metadata layers.

Returns:

The specified layer descriptor.

const std::string &getVersion() const & noexcept

Retrieve the BAG version as a string.

Returns:

The BAG version as a string.

const std::string &getHorizontalReferenceSystem() const & noexcept

Retrieve the horizontal reference system.

Returns:

The horizontal reference system.

const std::string &getVerticalReferenceSystem() const & noexcept

Retrieve the vertical reference system.

Returns:

The vertical reference system.

const std::tuple<uint32_t, uint32_t> &getDims() const & noexcept

Retrieve BAG grid dimensions.

Returns:

The rows and columns of the BAG.

const std::tuple<double, double, double, double> &getProjectedCover() const & noexcept

Retrieve the projected cover.

Returns:

The projected cover of the BAG. The values returned in the tuple are: Lower left corner X, lower left corner Y, upper right corner X, upper right corner Y.

const std::tuple<double, double> &getOrigin() const & noexcept

Retrieve the BAG origin.

Returns:

The geographic position of the south west corner of the BAG.

const std::tuple<double, double> &getGridSpacing() const & noexcept

Retrieve the row and column spacing/resolution of the grid.

Descriptor &setVerticalReferenceSystem(const std::string &verticalReferenceSystem) & noexcept

Set the BAG’s vertical reference system.

Parameters:

verticalReferenceSystem – The new vertical reference system as WKT.

Returns:

The modified descriptor.

Descriptor &setDims(uint32_t rows, uint32_t columns) & noexcept

Set the BAG grid size.

Parameters:
  • rows – The number of rows in the BAG.

  • columns – The number of columns in the BAG.

Returns:

The modified descriptor.

Descriptor &setProjectedCover(double llX, double llY, double urX, double urY) & noexcept

Set the BAG’s projected cover.

Parameters:
  • llX – Lower left x value.

  • llY – Lower left y value.

  • urX – Upper right x value.

  • urY – Upper right y value.

Returns:

The modified descriptor.

Descriptor &setOrigin(double llX, double llY) & noexcept

Set the BAG’s origin.

Parameters:
  • llX – Lower left x value.

  • llY – Lower left y value.

Returns:

The modified descriptor.

Descriptor &setGridSpacing(double xSpacing, double ySpacing) & noexcept

Set the BAG grid spacing/resolution.

Parameters:
  • xSpacing – The X spacing/resolution of the BAG grid.

  • ySpacing – The Y spacing/resolution of the BAG grid.

Returns:

The modified descriptor.

Descriptor &setHorizontalReferenceSystem(const std::string &horizontalReferenceSystem) & noexcept

Set the BAG horizontal reference system.

Parameters:

horizontalReferenceSystem – The new horizontal reference system as WKT.

Returns:

The modified descriptor.

Descriptor &setReadOnly(bool readOnly) & noexcept

Set the BAG’s projected cover.

Parameters:

inReadOnly – The new read only flag. true enables reading only. false allows writing.

Returns:

The modified descriptor.

Descriptor &setVersion(std::string inVersion) & noexcept

Set the BAG’s version as a string.

Parameters:

inVersion – The new version as a string.

Returns:

The modified descriptor.

Private Functions

Descriptor &addLayerDescriptor(const LayerDescriptor &inDescriptor) &

Add a layer descriptor to this descriptor.

Private Members

std::string m_version

The version of the BAG.

bool m_isReadOnly = true

True if the BAG is read only.

std::vector<std::weak_ptr<const LayerDescriptor>> m_layerDescriptors

The layer descriptors (owned by each Layer).

std::string m_horizontalReferenceSystem

The name of the horizontal reference system.

std::string m_verticalReferenceSystem

The name of the vertical reference system.

std::tuple<uint32_t, uint32_t> m_dims = {}

The dimensions of the bag.

std::tuple<double, double, double, double> m_projectedCover = {}

The projected cover of the bag.

std::tuple<double, double> m_origin = {}

The origin of the bag.

std::tuple<double, double> m_gridSpacing = {}

The grid spacing of the bag.

struct CompressionNeedsChunkingSet : public virtual std::exception
#include <bag_exceptions.h>

Compression was requested, but no chunking was specified.

struct UnsupportedAttributeType : public virtual std::exception
#include <bag_exceptions.h>

Attribute type not supported (yet)

struct InvalidType : public virtual std::exception
#include <bag_exceptions.h>

Layer not found.

struct InvalidDescriptor : public virtual std::exception
#include <bag_exceptions.h>

Invalid descriptor found.

struct InvalidKeyType : public virtual std::exception
#include <bag_exceptions.h>

Invalid key type specified.

struct NameRequired : public virtual std::exception
#include <bag_exceptions.h>

A name is required to find a unique georeferenced metadata layer.

struct DatasetNotFound : public virtual std::exception
#include <bag_exceptions.h>

Layer not found.

struct InvalidLayerId : public virtual std::exception
#include <bag_exceptions.h>

Invalid layer id.

struct UnsupportedGroupType : public virtual std::exception
#include <bag_exceptions.h>

Attempt to use an unknown layer type.

struct InvalidBuffer : public virtual std::exception
#include <bag_exceptions.h>

Invalid buffer provided for the write.

struct InvalidReadSize : public virtual std::exception
#include <bag_exceptions.h>

Invalid dimensions specified for the read.

struct InvalidWriteSize : public virtual std::exception
#include <bag_exceptions.h>

Invalid dimensions specified for the write.

struct LayerExists : public virtual std::exception
#include <bag_exceptions.h>

Layer already exists.

struct LayerNotFound : public virtual std::exception
#include <bag_exceptions.h>

Layer not found.

struct ReadOnlyError : public virtual std::exception
#include <bag_exceptions.h>

Attempted to modify a read only Dataset.

struct UnsupportedElementSize : public virtual std::exception
#include <bag_exceptions.h>

Attempt to use get the element size of an unsupported layer type.

struct UnsupportedLayerType : public virtual std::exception
#include <bag_exceptions.h>

Attempt to use an unknown layer type.

struct UnsupportedSimpleLayerType : public virtual std::exception
#include <bag_exceptions.h>

Attempt to use an incorrect layer type.

struct UnsupportedInterleavedLayer : public virtual std::exception
#include <bag_exceptions.h>

Attempt to make an unsupported interleaved layer.

struct InvalidLayerDescriptor : public virtual std::exception
#include <bag_exceptions.h>

The layer descriptor is not valid.

struct InvalidCast : public virtual std::exception
#include <bag_exceptions.h>

The type cannot be cast to the specified type.

struct CoordSysError : public virtual std::exception
#include <bag_exceptions.h>

Legacy CRS related. Ran into a problem (internal).

Subclassed by BAG::InvalidDatumError, BAG::InvalidEllipsoidError

struct InvalidDatumError : public virtual BAG::CoordSysError
#include <bag_exceptions.h>

Can not convert the datum.

struct InvalidEllipsoidError : public virtual BAG::CoordSysError
#include <bag_exceptions.h>

Can not convert the ellipsoid.

struct MetadataNotFound : public virtual std::exception
#include <bag_exceptions.h>

Attempt to make an unsupported interleaved layer.

struct UknownMetadataProfile : public virtual std::exception
#include <bag_exceptions.h>

An unknown metadata profile was specified when a known profile was expected.

struct UnrecognizedMetadataProfile : public virtual std::exception
#include <bag_exceptions.h>

An unrecognized metadata profile was specified.

struct ErrorLoadingMetadata : public virtual std::exception
#include <bag_exceptions.h>

An error occurred loading metadata.

struct UnsupportedDataType : public virtual std::exception
#include <bag_exceptions.h>

Cannot convert DataType to an HDF5 DataType.

struct TooManyCorrections : public virtual std::exception
#include <bag_exceptions.h>

Too many corrections specified.

struct UnknownSurfaceType : public virtual std::exception
#include <bag_exceptions.h>

Attempt to use an unknown surface type.

struct CannotReadNumCorrections : public virtual std::exception
#include <bag_exceptions.h>

Unknown reason why number of corrections could not be read from the BAG.

struct InvalidCorrector : public virtual std::exception
#include <bag_exceptions.h>

Invalid corrector specified (1-10).

struct UnsupportedSurfaceType : public virtual std::exception
#include <bag_exceptions.h>

The surface type is not supported for this operation.

struct FieldNotFound : public virtual std::exception
#include <bag_exceptions.h>

The specified field does not exist.

struct InvalidValue : public virtual std::exception
#include <bag_exceptions.h>

Attempt to use an invalid value.

struct InvalidValueSize : public virtual std::exception
#include <bag_exceptions.h>

The dimensions of the values in the GeorefMetadataLayer are invalid.

struct LayerRequiresChunkingSet : public virtual std::exception
#include <bag_exceptions.h>

Layer requires chunking set because it is dynamically sized.

struct DatasetRequiresVariableResolution : public virtual std::exception
#include <bag_exceptions.h>

The dataset must use variable resolution to read or write variable resolution metadata using the GeorefMetadataLayer.

struct InvalidValueKey : public virtual std::exception
#include <bag_exceptions.h>

Attempt to write a value to an invalid key.

struct ValueNotFound : public virtual std::exception
#include <bag_exceptions.h>

Attempt to use an invalid key.

struct InvalidVRRefinementDimensions : public virtual std::exception
#include <bag_exceptions.h>

VR Refinements are the wrong dimensions.

class GeorefMetadataLayer : public BAG::Layer
#include <bag_georefmetadatalayer.h>

The interface for a georeferenced metadata layer (spatial metadata).

Public Functions

GeorefMetadataLayer(Dataset &dataset, GeorefMetadataLayerDescriptor &descriptor, std::unique_ptr<::H5::DataSet, DeleteH5dataSet> h5keyDataSet, std::unique_ptr<::H5::DataSet, DeleteH5dataSet> h5vrKeyDataSet, std::unique_ptr<::H5::DataSet, DeleteH5dataSet> h5recordDataSet)

The constructor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

  • pH5keyDataSet – The HDF5 DataSet that will hold the single resolution keys.

  • pH5vrKeyDataSet – The HDF5 DataSet that will hold the variable resolution keys.

  • pH5valueDataSet – The HDF5 DataSet that will hold the spatial metadata values.

std::shared_ptr<GeorefMetadataLayerDescriptor> getDescriptor() & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

std::shared_ptr<const GeorefMetadataLayerDescriptor> getDescriptor() const & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

ValueTable &getValueTable() & noexcept

Retrieve the value table.

Returns:

The value table.

const ValueTable &getValueTable() const & noexcept

Retrieve the value table.

Returns:

The value table.

UInt8Array readVR(uint32_t indexStart, uint32_t indexEnd) const

Read the variable resolution metadata keys.

Parameters:
  • indexStart – The starting index to read. Must be less than or equal to indexEnd.

  • indexEnd – The ending index to read. (inclusive)

Returns:

The specified keys.

void writeVR(uint32_t indexStart, uint32_t indexEnd, const uint8_t *buffer)

Write the variable resolution metadata keys.

Parameters:
  • indexStart – The starting index to write. Must be less than or equal to indexEnd.

  • indexEnd – The ending index to write. (inclusive)

  • buffer – The keys to be written. Must contain at least indexEnd - indexStart + 1 keys!

Protected Static Functions

static std::shared_ptr<GeorefMetadataLayer> create(DataType keyType, const std::string &name, GeorefMetadataProfile profile, Dataset &dataset, const RecordDefinition &definition, uint64_t chunkSize, int compressionLevel)

Create a georeferenced metadata layer.

Parameters:
  • keyType – The type of key this layer will use.

  • name – The name of this georeferenced metadata layer. Must be a unique name among all georeferenced metadata layers in this BAG Dataset.

  • dataset – The BAG Dataset this georeferenced metadata layer will belong to.

  • definition – The list of fields describing a single record/value.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new georeferenced metadata layer.

static std::shared_ptr<GeorefMetadataLayer> open(Dataset &dataset, GeorefMetadataLayerDescriptor &descriptor)

Open an existing georeferenced metadata layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The georeferenced metadata layer read from dataset.

Private Functions

const ::H5::DataSet &getValueDataSet() const &

Retrieve the HDF5 DataSet containing the values.

Returns:

The HDF5 DataSet containing the values.

void setValueTable(std::unique_ptr<ValueTable> table) noexcept

Set the value table.

Parameters:

table – The new value table.

virtual UInt8Array readProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd) const override

Read a section of data from this layer.

Read data from this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

Returns:

The section of data specified by the rows and columns.

virtual void writeProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd, const uint8_t *buffer) override

Write a section of data to this layer.

Write data to this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

After writing the data, write the attributes.

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

  • buffer – The data to be written. It must contain at least (rowEnd - rowStart + 1) * (columnEnd - columnStart + 1) elements!

virtual void writeAttributesProxy() const override

Write the attributes this layer contains to disk.

Private Members

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> m_pH5keyDataSet

The HDF5 DataSet containing the single resolution keys.

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> m_pH5vrKeyDataSet

The HDF5 DataSet containing the variable resolution keys.

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> m_pH5valueDataSet

The HDF5 DataSet containing the values of the spatial metadata.

std::unique_ptr<ValueTable> m_pValueTable

The records in memory.

Private Static Functions

static std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5keyDataSet(const Dataset &inDataSet, const GeorefMetadataLayerDescriptor &descriptor)

Create an HDF5 DataSet for the keys of a single resolution georeferenced metadata layer with details from the descriptor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The HDF5 DataSet containing the single resolution keys of a new georeferenced metadata layer.

static std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5vrKeyDataSet(const Dataset &inDataSet, const GeorefMetadataLayerDescriptor &descriptor)

Create an HDF5 DataSet for the keys of a variable resolution georeferenced metadata layer with details from the descriptor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The HDF5 DataSet containing the variable resolution keys of a new georeferenced metadata layer.

static std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5valueDataSet(const Dataset &inDataSet, const GeorefMetadataLayerDescriptor &descriptor)

Create an HDF5 DataSet for the values of a georeferenced metadata layer with details from the descriptor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The HDF5 DataSet.

class GeorefMetadataLayerDescriptor : public BAG::LayerDescriptor
#include <bag_georefmetadatalayerdescriptor.h>

Describe a georeferenced metadata layer.

Public Functions

std::weak_ptr<Dataset> getDataset() const &

Retrieve the BAG Dataset this layer belongs to.

Returns:

The BAG Dataset.

const RecordDefinition &getDefinition() const & noexcept

Retrieve the definition of a record/value.

Returns:

The definition of a record/value.

GeorefMetadataProfile getProfile()

Retrieve the metadata profile type.

Returns:

The metadata profile type.

Public Static Functions

static std::shared_ptr<GeorefMetadataLayerDescriptor> create(Dataset &dataset, const std::string &name, GeorefMetadataProfile profile, DataType keyType, RecordDefinition definition, uint64_t chunkSize, int compressionLevel)

Create a georeferenced metadata layer descriptor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • name – The name of the simple layer this layer has metadata for.

  • keyType – The type of the key. Must be DT_UINT8, DT_UINT16, DT_UINT32, or DT_UINT64.

  • definition – The list of fields describing a record/value this layer contains for each node.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new georeferenced metadata layer descriptor.

static std::shared_ptr<GeorefMetadataLayerDescriptor> open(Dataset &dataset, const std::string &name)

Open an existing georeferenced metadata layer descriptor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • name – The name of the simple layer this layer has metadata for.

Returns:

The existing georeferenced metadata layer descriptor.

Protected Functions

GeorefMetadataLayerDescriptor(Dataset &dataset, const std::string &name, GeorefMetadataProfile profile, DataType keyType, RecordDefinition definition, uint64_t chunkSize, int compressionLevel)

Constructor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • name – The name of the simple layer this layer has metadata for.

  • keyType – The type of the key. Must be DT_UINT8, DT_UINT16, DT_UINT32, or DT_UINT64.

  • definition – The list of fields describing a record/value.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Private Functions

virtual DataType getDataTypeProxy() const noexcept override

Retrieve the data type.

Returns:

The data type the layer contains.

virtual uint8_t getElementSizeProxy() const noexcept override

Retrieve the element size.

Returns:

The element size of the layer.

Private Members

std::weak_ptr<Dataset> m_pBagDataset

The dataset this layer is from.

GeorefMetadataProfile m_profile = UNKNOWN_METADATA_PROFILE

The metadata profile that this layer conforms to.

DataType m_keyType = DT_UNKNOWN_DATA_TYPE

The key type.

uint8_t m_elementSize = 0

The size of a single key in the single/variable resolution HDF5 file.

RecordDefinition m_definition

The list of fields making up the record/value.

class InterleavedLegacyLayer : public BAG::Layer
#include <bag_interleavedlegacylayer.h>

The interface for an interleaved layer.

This class is only here to support older (pre 2.0) BAGs that have an optional layer of NODE or ELEVATION group type. In 2.0, these “interleaved” layers are split up into layers of each type in the group. The NODE group is made of Hypothesis_Strength and Num_Hypotheses. The ELEVATION group is made of Shoal_Elevation, Std_Dev and Num_Soundings.

Public Functions

InterleavedLegacyLayer(Dataset &dataset, InterleavedLegacyLayerDescriptor &descriptor, std::unique_ptr<::H5::DataSet, DeleteH5dataSet> h5dataSet)

Constructor.

Protected Static Functions

static std::shared_ptr<InterleavedLegacyLayer> open(Dataset &dataset, InterleavedLegacyLayerDescriptor &descriptor)

Open an existing interleaved layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Private Functions

virtual UInt8Array readProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd) const override

Read a section of data from this layer.

Read data from this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

Returns:

The section of data specified by the rows and columns.

virtual void writeProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd, const uint8_t *buffer) override

Write a section of data to this layer.

Write data to this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

After writing the data, write the attributes.

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

  • buffer – The data to be written. It must contain at least (rowEnd - rowStart + 1) * (columnEnd - columnStart + 1) elements!

virtual void writeAttributesProxy() const override

Write the attributes this layer contains to disk.

Private Members

std::unique_ptr<H5::DataSet, DeleteH5dataSet> m_pH5dataSet

The HDF5 DataSet.

class InterleavedLegacyLayerDescriptor : public BAG::LayerDescriptor
#include <bag_interleavedlegacylayerdescriptor.h>

Describe an interleaved layer.

Public Functions

GroupType getGroupType() const noexcept

Return the group type of this layer.

Returns:

The group type of this layer.

Public Static Functions

static std::shared_ptr<InterleavedLegacyLayerDescriptor> create(const Dataset &dataset, LayerType layerType, GroupType groupType)

Create an interleaved layer descriptor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • layerType – The type of layer to be read.

  • groupType – The type of group to be read. NODE or ELEVATION.

Returns:

The newly created interleaved layer descriptor.

static std::shared_ptr<InterleavedLegacyLayerDescriptor> open(const Dataset &dataset, LayerType layerType, GroupType groupType)

Open an interleaved layer descriptor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • layerType – The type of layer to be read.

  • groupType – The type of group to be read. NODE or ELEVATION.

Returns:

The newly opened interleaved layer descriptor.

Protected Functions

InterleavedLegacyLayerDescriptor(uint32_t id, LayerType layerType, GroupType groupType)

The constructor.

Parameters:
  • id – The unique layer id.

  • layerType – The type of layer to be read.

  • groupType – The type of group to be read. NODE or ELEVATION.

InterleavedLegacyLayerDescriptor(const Dataset &dataset, LayerType layerType, GroupType groupType)

The constructor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • layerType – The type of layer to be read.

  • groupType – The type of group to be read. NODE or ELEVATION.

Private Functions

virtual DataType getDataTypeProxy() const noexcept override

Retrieve the data type.

Returns:

The data type the layer contains.

virtual uint8_t getElementSizeProxy() const noexcept override

Retrieve the element size.

Returns:

The element size of the layer.

Private Members

GroupType m_groupType = UNKNOWN_GROUP_TYPE

The group type.

uint8_t m_elementSize = 0

The size of a node in the HDF5 DataSet (depends on group type).

Private Static Functions

static void validateTypes(LayerType layerType, GroupType groupType)

Verify the proper group and layer combination is given.

Validate the specified layer type is allowed for the group type.  If the
layer type is not valid for the specified group, an exception of type
UnsupportedInterleavedLayer is thrown.

Parameters:
  • layerType – The type of layer to be read.

  • groupType – The type of group to be read. NODE or ELEVATION.

class Layer
#include <bag_layer.h>

The interface for a layer.

Subclassed by BAG::GeorefMetadataLayer, BAG::InterleavedLegacyLayer, BAG::SimpleLayer, BAG::SurfaceCorrections, BAG::VRMetadata, BAG::VRNode, BAG::VRRefinements

Public Functions

std::shared_ptr<LayerDescriptor> getDescriptor() & noexcept

Retrieve the layer’s descriptor.

Returns:

The layer’s descriptor. Will never be nullptr.

std::shared_ptr<const LayerDescriptor> getDescriptor() const & noexcept

Retrieve the layer’s descriptor.

Returns:

The layer’s descriptor. Will never be nullptr.

UInt8Array read(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd) const

Read a section of data from this layer.

Read data from this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

Returns:

The section of data specified by the rows and columns.

void write(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd, const uint8_t *buffer)

Write a section of data to this layer.

Write data to this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

After writing the data, write the attributes.

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

  • buffer – The data to be written. It must contain at least (rowEnd - rowStart + 1) * (columnEnd - columnStart + 1) elements!

void writeAttributes() const

Write the attributes this layer contains to disk.

Public Static Functions

static DataType getDataType(LayerType layerType) noexcept

Determine the type of data stored in the specified layer type.

Returns:

The type of data stored in the specified layer type.

static uint8_t getElementSize(DataType type)

Retrieve the size of the specified data type.

Parameters:

The – type of data.

Returns:

The size of the specified data type.

static std::string getInternalPath(LayerType layerType, GroupType groupType = UNKNOWN_GROUP_TYPE)

Retrieve the HDF5 path of the specified layer.

Parameters:
  • layerType – The type of layer.

  • groupType – The type of group. NODE or ELEVATION.

Returns:

The HDF5 path to the specified layer and group types.

Protected Functions

Layer(Dataset &dataset, LayerDescriptor &descriptor)

Constructor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

std::weak_ptr<Dataset> getDataset() & noexcept

Retrieve the BAG Dataset this layer belongs to.

Returns:

The BAG Dataset this layer belongs to.

std::weak_ptr<const Dataset> getDataset() const & noexcept

Retrieve the BAG Dataset this layer belongs to.

Returns:

The BAG Dataset this layer belongs to.

Private Members

std::weak_ptr<Dataset> m_pBagDataset

The HDF5 DataSet this layer is stored in.

std::shared_ptr<LayerDescriptor> m_pLayerDescriptor

The layer’s descriptor (owned).

class LayerDescriptor : public std::enable_shared_from_this<LayerDescriptor>
#include <bag_layerdescriptor.h>

Describe a layer.

Subclassed by BAG::GeorefMetadataLayerDescriptor, BAG::InterleavedLegacyLayerDescriptor, BAG::SimpleLayerDescriptor, BAG::SurfaceCorrectionsDescriptor, BAG::VRMetadataDescriptor, BAG::VRNodeDescriptor, BAG::VRRefinementsDescriptor

Public Functions

uint64_t getChunkSize() const noexcept

Retrieve the chunk size.

Returns:

The chunk size.

int getCompressionLevel() const noexcept

Retrieve the compression level.

Returns:

The compression level of the layer.

DataType getDataType() const noexcept

Retrieve the data type.

Returns:

The data type the layer contains.

uint8_t getElementSize() const noexcept

Retrieve the element size.

Returns:

The element size of the layer.

uint32_t getId() const noexcept

Retrieve the unique id.

Returns:

The id of the layer.

const std::string &getInternalPath() const & noexcept

Retrieve the HDF5 path.

Returns:

The HDF5 path of the layer. In the case of a GeorefMetadataLayer, the path to the unique group name is returned. To read a DataSet using this path, add ‘/keys’, ‘/varres_keys’, or ‘/values’.

LayerType getLayerType() const noexcept

Retrieve the type this layer contains.

Returns:

The type this layer contains.

std::tuple<float, float> getMinMax() const noexcept

Retrieve the minimum and maximum values.

Returns:

The minimum and maximum values this layer contains.

const std::string &getName() const & noexcept

Retrieve the name.

Returns:

The name of the layer.

LayerDescriptor &setName(std::string inName) & noexcept

Set the name of the layer.

Parameters:

inName – The new name of the layer.

Returns:

The descriptor. Useful for chaining set calls.

LayerDescriptor &setMinMax(float min, float max) & noexcept

Set the minimum and maximum values that are found in the layer.

Parameters:
  • min – The minimum value that is stored in this layer.

  • max – The maximum value that is stored in this layer.

Returns:

The descriptor. Useful for chaining set calls.

Protected Functions

LayerDescriptor(uint32_t id, std::string internalPath, std::string name, LayerType type, uint64_t chunkSize, int compressionLevel)

Constructor.

\parm id The unique identifier of the layer. \parm internalPath The HDF5 path of the layer. \parm name The name of the layer. \parm type The type of layer.

Parameters:
  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

LayerDescriptor(const Dataset &dataset, LayerType type, std::string internalPath = {}, std::string name = {})

Constructor.

Parameters:

dataset – The BAG Dataset this layer belongs to. \parm type The type of layer. \parm internalPath The HDF5 path of the layer. \parm name The name of the layer.

size_t getReadBufferSize(uint32_t rows, uint32_t columns) const noexcept

Get the size of a buffer for reading a specified number rows and columns.

Parameters:
  • rows – The number of rows that will be allocated for.

  • columns – The number of columns that will be allocated for.

Returns:

A buffer that can hold rows x columns of values of this layer.

LayerDescriptor &setInternalPath(std::string inPath) & noexcept

Set the HDF5 path of the layer.

Parameters:

inPath – The new HDF5 path of the layer.

Returns:

The descriptor. Useful for chaining set calls.

Private Members

uint32_t m_id = kInvalidLayerId

The unique id.

LayerType m_layerType = UNKNOWN_LAYER_TYPE

The layer type.

std::string m_internalPath

The path of the DataSet in the HDF5 file.

std::string m_name

The name of the layer.

int m_compressionLevel = 0

The compression level of this layer (0-9).

uint64_t m_chunkSize = 0

The chunk size of this layer.

std::tuple<float, float> m_minMax = {}

The minimum and maximum value of this dataset.

class LayerItems
#include <bag_layeritems.h>

Public Functions

template<typename OldType, typename NewType>
inline LayerItems convert() const

Convert the item(s) from OldType into NewType.

struct BagProjectionParameters
#include <bag_legacy_crs.h>

Structure for parameters of all bag supported horizontal coord. sys. mercator, tm, utm, ps, ups, lambert, & geodetic.

Public Members

BagDatum datum = {BagDatum::unknown}

wgs84, wgs72, nad83, …

char ellipsoid[256] = {}

ellipsoid

char vertical_datum[256] = {}

vertical datum

double origin_latitude = 0.

degrees

double central_meridian = 0.

degrees

double std_parallel_1 = 0.

degrees

double std_parallel_2 = 0.

degrees

double false_easting = 0.

meters

double false_northing = 0.

meters

double scale_factor = 0.

unitless

double latitude_of_true_scale = 0.

degrees

double longitude_down_from_pole = 0.

degrees

double latitude_of_centre = 0.

degrees

double longitude_of_centre = 0.

degrees

int32_t zone = 0

utm zone 1-60

int32_t utm_override = 0

utm: 0=autozone,1=use zone

struct BagLegacyReferenceSystem
#include <bag_legacy_crs.h>

Legacy Reference system definition.

Public Members

CoordinateType coordSys = {CoordinateType::Unknown}

Geodetic, Mercator, Transvers_Mercator, etc.

BagProjectionParameters geoParameters

Parameters for projection information.

class Metadata
#include <bag_metadata.h>

The interface for the metadata.

Public Functions

Metadata() noexcept

The default constructor.

explicit Metadata(Dataset &dataset)

Constructor.

Parameters:

dataset – The BAG Dataset the metadata belongs to.

explicit Metadata(std::shared_ptr<Dataset> pDataset)

Constructor.

Parameters:

pDataset – A shared pointer to the BAG Dataset the metadata belongs to.

~Metadata() noexcept

Destructor.

const BagMetadata &getStruct() const & noexcept

Retrieve the C structure this class wraps.

Returns:

The C structure this class wraps.

uint32_t columns() const noexcept

Retrieve the number of columns.

Returns:

The number of columns.

double columnResolution() const noexcept

Retrieve the column resolution.

Returns:

The column resolution.

std::string horizontalReferenceSystemAsWKT() const

Retrieve a copy of the horizontal reference system as WKT.

Returns:

A copy of the horizontal reference system as WKT. The string is empty if it is not WKT.

double llCornerX() const noexcept

Retrieve the lower left corner’s X value.

Returns:

The lower left corner’s X value.

double llCornerY() const noexcept

Retrieve the lower left corner’s Y value.

Returns:

The lower left corner’s Y value.

double rowResolution() const noexcept

Retrieve the row resolution.

Returns:

The row resolution.

uint32_t rows() const noexcept

Retrieve the number of rows.

Returns:

The number of rows.

double urCornerX() const noexcept

Retrieve the upper right corner’s X value.

Returns:

The upper right corner’s X value.

double urCornerY() const noexcept

Retrieve the upper right corner’s Y value.

Returns:

The upper right corner’s Y value.

std::string verticalReferenceSystemAsWKT() const

Retrieve a copy of the vertical reference system as WKT.

Returns:

A copy of the vertical reference system as WKT. The string is empty if it is not WKT.

void loadFromFile(const std::string &fileName)

Populate the metadata from the XML in the specified file.

Read the XML from the specified file.  An ErrorLoadingMetadata exception is
thrown if an error occurs.

Parameters:

fileName – The XML file to read into this class.

void loadFromBuffer(const std::string &xmlBuffer)

Populate the metadata from the XML in the specified buffer.

Read the XML from the specified buffer.  An ErrorLoadingMetadata exception
is thrown if an error occurs.

Parameters:

xmlBuffer – The XML buffer..

size_t getXMLlength() const noexcept

Retrieve the length of the XML in this metadata.

Returns:

The length of the XML in this metadata.

Private Functions

void createH5dataSet(const Dataset &inDataSet)

Create an HDF5 DataSet to store the metadata.

Parameters:

dataset – The BAG Dataset this layer belongs to.

void write() const

Write the metadata to the HDF5 file.

Private Members

std::weak_ptr<const Dataset> m_pBagDataset

The BAG Dataset the metadata is part of.

std::unique_ptr<BagMetadata> m_pMetaStruct

The C struct behind this class.

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> m_pH5dataSet

The HDF5 DataSet this class wraps.

size_t m_xmlLength = 0

Length of the XML (from file or buffer).

class SimpleLayer : public BAG::Layer
#include <bag_simplelayer.h>

The interface for a simple layer.

Public Functions

SimpleLayer(Dataset &dataset, SimpleLayerDescriptor &descriptor, std::unique_ptr<::H5::DataSet, DeleteH5dataSet> h5dataSet)

Constructor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

  • pH5dataSet – The HDF5 DataSet that stores this layer.

Protected Static Functions

static std::shared_ptr<SimpleLayer> create(Dataset &dataset, LayerType type, uint64_t chunkSize, int compressionLevel)

Create a new simple layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • type – The type of layer.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new simple layer.

static std::shared_ptr<SimpleLayer> open(Dataset &dataset, SimpleLayerDescriptor &descriptor)

Open an existing simple layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The specified simple layer.

Private Functions

virtual UInt8Array readProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd) const override

Read a section of data from this layer.

Read data from this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

Returns:

The section of data specified by the rows and columns.

virtual void writeProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd, const uint8_t *buffer) override

Write a section of data to this layer.

Write data to this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

After writing the data, write the attributes.

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

  • buffer – The data to be written. It must contain at least (rowEnd - rowStart + 1) * (columnEnd - columnStart + 1) elements!

virtual void writeAttributesProxy() const override

Write the attributes this layer contains to disk.

Private Members

std::unique_ptr<H5::DataSet, DeleteH5dataSet> m_pH5dataSet

The HDF5 DataSet.

Private Static Functions

static std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5dataSet(const Dataset &inDataSet, const SimpleLayerDescriptor &descriptor)

Create the HDF5 DataSet.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The new HDF5 DataSet.

class SimpleLayerDescriptor : public BAG::LayerDescriptor
#include <bag_simplelayerdescriptor.h>

Describe a simple layer.

Public Static Functions

static std::shared_ptr<SimpleLayerDescriptor> create(const Dataset &dataset, LayerType type, uint64_t chunkSize, int compressionLevel)

Create a new simple layer descriptor.

Parameters:
  • dataset – The BAG Dataset this layer will belong to.

  • type – The layer type.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new simple layer descriptor.

static std::shared_ptr<SimpleLayerDescriptor> open(const Dataset &dataset, LayerType type)

Open an existing simple layer descriptor.

Parameters:
  • dataset – The BAG Dataset this layer will belong to.

  • type – The layer type.

Returns:

The simple layer descriptor.

Protected Functions

SimpleLayerDescriptor(uint32_t id, LayerType type, uint64_t chunkSize, int compressionLevel)

Constructor.

Parameters:
  • id – The unique layer id.

  • type – The layer type.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

SimpleLayerDescriptor(const Dataset &dataset, LayerType type)

Constructor.

Parameters:
  • dataset – The BAG Dataset this layer will belong to.

  • type – The layer type.

Private Functions

virtual DataType getDataTypeProxy() const noexcept override

Retrieve the data type.

Returns:

The data type the layer contains.

virtual uint8_t getElementSizeProxy() const noexcept override

Retrieve the element size.

Returns:

The element size of the layer.

Private Members

uint8_t m_elementSize = 0

The size of a single node in the HDF5 file.

class SurfaceCorrections : public BAG::Layer
#include <bag_surfacecorrections.h>

The interface for the surface corrections layer.

Public Functions

SurfaceCorrections(Dataset &dataset, SurfaceCorrectionsDescriptor &descriptor, std::unique_ptr<::H5::DataSet, DeleteH5dataSet> pH5dataSet)

Constructor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

  • pH5dataSet – The HDF5 DataSet that stores this interleaved layer.

std::shared_ptr<SurfaceCorrectionsDescriptor> getDescriptor() & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

std::shared_ptr<const SurfaceCorrectionsDescriptor> getDescriptor() const & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

UInt8Array readCorrected(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd, uint8_t corrector, const SimpleLayer &layer) const

Read a corrected region from a simple layer using the specified corrector.

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

  • corrector – The corrector to use when applying a correction. Valid values are 1-10.

  • layer – The simple layer to correct.

Returns:

The corrected date from the simple layer using the specified corrector.

UInt8Array readCorrectedRow(uint32_t row, uint32_t columnStart, uint32_t columnEnd, uint8_t corrector, const SimpleLayer &layer) const

Read a corrected row from a simple layer using the specified corrector.

Parameters:
  • row – The row.

  • columnStart – The starting column.

  • columnEnd – The ending column (inclusive).

  • corrector – The corrector to use when applying a correction. Valid values are 1-10.

  • layer – The simple layer to correct.

Returns:

The corrected date from the simple layer using the specified corrector.

Protected Static Functions

static std::shared_ptr<SurfaceCorrections> create(Dataset &dataset, BAG_SURFACE_CORRECTION_TOPOGRAPHY type, uint8_t numCorrectors, uint64_t chunkSize, int compressionLevel)

Create a surface corrections layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • type – The type of surface correction topography.

  • numCorrectors – The number of correctors provided. Valid range is 1-10.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new surface corrections layer.

static std::shared_ptr<SurfaceCorrections> open(Dataset &dataset, SurfaceCorrectionsDescriptor &descriptor)

Open an existing surface corrections layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The new surface corrections layer.

Private Functions

const ::H5::DataSet &getH5dataSet() const & noexcept

Retrieve the HDF5 DataSet.

virtual UInt8Array readProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd) const override

Read a section of data from this layer.

Read data from this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

Returns:

The section of data specified by the rows and columns.

virtual void writeProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd, const uint8_t *buffer) override

Write a section of data to this layer.

Write data to this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

After writing the data, write the attributes.

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

  • buffer – The data to be written. It must contain at least (rowEnd - rowStart + 1) * (columnEnd - columnStart + 1) elements!

virtual void writeAttributesProxy() const override

Write the attributes this layer contains to disk.

Private Members

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> m_pH5dataSet

The HDF5 DataSet this class relates to.

Private Static Functions

static std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5dataSet(const Dataset &dataset, const SurfaceCorrectionsDescriptor &descriptor)

Create the HDF5 DataSet.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The new HDF5 DataSet.

class SurfaceCorrectionsDescriptor : public BAG::LayerDescriptor
#include <bag_surfacecorrectionsdescriptor.h>

Describe a surface corrections layer.

Public Functions

std::tuple<uint32_t, uint32_t> getDims() const noexcept

Retrieve the dimensions of the surface corrections layer.

Returns:

The dimensions of the surface corrections layer.

uint8_t getNumCorrectors() const noexcept

Retrieve the number of correctors.

Returns:

The number of correctors.

std::tuple<double, double> getOrigin() const noexcept

Retrieve the south west corner of the surface corrections layer.

Returns:

The south west corner of the surface corrections layer.

std::tuple<double, double> getSpacing() const noexcept

Retrieve the X and Y spacing/resolution of the surface corrections layer.

Returns:

The X and Y spacing/resolution of the surface corrections layer.

BAG_SURFACE_CORRECTION_TOPOGRAPHY getSurfaceType() const noexcept

Retrieve surface correction topography.

Returns:

The surface correction topography.

const std::string &getVerticalDatums() const & noexcept

Retrieve the vertical datums.

Returns:

The vertical datums.

SurfaceCorrectionsDescriptor &setDims(uint32_t numRows, uint32_t numColumns) & noexcept

Set the grid dimensions.

Parameters:
  • numRows – The new number of rows.

  • numColumns – The new number of columns.

Returns:

The surface corrections descriptor.

SurfaceCorrectionsDescriptor &setOrigin(double swX, double swY) & noexcept

Set the south west corner.

Parameters:
  • swX – The X value of the south west corner. Geographic location.

  • swY – The Y value of the south west corner. Geographic location.

Returns:

The surface corrections descriptor.

SurfaceCorrectionsDescriptor &setSpacing(double xSpacing, double ySpacing) & noexcept

Set the X and Y spacing/resolution.

Parameters:
  • xSpacing – The X spacing/resolution.

  • ySpacing – The Y spacing/resolution.

Returns:

The surface corrections descriptor.

SurfaceCorrectionsDescriptor &setVerticalDatums(std::string verticalDatums) & noexcept

Set the vertical datums.

Parameters:

verticalDatums – The vertical datums.

Returns:

The surface corrections descriptor.

Public Static Functions

static std::shared_ptr<SurfaceCorrectionsDescriptor> create(const Dataset &dataset, BAG_SURFACE_CORRECTION_TOPOGRAPHY type, uint8_t numCorrections, uint64_t chunkSize, int compressionLevel)

Create a surface corrections layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • type – The type of surface corrections.

  • numCorrectors – The number of correctors.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

static std::shared_ptr<SurfaceCorrectionsDescriptor> open(const Dataset &dataset)

Open an existing surface corrections layer.

Parameters:

dataset – The BAG Dataset this layer belongs to.

Protected Functions

SurfaceCorrectionsDescriptor(uint32_t id, BAG_SURFACE_CORRECTION_TOPOGRAPHY type, uint8_t numCorrectors, uint64_t chunkSize, int compressionLevel)

Constructor.

Parameters:
  • id – The unique layer id.

  • type – The type of surface corrections.

  • numCorrectors – The number of correctors.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

explicit SurfaceCorrectionsDescriptor(const Dataset &dataset)

Constructor.

Parameters:

dataset – The BAG Dataset this layer belongs to.

Private Functions

virtual DataType getDataTypeProxy() const noexcept override

Retrieve the data type.

Returns:

The data type the layer contains.

virtual uint8_t getElementSizeProxy() const noexcept override

Retrieve the element size.

Returns:

The element size of the layer.

Private Members

BAG_SURFACE_CORRECTION_TOPOGRAPHY m_surfaceType = BAG_SURFACE_UNKNOWN

The type of surface this correction applies to.

uint8_t m_elementSize = 0

The size of a node.

uint8_t m_numCorrectors = 0

Number of correction values.

std::string m_verticalDatums

The name of the vertical datum(s).

double m_swX = 0.

South-West corner X’s value.

double m_swY = 0.

South-West corner Y’s value.

double m_xSpacing = 0.

Node spacing X.

double m_ySpacing = 0.

Node spacing Y.

uint32_t m_numRows = 0

Number of rows.

uint32_t m_numColumns = 0

Number of columns.

class TrackingList
#include <bag_trackinglist.h>

The interface for a tracking list.

Public Functions

iterator begin() & noexcept

Retrieve an iterator to the first item in the tracking list.

Returns:

An iterator to the first item in the tracking list.

const_iterator begin() const & noexcept

Retrieve an iterator to the first item in the tracking list.

Returns:

An iterator to the first item in the tracking list.

iterator end() & noexcept

Retrieve an iterator to one past the last item in the tracking list.

Returns:

An iterator to one past the last item in the tracking list.

const_iterator end() const & noexcept

Retrieve an iterator to one past the last item in the tracking list.

Returns:

An iterator to one past the last item in the tracking list.

const_iterator cbegin() const & noexcept

Retrieve an iterator to the first item in the tracking list.

Returns:

An iterator to the first item in the tracking list.

const_iterator cend() const & noexcept

Retrieve an iterator to one past the last item in the tracking list.

Returns:

An iterator to one past the last item in the tracking list.

void clear() noexcept

Empty the tracking list.

void push_back(const value_type &value)

Add an item to the end of the tracking list.

Parameters:

value – The item to add.

void push_back(value_type &&value)

Add an item to the end of the tracking list.

Parameters:

value – The item to add.

reference front() &

Retrieve the first item in the tracking list.

Returns:

The first item in the tracking list.

const_reference front() const &

Retrieve the first item in the tracking list.

Returns:

The first item in the tracking list.

reference back() &

Retrieve the last item in the tracking list.

Returns:

The last item in the tracking list.

const_reference back() const &

Retrieve the last item in the tracking list.

Returns:

The last item in the tracking list.

void reserve(size_t newCapacity)

Reserve more space in the tracking list.

Reserve more space in the tracking list.  If the amount to be reserved is
less than the current capacity, do nothing.

Parameters:

newCapacity – The new capacity of the tracking list.

void resize(size_t count)

Resize the tracking list to the new value.

Parameters:

count – The new size of the tracking list.

value_type *data() & noexcept

Retrieve a pointer to the first item in the tracking list.

Returns:

A pointer to the first item in the tracking list.

const value_type *data() const & noexcept

Retrieve a pointer to the first item in the tracking list.

Returns:

A pointer to the first item in the tracking list.

bool empty() const noexcept

Determine if the tracking list is empty.

Returns:

true if the tracking list is empty. false otherwise.

size_t size() const noexcept

Retrieve the number of items in the tracking list.

Returns:

The number of items in the tracking list.

reference operator[](size_t index) & noexcept

Retrieve the item at the specified index.

Returns:

The item at the specified index.

const_reference operator[](size_t index) const & noexcept

Retrieve the item at the specified index.

Returns:

The item at the specified index.

void write() const

Write the tracking list to the HDF5 DataSet.

template<typename ...Args>
void emplace_back(Args&&... args) &

Add an item to the end of the tracking list.

Parameters:

args – One or more parameters to hand to the constructor of TrackingItem.

Protected Functions

explicit TrackingList(const Dataset &dataset)

Constructor.

Parameters:

dataset – The BAG Dataset the tracking list belongs to.

TrackingList(const Dataset &dataset, int compressionLevel)

Constructor.

Parameters:
  • dataset – The BAG Dataset the tracking list belongs to.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Private Functions

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5dataSet(int compressionLevel)

Create the HDF5 DataSet the tracking list wraps.

Parameters:

compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The HDF5 DataSet the tracking list wraps.

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> openH5dataSet()

Open an existing HDF5 DataSet the tracking list wraps.

Returns:

The HDF5 DataSet the tracking list wraps.

Private Members

std::weak_ptr<const Dataset> m_pBagDataset

The associated BAG Dataset.

std::vector<value_type> m_items

The items in the tracking list.

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> m_pH5dataSet

The HDF5 DataSet this class wraps.

class UInt8Array
#include <bag_uint8array.h>

Class to get past SWIG not being able to handle std::unique_ptr<uint8_t[]>.

class ValueTable
#include <bag_valuetable.h>

The interface for the values of the spatial metadata in the georeferenced metadata layer.

Public Functions

const Records &getRecords() const & noexcept

Retrieve all the records/values.

Returns:

All the records/values. NOTE! This includes the no data value record at index 0.

const RecordDefinition &getDefinition() const & noexcept

Retrieve the record/value definition.

Returns:

The list of fields that define the record/value.

const CompoundDataType &getValue(size_t key, const std::string &name) const &

Retrieve the value of a specific field in a specific record.

Parameters:
  • key – The key of the record/value. Must be greater than 0.

  • name – The name of the field.

Returns:

The value specified. An exception is thrown if the key or field name is invalid.

const CompoundDataType &getValue(size_t key, size_t fieldIndex) const &

Retrieve the value of a specific field in a specific record/value.

Parameters:
  • key – The key of the record/value. Must be greater than 0.

  • fieldIndex – The index of the field.

Returns:

The value specified. An exception is thrown if the record index or field index are invalid.

size_t getFieldIndex(const std::string &name) const

Retrieve the field index of the named field.

Parameters:

name – The name of the field.

Returns:

The field index of the named field.

const char *getFieldName(size_t index) const &

Retrieve the field name of the indexed field.

Parameters:

index – The index of the field.

Returns:

The field name of the indexed field.

size_t addRecord(const Record &record)

Add a record/value to the end of the list.

Parameters:

record – The record/value.

Returns:

The index of the added record.

void addRecords(const Records &records)

Add multiple records/values to the end of the list.

Parameters:

records – The records/values.

void setValue(size_t key, const std::string &name, const CompoundDataType &value)

Set a value in a specific field in a specific record.

Parameters:
  • key – The record/value key. Must be greater than 0.

  • name – The name of the field.

  • value – The value to put into the field.

void setValue(size_t key, size_t fieldIndex, const CompoundDataType &value)

Set a value in a specific field in a specific record.

Parameters:
  • key – The record key. Must be greater than 0.

  • fieldIndex – The index of the field.

  • value – The value to put into the field.

Protected Functions

explicit ValueTable(const GeorefMetadataLayer &layer)

Constructor.

Parameters:

layer – The layer the value table holds records/values for.

Private Functions

std::vector<uint8_t> convertRecordToRaw(const Record &record) const

Convert a record/value to a chunk of memory.

Parameters:

record – The record/value to convert.

Returns:

A copy of the record/value as a chunk of memory.

std::vector<uint8_t> convertRecordsToRaw(const std::vector<Record> &records) const

Convert multiple records/values to a chunk of memory.

Parameters:

records – The records/values to convert.

Returns:

A copy of the records/values as a chunk of memory.

bool validateRecord(const Record &record) const

Determine if the specified record/value matches the definition used by the value table.

Parameters:

record – The record/value.

Returns:

true if the record/value matches the definition. false otherwise

void writeRecord(size_t key, const Record &record)

Write a record/value to the HDF5 DataSet at the specified key.

Parameters:
  • key – The record key. Must be greater than 0.

  • record – The record/value to write.

void writeRecords(const std::vector<Record> &records)

Write multiple records/values at the end of the list to the HDF5 DataSet.

Parameters:

records – The records/values.

Private Members

const GeorefMetadataLayer &m_layer

The layer these records pertain to.

Records m_records

The stored values.

class VRMetadata : public BAG::Layer
#include <bag_vrmetadata.h>

The interface for variable resolution metadata.

Public Functions

VRMetadata(Dataset &dataset, VRMetadataDescriptor &descriptor, std::unique_ptr<::H5::DataSet, DeleteH5dataSet> pH5dataSet)

Constructor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

  • pH5dataSet – The HDF5 DataSet this class wraps.

std::shared_ptr<VRMetadataDescriptor> getDescriptor() & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

std::shared_ptr<const VRMetadataDescriptor> getDescriptor() const & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

Protected Static Functions

static std::shared_ptr<VRMetadata> create(Dataset &dataset, uint64_t chunkSize, int compressionLevel)

Create a new variable resolution metadata layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new variable resolution metadata.

static std::shared_ptr<VRMetadata> open(Dataset &dataset, VRMetadataDescriptor &descriptor)

Open a variable resolution metadata layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The variable resolution metadata.

Private Functions

virtual UInt8Array readProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd) const override

Read a section of data from this layer.

Read data from this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

Returns:

The section of data specified by the rows and columns.

virtual void writeProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd, const uint8_t *buffer) override

Write a section of data to this layer.

Write data to this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

After writing the data, write the attributes.

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

  • buffer – The data to be written. It must contain at least (rowEnd - rowStart + 1) * (columnEnd - columnStart + 1) elements!

virtual void writeAttributesProxy() const override

Write the attributes this layer contains to disk.

Private Members

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> m_pH5dataSet

The HDF5 DataSet the metadata wraps.

Private Static Functions

static std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5dataSet(const Dataset &dataset, const VRMetadataDescriptor &descriptor)

Create the HDF5 DataSet.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The HDF5 Dataset for this variable resolution metadata layer.

class VRMetadataDescriptor : public BAG::LayerDescriptor
#include <bag_vrmetadatadescriptor.h>

Describe the variable resolution metadata.

Public Functions

std::tuple<uint32_t, uint32_t> getMaxDimensions() const noexcept

Retrieve the maximum dimensions.

Returns:

The maximum X and Y dimensions.

std::tuple<float, float> getMaxResolution() const noexcept

Retrieve the maximum resolution.

Returns:

The maximum X and Y resolution.

std::tuple<uint32_t, uint32_t> getMinDimensions() const noexcept

Retrieve the minimum dimensions.

Returns:

The minimum X and Y dimensions.

std::tuple<float, float> getMinResolution() const noexcept

Retrieve the minimum resolution.

Returns:

The minimum X and Y resolution.

VRMetadataDescriptor &setMaxDimensions(uint32_t maxDimX, uint32_t maxDimY) & noexcept

Set the maximum dimensions.

Parameters:
  • maxDimX – The maximum X dimension.

  • maxDimY – The maximum Y dimension.

Returns:

The variable resolution metadata descriptor.

VRMetadataDescriptor &setMaxResolution(float maxResX, float maxResY) & noexcept

Set the maximum resolution.

Parameters:
  • maxResX – The maximum X resolution.

  • maxResY – The maximum Y resolution.

Returns:

The variable resolution metadata descriptor.

VRMetadataDescriptor &setMinDimensions(uint32_t minDimX, uint32_t minDimY) & noexcept

Set the minimum dimensions.

Parameters:
  • minDimX – The minimum X dimension.

  • minDimY – The minimum Y dimension.

Returns:

The variable resolution metadata descriptor.

VRMetadataDescriptor &setMinResolution(float minResX, float minResY) & noexcept

Set the minimum resolution.

Parameters:
  • minResX – The minimum X resolution.

  • minResY – The minimum Y resolution.

Returns:

The variable resolution metadata descriptor.

Protected Functions

VRMetadataDescriptor(uint32_t id, uint64_t chunkSize, int compressionLevel)

Constructor.

Parameters:
  • id – The unique layer id.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

explicit VRMetadataDescriptor(const Dataset &dataset)

Constructor.

Parameters:

dataset – The BAG Dataset this layer belongs to.

Protected Static Functions

static std::shared_ptr<VRMetadataDescriptor> create(const Dataset &dataset, uint64_t chunkSize, int compressionLevel)

Create a variable resolution metadata descriptor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new variable resolution metadata descriptor.

static std::shared_ptr<VRMetadataDescriptor> open(const Dataset &dataset)

Open an existing variable resolution metadata descriptor.

Parameters:

dataset – The BAG Dataset this layer belongs to.

Returns:

The variable resolution metadata descriptor.

Private Functions

virtual DataType getDataTypeProxy() const noexcept override

Retrieve the data type.

Returns:

The data type the layer contains.

virtual uint8_t getElementSizeProxy() const noexcept override

Retrieve the element size.

Returns:

The element size of the layer.

Private Members

uint32_t m_minDimX = std::numeric_limits<uint32_t>::max()

The minimum X dimension.

uint32_t m_minDimY = std::numeric_limits<uint32_t>::max()

The minimum Y dimension.

uint32_t m_maxDimX = std::numeric_limits<uint32_t>::lowest()

The maximum X dimension.

uint32_t m_maxDimY = std::numeric_limits<uint32_t>::lowest()

The maximum Y dimension.

float m_minResX = std::numeric_limits<float>::max()

The minimum X resolution.

float m_minResY = std::numeric_limits<float>::max()

The minimum Y resolution.

float m_maxResX = std::numeric_limits<float>::lowest()

The maximum X resolution.

float m_maxResY = std::numeric_limits<float>::lowest()

The maximum Y resolution.

class VRNode : public BAG::Layer
#include <bag_vrnode.h>

Interface for the variable resolution node layer.

Public Functions

VRNode(Dataset &dataset, VRNodeDescriptor &descriptor, std::unique_ptr<::H5::DataSet, DeleteH5dataSet> pH5dataSet)

Constructor.

Parameters:
  • dataset – The BAG Dataset that this layer belongs to.

  • descriptor – The descriptor of this layer.

  • pH5dataSet – The HDF5 DataSet this class wraps.

std::shared_ptr<VRNodeDescriptor> getDescriptor() & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

std::shared_ptr<const VRNodeDescriptor> getDescriptor() const & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

Protected Static Functions

static std::shared_ptr<VRNode> create(Dataset &dataset, uint64_t chunkSize, int compressionLevel)

Create a variable resolution node.

Parameters:
  • dataset – The BAG Dataset that this layer belongs to.

  • chunkSize – The chunk size in the HDF5 DataSet.

  • compressionLevel – The compression level in the HDF5 DataSet.

Returns:

The new variable resolution node.

static std::shared_ptr<VRNode> open(Dataset &dataset, VRNodeDescriptor &descriptor)

Open an existing variable resolution node.

Parameters:
  • dataset – The BAG Dataset that this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The specified variable resolution node.

Private Functions

virtual UInt8Array readProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd) const override

Read a section of data from this layer.

Read data from this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

Returns:

The section of data specified by the rows and columns. The rowStart and rowEnd are ignored since the data is 1 dimensional.

virtual void writeProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd, const uint8_t *buffer) override

Write a section of data to this layer.

Write data to this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

After writing the data, write the attributes.

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

  • buffer – The data to be written. It must contain at least (rowEnd - rowStart + 1) * (columnEnd - columnStart + 1) elements! Ignore rows since the data is 1 dimensional.

virtual void writeAttributesProxy() const override

Write the attributes this layer contains to disk.

Private Members

std::unique_ptr<H5::DataSet, DeleteH5dataSet> m_pH5dataSet

The HDF5 DataSet this layer wraps.

Private Static Functions

static std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5dataSet(const Dataset &dataset, const VRNodeDescriptor &descriptor)

Create the HDF5 DataSet.

Parameters:
  • dataset – The BAG Dataset that this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The new HDF5 DataSet.

class VRNodeDescriptor : public BAG::LayerDescriptor
#include <bag_vrnodedescriptor.h>

Describe the variable resolution node.

Public Functions

std::tuple<float, float> getMinMaxHypStrength() const noexcept

Retrieve the minimum and maximum hypotheses strength.

Returns:

The minimum and maximum hypotheses strength.

std::tuple<uint32_t, uint32_t> getMinMaxNSamples() const noexcept

Retrieve the minimum and maximum n samples.

Returns:

The minimum and maximum n samples.

std::tuple<uint32_t, uint32_t> getMinMaxNumHypotheses() const noexcept

Retrieve the minimum and maximum number of hypotheses.

Returns:

The minimum and maximum number of hypotheses.

VRNodeDescriptor &setMinMaxHypStrength(float minHypStrength, float maxHypStrength) & noexcept

Set the minimum and maximum hypotheses strength.

Parameters:
  • minHypStrength – The minimum hypotheses strength.

  • maxHypStrength – The maximum hypotheses strength.

Returns:

The variable resolution node descriptor.

VRNodeDescriptor &setMinMaxNSamples(uint32_t minNSamples, uint32_t maxNSamples) & noexcept

Set the minimum and maximum number of samples.

Parameters:
  • minNSamples – The minimum number of samples.

  • maxNSamples – The maximum number of samples.

Returns:

The variable resolution node descriptor.

VRNodeDescriptor &setMinMaxNumHypotheses(uint32_t minNumHypotheses, uint32_t maxNumHypotheses) & noexcept

Set the minimum and maximum number of hypotheses.

Parameters:
  • minNumHypotheses – The minimum number of hypotheses.

  • maxNumHypotheses – The maximum number of hypotheses.

Returns:

The variable resolution node descriptor.

Protected Functions

VRNodeDescriptor(uint32_t id, uint64_t chunkSize, int compressionLevel)

Constructor.

Parameters:
  • id – The unique layer id.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

explicit VRNodeDescriptor(const Dataset &dataset)

Constructor.

Parameters:

dataset – The BAG Dataset this layer belongs to.

Protected Static Functions

static std::shared_ptr<VRNodeDescriptor> create(const Dataset &dataset, uint64_t chunkSize, int compressionLevel)

Create a mew variable resolution node.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

A new variable resolution node layer.

static std::shared_ptr<VRNodeDescriptor> open(const Dataset &dataset)

Open an existing variable resolution node.

Parameters:

dataset – The BAG Dataset this layer belongs to.

Private Functions

virtual DataType getDataTypeProxy() const noexcept override

Retrieve the data type.

Returns:

The data type the layer contains.

virtual uint8_t getElementSizeProxy() const noexcept override

Retrieve the element size.

Returns:

The element size of the layer.

Private Members

float m_minHypStrength = std::numeric_limits<float>::max()

The minimum hypotheses strength.

float m_maxHypStrength = std::numeric_limits<float>::lowest()

The maximum hypotheses strength.

uint32_t m_minNumHypotheses = std::numeric_limits<uint32_t>::max()

The minimum number of hypotheses.

uint32_t m_maxNumHypotheses = std::numeric_limits<uint32_t>::lowest()

The maximum number of hypotheses.

uint32_t m_minNSamples = std::numeric_limits<uint32_t>::max()

The minimum number of samples..

uint32_t m_maxNSamples = std::numeric_limits<uint32_t>::lowest()

The maximum number of samples.

class VRRefinements : public BAG::Layer
#include <bag_vrrefinements.h>

The interface for the variable resolution refinements layer.

Public Functions

std::shared_ptr<VRRefinementsDescriptor> getDescriptor() & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

std::shared_ptr<const VRRefinementsDescriptor> getDescriptor() const & noexcept

Retrieve the layer’s descriptor. Note: this shadows BAG::Layer.getDescriptor()

Returns:

The layer’s descriptor. Will never be nullptr.

Protected Functions

VRRefinements(Dataset &dataset, VRRefinementsDescriptor &descriptor, std::unique_ptr<::H5::DataSet, DeleteH5dataSet> h5dataSet)

Constructor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

  • h5dataSet – The HDF5 DataSet that stores this layer.

Protected Static Functions

static std::unique_ptr<VRRefinements> create(Dataset &dataset, uint64_t chunkSize, int compressionLevel)

Create a new variable resolution refinements layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new variable resolution refinements layer.

static std::unique_ptr<VRRefinements> open(Dataset &dataset, VRRefinementsDescriptor &descriptor)

Open an existing variable resolution refinements layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

The existing variable resolution refinements layer.

Private Functions

virtual UInt8Array readProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd) const override

Read a section of data from this layer.

Read data from this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

Returns:

The section of data specified by the rows and columns. Ignore rows since the data is 1 dimensional.

virtual void writeProxy(uint32_t rowStart, uint32_t columnStart, uint32_t rowEnd, uint32_t columnEnd, const uint8_t *buffer) override

Write a section of data to this layer.

Write data to this layer starting at rowStart, columnStart, and continue
until rowEnd, columnEnd (inclusive).

After writing the data, write the attributes.

Parameters:
  • rowStart – The starting row.

  • columnStart – The starting column.

  • rowEnd – The ending row (inclusive).

  • columnEnd – The ending column (inclusive).

  • buffer – The data to be written. It must contain at least (rowEnd - rowStart + 1) * (columnEnd - columnStart + 1) elements! Ignore rows since the data is 1 dimensional.

virtual void writeAttributesProxy() const override

Write the attributes this layer contains to disk.

Private Members

std::unique_ptr<H5::DataSet, DeleteH5dataSet> m_pH5dataSet

The HDF5 DataSet this layer wraps.

Private Static Functions

static std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5dataSet(const Dataset &dataset, const VRRefinementsDescriptor &descriptor)

Create a new HDF5 DataSet for this variable resolution refinements layer.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • descriptor – The descriptor of this layer.

Returns:

A new HDF5 DataSet.

class VRRefinementsDescriptor : public BAG::LayerDescriptor
#include <bag_vrrefinementsdescriptor.h>

Describe the variable resolution refinements layer.

Public Functions

std::tuple<float, float> getMinMaxDepth() const noexcept

Retrieve the minimum and maximum depth.

Returns:

The minimum and maximum depth.

std::tuple<float, float> getMinMaxUncertainty() const noexcept

Retrieve the minimum and maximum uncertainty.

Returns:

The minimum and maximum uncertainty.

VRRefinementsDescriptor &setMinMaxDepth(float minDepth, float maxDepth) & noexcept

Set the minimum and maximum depth.

Parameters:
  • minDepth – The new minimum depth.

  • maxDepth – The new maximum depth.

Returns:

The variable resolution refinements layer descriptor.

VRRefinementsDescriptor &setMinMaxUncertainty(float minUncertainty, float maxUncertainty) & noexcept

Set the minimum and maximum uncertainty.

Parameters:
  • minUncertainty – The new minimum uncertainty.

  • maxUncertainty – The new maximum uncertainty.

Returns:

The variable resolution refinements layer descriptor.

Protected Functions

VRRefinementsDescriptor(uint32_t id, uint64_t chunkSize, int compressionLevel)

Constructor.

Parameters:
  • id – The unique layer id.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

explicit VRRefinementsDescriptor(const Dataset &dataset)

Constructor.

Parameters:

dataset – The BAG Dataset this layer belongs to.

Protected Static Functions

static std::shared_ptr<VRRefinementsDescriptor> create(const Dataset &dataset, uint64_t chunkSize, int compressionLevel)

Create a new variable resolution refinements descriptor.

Parameters:
  • dataset – The BAG Dataset this layer belongs to.

  • chunkSize – The chunk size the HDF5 DataSet will use.

  • compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The new variable resolution refinements descriptor.

static std::shared_ptr<VRRefinementsDescriptor> open(const Dataset &dataset)

Open an existing variable resolution refinements descriptor.

Parameters:

dataset – The BAG Dataset this layer belongs to.

Returns:

The existing variable resolution refinements descriptor.

Private Functions

virtual DataType getDataTypeProxy() const noexcept override

Retrieve the data type.

Returns:

The data type the layer contains.

virtual uint8_t getElementSizeProxy() const noexcept override

Retrieve the element size.

Returns:

The element size of the layer.

Private Members

float m_minDepth = std::numeric_limits<float>::max()

The minimum depth.

float m_maxDepth = std::numeric_limits<float>::lowest()

The maximum depth.

float m_minUncertainty = std::numeric_limits<float>::max()

The minimum uncertainty.

float m_maxUncertainty = std::numeric_limits<float>::lowest()

The maximum uncertainty.

class VRTrackingList
#include <bag_vrtrackinglist.h>

The interface for the variable resolution tracking list.

Public Functions

VRTrackingList(const Dataset &dataset, int compressionLevel)

Constructor.

Parameters:
  • dataset – The BAG Dataset this variable resolution tracking list belongs to.

  • compressionLevel – The compression level the HDF5 DataSet will use.

explicit VRTrackingList(const Dataset &dataset)

Constructor.

Parameters:

dataset – The BAG Dataset this variable resolution tracking list belongs to.

iterator begin() & noexcept

Retrieve an iterator to the first item in the variable resolution tracking list.

Returns:

An iterator to the first item in the variable resolution tracking list.

const_iterator begin() const & noexcept

Retrieve an iterator to the first item in the variable resolution tracking list.

Returns:

An iterator to the first item in the variable resolution tracking list.

iterator end() & noexcept

Retrieve an iterator to one past the last item in the tracking list.

Returns:

An iterator to one past the last item in the tracking list.

const_iterator end() const & noexcept

Retrieve an iterator to one past the last item in the tracking list.

Returns:

An iterator to one past the last item in the tracking list.

const_iterator cbegin() const & noexcept

Retrieve an iterator to the first item in the variable resolution tracking list.

Returns:

An iterator to the first item in the variable resolution tracking list.

const_iterator cend() const & noexcept

Retrieve an iterator to one past the last item in the tracking list.

Returns:

An iterator to one past the last item in the tracking list.

void clear() noexcept

Empty the tracking list.

void push_back(const value_type &value)

Add an item to the end of the tracking list.

Parameters:

value – The item to add.

void push_back(value_type &&value)

Add an item to the end of the tracking list.

Parameters:

value – The item to add.

reference front() &

Retrieve the first item in the tracking list.

Returns:

The first item in the tracking list.

const_reference front() const &

Retrieve the first item in the tracking list.

Returns:

The first item in the tracking list.

reference back() &

Retrieve the last item in the tracking list.

Returns:

The last item in the tracking list.

const_reference back() const &

Retrieve the last item in the tracking list.

Returns:

The last item in the tracking list.

void reserve(size_t newCapacity)

Reserve more space in the tracking list.

Reserve more space in the tracking list.  If the amount to be reserved is
less than the current capacity, do nothing.

Parameters:

newCapacity – The new capacity of the tracking list.

void resize(size_t count)

Resize the tracking list to the new value.

Parameters:

count – The new size of the tracking list.

value_type *data() & noexcept

Retrieve a pointer to the first item in the tracking list.

Returns:

A pointer to the first item in the tracking list.

const value_type *data() const & noexcept

Retrieve a pointer to the first item in the tracking list.

Returns:

A pointer to the first item in the tracking list.

bool empty() const noexcept

Determine if the variable resolution tracking list is empty.

Returns:

true if the variable resolution tracking list is empty. false otherwise.

size_t size() const noexcept

Retrieve the number of items in the tracking list.

Returns:

The number of items in the tracking list.

reference operator[](size_t index) & noexcept

Retrieve the item at the specified index.

Returns:

The item at the specified index.

const_reference operator[](size_t index) const & noexcept

Retrieve the item at the specified index.

Returns:

The item at the specified index.

void write() const

Write the tracking list to the HDF5 DataSet.

template<typename ...Args>
void emplace_back(Args&&... args) &

Add an item to the end of the tracking list.

Parameters:

args – One or more parameters to hand to the constructor of VRTrackingItem.

Private Functions

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> createH5dataSet(int compressionLevel)

Create the HDF5 DataSet the tracking list wraps.

Parameters:

compressionLevel – The compression level the HDF5 DataSet will use.

Returns:

The HDF5 DataSet the tracking list wraps.

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> openH5dataSet()

Open an existing HDF5 DataSet the tracking list wraps.

Returns:

The HDF5 DataSet the tracking list wraps.

Private Members

std::weak_ptr<const Dataset> m_pBagDataset

The associated BAG Dataset.

std::vector<value_type> m_items

The items making up the tracking list.

std::unique_ptr<::H5::DataSet, DeleteH5dataSet> m_pH5dataSet

The HDF5 DataSet this class relates to.

namespace detail
template<typename T>
struct GetFromCompoundDataType
template<>
struct GetFromCompoundDataType<float>
#include <bag_compounddatatype.h>
template<>
struct GetFromCompoundDataType<uint32_t>
#include <bag_compounddatatype.h>
template<>
struct GetFromCompoundDataType<bool>
#include <bag_compounddatatype.h>
template<> string >
#include <bag_compounddatatype.h>

Base datatypes and enums defined in C in bag_c_types.h

Defines

NOAA_OCS_2022_10_METADATA_PROFILE_NAME
UNKOWN_METADATA_PROFILE_NAME
BAG_SURFACE_CORRECTOR_LIMIT
BAG_NULL_ELEVATION
BAG_NULL_GENERIC
BAG_NULL_UNCERTAINTY

Typedefs

typedef uint32_t BagError

The bag error.

Enums

enum BAG_LAYER_TYPE

The types of layers.

Values:

enumerator Elevation

The mandatory elevation layer.

enumerator Uncertainty

The mandatory uncertainty layer.

enumerator Hypothesis_Strength

The optional hypothesis strength layer.

enumerator Num_Hypotheses

The optional number of hypothesis layer.

enumerator Shoal_Elevation

The optional shoal elevation layer.

enumerator Std_Dev

The optional standard deviation layer.

enumerator Num_Soundings

The optional number of soundings layer.

enumerator Average_Elevation

The optional average elevation layer.

enumerator Nominal_Elevation

The optional nominal elevation layer.

enumerator Surface_Correction

The optional surface correction layer.

enumerator Georef_Metadata

The optional georeferenced metadata layer (there can be many; the name must be unique).

enumerator VarRes_Metadata

The optional variable resolution metadata layer.

enumerator VarRes_Refinement

The optional variable resolution refinement layer.

enumerator VarRes_Node

The optional variable resolution node layer.

enumerator UNKNOWN_LAYER_TYPE
enum BAG_OPEN_MODE

Definitions for file open access modes.

Values:

enumerator BAG_OPEN_READONLY

Open the BAG read only. It cannot be written to.

enumerator BAG_OPEN_READ_WRITE

Open the BAG for reading and writing.

enum BAG_DATA_TYPE

The types of data known to BAG.

Values:

enumerator DT_FLOAT32

A 32 bit floating point value.

enumerator DT_UINT32

A 32 bit unsigned integer.

enumerator DT_UINT8

An 8 bit unsigned integer.

enumerator DT_UINT16

A 16 bit unsigned integer.

enumerator DT_UINT64

A 64 bit unsigned integer.

enumerator DT_BOOLEAN

A boolean value.

enumerator DT_STRING

A string value.

enumerator DT_COMPOUND

A compound type of one or more of the above.

enumerator DT_UNKNOWN_DATA_TYPE
enum GEOREF_METADATA_PROFILE

Values:

enumerator UNKNOWN_METADATA_PROFILE
enumerator NOAA_OCS_2022_10_METADATA_PROFILE
enum BAG_GROUP_TYPE

The type of interleaved group.

Values:

enumerator NODE

The NODE group type.

enumerator ELEVATION

The ELEVATION group type.

enumerator UNKNOWN_GROUP_TYPE

Unknown group type.

enum BAG_SURFACE_CORRECTION_TOPOGRAPHY

The surface topography.

Values:

enumerator BAG_SURFACE_UNKNOWN

Unknown.

enumerator BAG_SURFACE_GRID_EXTENTS

Optional corrector dataset grid coordinates, spanning the required BAG surface extents.

enumerator BAG_SURFACE_IRREGULARLY_SPACED

Irregularly spaced corrector values in optional corrector dataset.

struct BagTrackingItem
#include <bag_c_types.h>

An item in the Tracking List.

Public Members

uint32_t row

The row of the node of the BAG that was modified.

uint32_t col

The column of the node of the BAG that was modified.

float depth

The original depth before this change.

float uncertainty

The original uncertainty before this change.

uint8_t track_code

The reason code indicating why the modification was made.

uint16_t list_series

The index number indicating the item in the metadata that describes the modifications.

struct BagVRTrackingItem
#include <bag_c_types.h>

An item in the variable resolution tracking list.

Public Members

uint32_t row

The row of the node of the BAG that was modified.

uint32_t col

The column of the node of the BAG that was modified.

uint32_t sub_row

The row within the refined grid that was modified.

uint32_t sub_col

The column within the refined grid that was modified.

float depth

The original depth before this change.

float uncertainty

The original uncertainty before this change.

uint8_t track_code

The reason code indicating why the modification was made.

uint16_t list_series

The index number indicating the item in the metadata that describes the modifications.

struct BagVRMetadataItem
#include <bag_c_types.h>

An item in the variable resolution metadata layer.

Public Members

uint32_t index

The index.

uint32_t dimensions_x

Number of nodes in easting.

uint32_t dimensions_y

Number of nodes in northing.

float resolution_x

Node spacing in easting.

float resolution_y

Node spacing in northing.

float sw_corner_x

Offset east from SW corner of surrounding low-res cell to SW-most node.

float sw_corner_y

Offset north from SW corner of surrounding low-res cell to SW-most node.

struct BagVRRefinementsItem
#include <bag_c_types.h>

An item in the variable resolution refinements layer.

Public Members

float depth

The depth.

float depth_uncrt

The uncertainty.

struct BagVRNodeItem
#include <bag_c_types.h>

An item in the variable resolution node layer.

Public Members

float hyp_strength

Hypotheses strength.

uint32_t num_hypotheses

Number of hypotheses.

uint32_t n_samples

Number of samples.

struct BagVerticalDatumCorrections
#include <bag_c_types.h>

An item in a surface corrections layer when the type is BAG_SURFACE_IRREGULARLY_SPACED.

Public Members

double x

The X correction.

double y

The Y correction.

float z[BAG_SURFACE_CORRECTOR_LIMIT]

The correctors.

struct BagVerticalDatumCorrectionsGridded
#include <bag_c_types.h>

An item in a surface corrections layer when the type is BAG_SURFACE_GRID_EXTENTS.

Public Members

float z[BAG_SURFACE_CORRECTOR_LIMIT]

The correctors.

struct BagVerticalCorrectorDef
#include <bag_c_types.h>

The attributes of a correction surface. Only used in the C interface.

Public Members

double nodeSpacingX
double nodeSpacingY

node spacing in x dimension in units defined by coord system

double swCornerX

node spacing in y dimension in units defined by coord system

double swCornerY

X coordinate of SW corner of vertical corrector surface in BAG_COORDINATES.

struct FieldDefinition
#include <bag_c_types.h>

A structure to hold the definition of a value. ***NOTE: This must be POD per the C++11 definition. see: https://stackoverflow.com/questions/4178175/what-are-aggregates-and-pods-and-how-why-are-they-special/7189821#7189821

Public Members

const char *name

The name of the definition.

uint8_t type

The type of the definition; represents a DataType.

union BAG_COMPOUND_DATA_PAYLOAD
#include <bag_c_types.h>

The C version of the BAG::CompoundDataType class.

Public Members

float f
uint32_t ui32
bool b
char *c
struct BagCompoundDataType
#include <bag_c_types.h>

Public Members

BAG_DATA_TYPE type
BAG_COMPOUND_DATA_PAYLOAD data