OERecord

Attention

This API is currently available in C++ and Python.

class OERecord

The OERecord class is a data container for named, typed data.

Constructors

OERecord()

The default constructor initializes the record object to an empty record with no fields or values.

OERecord(const OERecord &rhs)

Copy constructor.

AddField

bool AddField(const OEFieldBase &field)

Adds an empty field to the record.

See also

Clear

void Clear()

Removes all fields and data from the record, leaving it empty.

ClearValue

bool ClearValue(const OEFieldBase &field)

Removes the specified field’s value from the record. The field will still exist, but will have no associated value. Returns false if no such field or value exist.

DeleteField

bool DeleteField(const OEFieldBase &field)

Removes the field and the associated data from the record.

See also

GetField

template<class T> OEField<T> GetField(const std::string &name, bool includeMeta=true)

Returns the field with the specified name and type from the record. If no such field exists on the record, an empty (and unusable) OEField<T> object is returned.

name

The name of the field to retrieve from the record.

includeMeta

If this is true, the returned field will include the record’s metadata for the field.

See also

GetFieldMeta

OEFieldMeta GetFieldMeta(const std::string &name) const;

Returns an OEFieldMeta object containing the metadata from the named field. If the field does not exist, or the field exists but contains no metadata, an empty OEFieldMeta object is returned.

name

The name of the field to retrieve the metadata from.

See also

GetFields

std::vector<OEFieldBase> GetFields() const
template <class T> std::vector<OEField<T>> GetFields(const OEFieldType<T> &fieldType) const;
template <class T> std::vector<OEVectorField<T>> GetFields(const OEVectorFieldType<T> &fieldType) const;

Returns the field objects from the record.

fieldType

This parameter specifies the type of the field to match.

See also

GetValue

template<class T> T GetValue(const OEField<T> &field) const

Retrieves the value from a field on the record. If no such value exists on the record, this will return a default-constructed T value.

field

The field from which the value is retrieved.

template<class T> bool GetValue(T& value, const OEField<T> &field) const

Retrieves the value from a field on the record. If no such value exists on the record, this will return false and leave the value unchanged. This overload can avoid a copy of the T value.

field

The field from which the value is retrieved.

value

The returned value. If no such field exists on the record, this is left unchanged.

See also

GetVectorField

template<class T> OEVectorField<T> GetVectorField(const std::string &name, bool includeMeta=true)

Returns the vector field with the specified name and type from the record. If no such field exists on the record, an empty (and unusable) OEVectorField object is returned.

name

The name of the field to return.

includeMeta

When true, the returned field will include metadata from the record.

See also

HasField

bool HasField(const OEFieldBase &field, bool matchMeta=false) const

Tests for existence of a field on the record, and returns true if a field of the specified name and type exists, regardless of whether the field contains a value.

field

The field to test for on the record.

matchMeta

When true, all metadata on the field parameter must be present on the record’s field to return true.

See also

HasValue

bool HasValue(const OEFieldBase &field) const

Tests for presence of a value on the record for the specified field, and returns true if such a value exists. The method will return false if no matching value can be found or if the specified field does not exist on the record.

field

The field to check for a value.

See also

IsEmpty

bool IsEmpty() const

Returns true if the record contains no fields or data.

IsNA

bool IsNA(const OEFieldBase &field) const
bool IsNA(const std::string &fieldName) const

Returns true if the specified field contains a null value. Note that this is different from the field not containing a value at all.

field

The field to test.

fieldName

The name of the field to test.

SetValue

template<class T> bool SetValue(const OEField<T> &field, const T& value)
template<class T> bool SetValue(const OEVectorField<T> &field, const std::vector<T> &value)

Sets the specified value on the record, and returns true if successful.

field

The field to set the value for. If the field exists, its value will be overwritten. If the field doesn’t exist on the record, it will be added.

value

The value to be added to the record.

See also

CheckField

unsigned int CheckField(const OEFieldBase &field, bool matchMeta=false) const

Tests the existence and state of a field on a record, and returns a value from the OERecordReturnCode namespace.

field

The field to test.

matchMeta

If this argument is true, the test for a matching field will include the field parameter’s metadata.