MrSID Decode SDK for LiDAR Reference Manual  1.1.2.4045
Metadata Class Reference

Metadata is a container for storing metadata about the point cloud. More...

#include <Metadata.h>

Public Member Functions

 ~Metadata (void)
 
 Metadata (void)
 
size_t getNumRecords (void) const
 Get the number of key-value pairs. More...
 
bool has (const char *key) const
 Determine if there is a key-value pair with a given key. More...
 
void get (size_t idx, const char *&key, const char *&description, MetadataDataType &datatype, const void *&value, size_t &length) const
 Get the key-value pair at a given index. More...
 
bool get (const char *key, const char *&description, MetadataDataType &datatype, const void *&value, size_t &length) const
 Get the key-value pair with a given key. More...
 
size_t getKeyIndex (const char *key) const
 Find the index of the key-value pair with the given key. More...
 
const char * getKey (size_t idx) const
 Get the key name for the given index. More...
 
const char * getDescription (size_t idx) const
 Get the description for the given index. More...
 
MetadataDataType getDataType (size_t idx) const
 Get the datatype for the given index. More...
 
const void * getValue (size_t idx) const
 Get the data buffer for the given index. More...
 
size_t getValueLength (size_t idx) const
 Get the data buffer length for the given index. More...
 
void add (const char *key, const char *description, MetadataDataType datatype, const void *value, size_t length)
 Add a key-value pair. More...
 
void add (const Metadata &meta)
 Add all the key-value pairs from the given Metadata object. More...
 
void remove (void)
 Remove all key-value pairs. More...
 
void remove (size_t idx)
 Remove the key-value pair at a given index. More...
 
void remove (const char *key)
 Remove the first key-value pair with key. More...
 
void sort (void)
 Sort the pairs. More...
 
void read (StreamReader &stream)
 Wirte metadata to a stream. More...
 
void write (StreamWriter &stream) const
 Read metadata from a stream. More...
 
void dump (FILE *file) const
 Write the metadata in a human readable format. More...
 

Protected Attributes

RecordStore * m_records
 

Detailed Description

The Metadata class is a Key-Value container for storing metadata about the point cloud. It can hold three data types Strings, Arrays of Doubles and Raw binary data (Blobs).

See also
See examples/src/DumpMG4Info.cpp dumpMetadata() for an example of using this class.

Definition at line 64 of file Metadata.h.

Constructor & Destructor Documentation

Metadata::~Metadata ( void  )
Metadata::Metadata ( void  )

Member Function Documentation

void Metadata::add ( const char *  key,
const char *  description,
MetadataDataType  datatype,
const void *  value,
size_t  length 
)

This method adds a key-value pair to the metadata.

Parameters
keythe key name
descriptiona short description of the metadata (can by NULL)
datatypethe data type of the value array
valuethe value array
lengthnumber of elements in the value array. This is ignored for METADATA_DATATYPE_STRING.
void Metadata::add ( const Metadata meta)

The method adds all the key-value pairs in meta.

Parameters
metasource Metadata object
void Metadata::dump ( FILE *  file) const

The method writes the metadata in a human readable format.

Parameters
filethe destination Standard C Library FILE object
void Metadata::get ( size_t  idx,
const char *&  key,
const char *&  description,
MetadataDataType datatype,
const void *&  value,
size_t &  length 
) const

This method retrieves the idx'th key-value pair. The last 5 arguments are output parameters.

Parameters
idxthe index of the key-value pair
keythe key name
descriptiona short description of the metadata (can by NULL)
datatypethe data type of the value array
valuethe value array
lengthnumber of elements in the value array.
bool Metadata::get ( const char *  key,
const char *&  description,
MetadataDataType datatype,
const void *&  value,
size_t &  length 
) const

This method retrieves the named key-value pair. The last 4 arguments are output parameters.

Parameters
keythe key name
descriptiona short description of the metadata (can by NULL)
datatypethe data type of the value array
valuethe value array
lengthnumber of elements in the value array.
Returns
true if the key was found
Note
For stirngs the length includes the '\0'
MetadataDataType Metadata::getDataType ( size_t  idx) const
Parameters
idxthe index of the key-value pair the datatype
const char* Metadata::getDescription ( size_t  idx) const
Parameters
idxthe index of the key-value pair the description (this may be NULL)
const char* Metadata::getKey ( size_t  idx) const
Parameters
idxthe index of the key-value pair the key name
size_t Metadata::getKeyIndex ( const char *  key) const

This method returns the index of the first pair with the given key.

Parameters
keythe key name
Returns
the index of the first key-value pair
size_t Metadata::getNumRecords ( void  ) const

This method returns the number of key-value pairs.

const void* Metadata::getValue ( size_t  idx) const
Parameters
idxthe index of the key-value pair a pointer to the data array
size_t Metadata::getValueLength ( size_t  idx) const
Parameters
idxthe index of the key-value pair the number of elements in the value array
Note
For stirngs the length includes the '\0'
bool Metadata::has ( const char *  key) const

The method determines if this object has a pair with the given key.

Parameters
keythe key name
Returns
true if the key was found
void Metadata::read ( StreamReader stream)

This method reads the metadata from a stream in a binary format.

void Metadata::remove ( void  )

This method removes all the key-value form the container.

void Metadata::remove ( size_t  idx)

This method removes the idx'th key-value pair.

Parameters
idxthe index of the key-value pair
void Metadata::remove ( const char *  key)

This method removes the first key-value pair with the given key.

Parameters
keythe key name of the key-value pair
void Metadata::sort ( void  )

This method sorts the key-value pair list by key name.

void Metadata::write ( StreamWriter stream) const

This method reads the metadata from a stream as a binary format.

Member Data Documentation

RecordStore* Metadata::m_records
protected

Definition at line 253 of file Metadata.h.


The documentation for this class was generated from the following file:

LizardTech