CVB++ 14.0
MetaData Class Referencefinal

Spectral MetaData object. More...

#include <cvb/spectral/meta_data.hpp>

Public Member Functions

template<class T >
ReadField (const FieldID &fieldId) const
 Template function to get the value of the field. More...
 
template<class T >
void WriteField (FieldID fieldId, const T &value)
 Template function to set the value of a given field. More...
 
String FieldNameAsString (FieldID fieldId) const
 Gets the field name as Cvb::String. More...
 
Spectral::FieldType FieldType (FieldID fieldId) const
 Gets the type of the given field. More...
 
int NumberOfFields () const
 Gets the total number of all fields. More...
 
void ClearField (FieldID fieldId)
 Clears the given field and sets the FieldType to FieldType::Invalid. More...
 
bool IsFieldDefined (FieldID fieldId)
 Checks if the given field is already defined. More...
 
int Samples () const
 Convenience function to access the value of field FieldID::Samples. More...
 
int Lines () const
 Convenience function to access the value of field FieldID::Lines. More...
 
int Bands () const
 Convenience function to access the value of field FieldID::Bands. More...
 
CubeEncoding InterleavedType () const
 Convenience function to access the value of field FieldID::Interleave. More...
 
std::vector< double > Wavelengths () const
 Convenience function to access the value of field FieldID::Wavelength. More...
 
void * Handle () const noexcept
 Returns C-API style handle to the metadata. More...
 

Static Public Member Functions

static std::unique_ptr< MetaDataCreate ()
 Creates an empty metadata object. More...
 
static std::unique_ptr< MetaDataFromHandle (HandleGuard< MetaData > &&guard)
 Creates metadata from a classic API handle. More...
 

Detailed Description

Spectral MetaData object.

Member Function Documentation

◆ Bands()

int Bands ( ) const
inline

Convenience function to access the value of field FieldID::Bands.

Returns
Number of bands as defined in this object
Exceptions
Anyexception derived from std::exception including CvbException.
See also
Samples Lines InterleavedType Wavelengths ReadField

◆ ClearField()

void ClearField ( FieldID  fieldId)
inline

Clears the given field and sets the FieldType to FieldType::Invalid.

Parameters
[in]fieldIdField to be addressed
Exceptions
Anyexception derived from std::exception including CvbException.
See also
IsFieldDefined ReadField WriteField FieldType

◆ Create()

static std::unique_ptr< MetaData > Create ( )
inlinestatic

Creates an empty metadata object.

Returns
Pointer to MetaData object.
Exceptions
Anyexception derived from std::exception including CvbException.
See also
FromHandle Handle ReadField WriteField

◆ FieldNameAsString()

String FieldNameAsString ( FieldID  fieldId) const
inline

Gets the field name as Cvb::String.

Parameters
[in]fieldIdField to be addressed
Returns
Fieldname like defined in the ENVI-format
Exceptions
Anyexception derived from std::exception including CvbException.
See also
ReadField WriteField FieldType

◆ FieldType()

Spectral::FieldType FieldType ( FieldID  fieldId) const
inline

Gets the type of the given field.

Parameters
[in]fieldIdField to be addressed
Returns
field type in case the field has been defined already. Otherwise FieldType::Invalid
Exceptions
Anyexception derived from std::exception including CvbException.
See also
ReadField WriteField FieldNameAsString

◆ FromHandle()

static std::unique_ptr< MetaData > FromHandle ( HandleGuard< MetaData > &&  guard)
inlinestatic

Creates metadata from a classic API handle.

The MetaData takes ownership of the handle, so you must share it before using this function.

Parameters
[in]guardLife time guard for C-API handle.
Returns
The metadata created from the classic API handle.
Exceptions
Anyexception derived from std::exception including CvbException.
See also
Handle

◆ Handle()

void * Handle ( ) const
inlinenoexcept

Returns C-API style handle to the metadata.

Returns
C-API handle
See also
FromHandle

◆ InterleavedType()

CubeEncoding InterleavedType ( ) const
inline

Convenience function to access the value of field FieldID::Interleave.

Returns
View perspective
Exceptions
Anyexception derived from std::exception including CvbException.
See also
Samples Lines Bands Wavelengths ReadField

◆ IsFieldDefined()

bool IsFieldDefined ( FieldID  fieldId)
inline

Checks if the given field is already defined.

Parameters
[in]fieldIdField to be addressed
Returns
true if field is defined. Returns false otherwise
Exceptions
Anyexception derived from std::exception including CvbException.
See also
ClearField ReadField WriteField FieldType

◆ Lines()

int Lines ( ) const
inline

Convenience function to access the value of field FieldID::Lines.

Returns
Number of lines as defined in this object
Exceptions
Anyexception derived from std::exception including CvbException.
See also
Samples Bands InterleavedType Wavelengths ReadField

◆ NumberOfFields()

int NumberOfFields ( ) const
inline

Gets the total number of all fields.

Returns
Number of all fields in the meta data. This includes the undefined fields.
Exceptions
Anyexception derived from std::exception including CvbException.
See also
ReadField WriteField FieldNameAsString FieldType

◆ ReadField()

T ReadField ( const FieldID fieldId) const
inline

Template function to get the value of the field.

Parameters
[in]fieldIdField to be addressed
Returns
Output value as template type. It supports the types FieldType
Exceptions
Anyexception derived from std::exception including CvbException.
See also
WriteField FieldType

To access the field the right datatype should be used as template Following templates are supported (FieldType) :

  • Cvb::String
  • double
  • int
  • std::vector<Cvb::String>
  • std::vector<double>
  • std::vector<int>

◆ Samples()

int Samples ( ) const
inline

Convenience function to access the value of field FieldID::Samples.

Returns
Number of samples as defined in this object
Exceptions
Anyexception derived from std::exception including CvbException.
See also
Lines Bands InterleavedType Wavelengths ReadField

◆ Wavelengths()

std::vector< double > Wavelengths ( ) const
inline

Convenience function to access the value of field FieldID::Wavelength.

Returns
Wavelengths
Exceptions
Anyexception derived from std::exception including CvbException.
See also
Samples Lines Bands InterleavedType ReadField

◆ WriteField()

void WriteField ( FieldID  fieldId,
const T &  value 
)
inline

Template function to set the value of a given field.

Parameters
[in]fieldIdField to be addressed.
[in]valueNew value as template type.
Exceptions
Anyexception derived from std::exception including CvbException.
See also
ReadField FieldType

To set the field the right data type should be used as template Following templates are supported (FieldType) :

  • Cvb::String
  • double
  • int
  • std::vector<Cvb::String>
  • std::vector<double>
  • std::vector<int>