CAVAPA-GUI  30.5.2014
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Public Member Functions | List of all members
cavapa_gui::Metadata Class Reference

Represents the metadata associated with a measurement. More...

#include <metadata.h>

Inheritance diagram for cavapa_gui::Metadata:
cavapa_gui::KeyValueCollection

Public Member Functions

 Metadata ()
 Constructs a new Metadata object with empty values.
 
void addSource (SourceID id, SourceType type, const SourceSettings &settings, FrameTime startOffset=0)
 Adds a new source to the metadata. More...
 
void addVideo (SourceID id, const std::string &path)
 Adds a new recorded video file for the specified source. More...
 
void clearSources ()
 Removes all sources from the Metadata object.
 
std::vector< CalibrationPoint > getCalibrationPoints (SourceID source)
 Gets the calibration points of the specified source. More...
 
QDir getContainingDirectory () const
 Gets the path of the directory specifying where the metadata file is located. More...
 
std::vector< GraphMarkergetMarkers () const
 Gets the markers associated with the metadata. More...
 
std::vector< SourceIDgetSources () const
 Gets the ids of the sources associated with the metadata. More...
 
SourceSettings getSourceSettings (SourceID source) const
 Gets the source settings for the specified source from the metadata. More...
 
FrameTime getStartOffset (SourceID source) const
 Gets the start offset for the specified source. More...
 
int getVideoCount () const
 Gets the total video count of all sources. More...
 
std::vector< std::string > getVideos (SourceID id)
 Gets the recorded videos associated with the specified source. More...
 
bool readFromFile (const std::string &path)
 Reads the metadata information from the specified XML file. More...
 
void setCalibrationPoints (const std::vector< CalibrationPoint > &points)
 Sets the calibration points for the metadata. More...
 
void setCalibrationPoints (SourceID id, const std::vector< CalibrationPoint > &points)
 Sets the calibration points for the specified source. More...
 
void setMarkers (const std::vector< GraphMarker > &markers)
 Sets the graph markers for the metadata. More...
 
bool writeToFile () const
 Writes the metadata to the default file. More...
 
bool writeToFile (const std::string &path) const
 Writes the metadata to the specified file. More...
 
- Public Member Functions inherited from cavapa_gui::KeyValueCollection
const_iterator begin () const
 Returns a const iterator to the beginning of the collection. More...
 
const_iterator end () const
 Returns a const iterator to the end of the collection. More...
 
std::string get (const std::string &name) const
 Gets the value of the specified key as a string. More...
 
bool getBool (const std::string &name) const
 Gets the value of the specified key as a bool. More...
 
QColor getColor (const std::string &name) const
 Gets the value of the specified key as a QColor. More...
 
QString getQString (const std::string &name) const
 Gets the value of the specified key as a QString. More...
 
double getDouble (const std::string &name) const
 Gets the value of the specified key as a double. More...
 
int getInt (const std::string &name) const
 Gets the value of the specified key as an integer. More...
 
template<typename ValueType , int N>
std::array< ValueType, N > getValues (const std::string &name) const
 Gets an array of values from the specified key. More...
 
void set (const std::string &name, const std::string &value)
 Sets the value of the specified key. More...
 
void setBool (const std::string &name, bool value)
 Sets the value of the specified key as a bool. More...
 
void setColor (const std::string &name, const QColor &value)
 Sets the value of the specified key as a QColor. More...
 
void setInt (const std::string &name, int value)
 Sets the value of the specified key as an int. More...
 
template<typename... T>
void setValues (const std::string &name, T...values)
 Sets the value of the specified key as an array. More...
 
void setQString (const std::string &name, const QString &value)
 Sets the value of the specified key as a QString. More...
 
bool trySet (const std::string &name, const std::string &value)
 Attempts to set the value of the specified key. More...
 

Additional Inherited Members

- Public Types inherited from cavapa_gui::KeyValueCollection
using const_iterator = std::map< std::string, std::string >::const_iterator
 Provides a bidirectional iterator that can read a const element in the collection.
 
- Protected Attributes inherited from cavapa_gui::KeyValueCollection
std::map< std::string,
std::string > 
keyValueMap
 Contains the key-value mappings in an std::map.
 

Detailed Description

Represents the metadata associated with a measurement.

Provides methods for reading and writing the metadata from and to an XML file.

Author
Mika Lehtinen

Member Function Documentation

void cavapa_gui::Metadata::addSource ( SourceID  id,
SourceType  type,
const SourceSettings settings,
FrameTime  startOffset = 0 
)

Adds a new source to the metadata.

Parameters
idThe id of the source.
typeThe type of the source.
settingsThe settings for the source.
startOffsetThe start offset of the source. This is only applicable to video files.
void cavapa_gui::Metadata::addVideo ( SourceID  id,
const std::string &  path 
)

Adds a new recorded video file for the specified source.

Parameters
idThe id of the source.
pathThe video file to be added.
std::vector< CalibrationPoint > cavapa_gui::Metadata::getCalibrationPoints ( SourceID  source)

Gets the calibration points of the specified source.

Parameters
sourceThe id of the source.
Returns
The collection of the calibration points of the source.
QDir cavapa_gui::Metadata::getContainingDirectory ( ) const

Gets the path of the directory specifying where the metadata file is located.

Returns
The path of the directory.
std::vector< GraphMarker > cavapa_gui::Metadata::getMarkers ( ) const

Gets the markers associated with the metadata.

Returns
The markers.
std::vector< SourceID > cavapa_gui::Metadata::getSources ( ) const

Gets the ids of the sources associated with the metadata.

Returns
The ids of the sources.
SourceSettings cavapa_gui::Metadata::getSourceSettings ( SourceID  source) const

Gets the source settings for the specified source from the metadata.

Parameters
sourceThe id of the source.
Returns
The source settings.
FrameTime cavapa_gui::Metadata::getStartOffset ( SourceID  source) const

Gets the start offset for the specified source.

Parameters
sourceThe id of the source.
Returns
The start offset for the source.
int cavapa_gui::Metadata::getVideoCount ( ) const

Gets the total video count of all sources.

Returns
The video count of all sources.
std::vector< std::string > cavapa_gui::Metadata::getVideos ( SourceID  id)

Gets the recorded videos associated with the specified source.

Parameters
idThe id of the source whose videos will be returned.
Returns
The file names of the videos.
bool cavapa_gui::Metadata::readFromFile ( const std::string &  path)

Reads the metadata information from the specified XML file.

Parameters
pathThe path of the XML file to be read.
Returns
True if the file was read successfully, false otherwise.
void cavapa_gui::Metadata::setCalibrationPoints ( const std::vector< CalibrationPoint > &  points)

Sets the calibration points for the metadata.

Parameters
pointsThe vector containing the points.
void cavapa_gui::Metadata::setCalibrationPoints ( SourceID  id,
const std::vector< CalibrationPoint > &  points 
)

Sets the calibration points for the specified source.

Parameters
idThe id of the source.
pointsThe calibration points for the source.
void cavapa_gui::Metadata::setMarkers ( const std::vector< GraphMarker > &  markers)

Sets the graph markers for the metadata.

Parameters
markersThe vector containing the markers.
bool cavapa_gui::Metadata::writeToFile ( ) const

Writes the metadata to the default file.

Returns
True if the data was successfully written to the file, false otherwise.
bool cavapa_gui::Metadata::writeToFile ( const std::string &  path) const

Writes the metadata to the specified file.

Parameters
pathThe location of the file.
Returns
True if the data was successfully written to the file, false otherwise.

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