OpenMS
Loading...
Searching...
No Matches
SourceFile Class Reference

Description of a file location, used to store the origin of (meta) data. More...

#include <OpenMS/METADATA/SourceFile.h>

Inheritance diagram for SourceFile:
[legend]
Collaboration diagram for SourceFile:
[legend]

Public Types

enum class  ChecksumType { UNKNOWN_CHECKSUM , SHA1 , MD5 , SIZE_OF_CHECKSUMTYPE }
 Type of the checksum. More...
 
- Public Types inherited from MetaInfoInterface
using MetaInfoConstIterator = MetaInfo::const_iterator
 Const iterator type for iterating over meta info entries.
 

Public Member Functions

 SourceFile ()
 Constructor.
 
 SourceFile (const SourceFile &)=default
 Copy constructor.
 
 SourceFile (SourceFile &&)=default
 Move constructor.
 
 ~SourceFile () override
 Destructor.
 
SourceFileoperator= (const SourceFile &)=default
 Assignment operator.
 
SourceFileoperator= (SourceFile &&)=default
 Move assignment operator.
 
bool operator== (const SourceFile &rhs) const
 Equality operator.
 
bool operator!= (const SourceFile &rhs) const
 Equality operator.
 
const std::string & getNameOfFile () const
 returns the file name
 
void setNameOfFile (const std::string &name_of_file)
 sets the file name
 
const std::string & getPathToFile () const
 returns the file path
 
void setPathToFile (const std::string &path_path_to_file)
 sets the file path
 
float getFileSize () const
 returns the file size in MB
 
void setFileSize (float file_size)
 sets the file size in MB
 
const std::string & getFileType () const
 returns the file type
 
void setFileType (const std::string &file_type)
 sets the file type
 
const std::string & getChecksum () const
 returns the file's checksum
 
void setChecksum (const std::string &checksum, ChecksumType type)
 sets the file's checksum
 
ChecksumType getChecksumType () const
 returns the checksum type
 
const std::string & getNativeIDType () const
 Returns the native ID type of the spectra.
 
void setNativeIDType (const std::string &type)
 Sets the native ID type of the spectra.
 
const std::string & getNativeIDTypeAccession () const
 Returns the nativeID of the spectra.
 
void setNativeIDTypeAccession (const std::string &accesssion)
 Sets the native ID of the spectra.
 
- Public Member Functions inherited from CVTermList
 CVTermList ()=default
 Defaults constructor.
 
 CVTermList (const CVTermList &)=default
 Copy constructor.
 
 CVTermList (CVTermList &&) noexcept
 Move constructor.
 
virtual ~CVTermList ()
 Destructor.
 
CVTermListoperator= (const CVTermList &rhs) &=default
 Assignment operator.
 
CVTermListoperator= (CVTermList &&) &=default
 Move assignment operator.
 
void setCVTerms (const std::vector< CVTerm > &terms)
 sets the CV terms
 
void replaceCVTerm (const CVTerm &cv_term)
 replaces the specified CV term
 
void replaceCVTerms (const std::vector< CVTerm > &cv_terms, const std::string &accession)
 replaces the specified CV terms using the given accession number
 
void replaceCVTerms (const std::map< std::string, std::vector< CVTerm > > &cv_term_map)
 replaces all cv terms with a map (can be obtained via getCVTerms)
 
void consumeCVTerms (const std::map< std::string, std::vector< CVTerm > > &cv_term_map)
 merges the given map into the member map, no duplicate checking
 
const std::map< std::string, std::vector< CVTerm > > & getCVTerms () const
 returns the accession string of the term
 
void addCVTerm (const CVTerm &term)
 adds a CV term
 
bool operator== (const CVTermList &cv_term_list) const
 equality operator
 
bool operator!= (const CVTermList &cv_term_list) const
 inequality operator
 
bool hasCVTerm (const std::string &accession) const
 checks whether the term has a value
 
bool empty () const
 return true if no terms are available
 
- Public Member Functions inherited from MetaInfoInterface
 MetaInfoInterface ()=default
 Constructor.
 
 MetaInfoInterface (const MetaInfoInterface &rhs)
 Copy constructor.
 
 MetaInfoInterface (MetaInfoInterface &&) noexcept
 Move constructor.
 
 ~MetaInfoInterface ()
 Destructor.
 
MetaInfoInterfaceoperator= (const MetaInfoInterface &rhs)
 Assignment operator.
 
MetaInfoInterfaceoperator= (MetaInfoInterface &&) noexcept
 Move assignment operator.
 
void swap (MetaInfoInterface &rhs)
 Swap contents.
 
bool operator== (const MetaInfoInterface &rhs) const
 Equality operator.
 
bool operator!= (const MetaInfoInterface &rhs) const
 Equality operator.
 
const DataValuegetMetaValue (const std::string &name) const
 Returns the value corresponding to a string, or DataValue::EMPTY if not found.
 
DataValue getMetaValue (const std::string &name, const DataValue &default_value) const
 Returns the value corresponding to a string, or a default value (e.g.: DataValue::EMPTY) if not found

 
const DataValuegetMetaValue (UInt index) const
 Returns the value corresponding to the index, or DataValue::EMPTY if not found.
 
DataValue getMetaValue (UInt index, const DataValue &default_value) const
 Returns the value corresponding to the index, or a default value (e.g.: DataValue::EMPTY) if not found

 
bool metaValueExists (const std::string &name) const
 Returns whether an entry with the given name exists.
 
bool metaValueExists (UInt index) const
 Returns whether an entry with the given index exists.
 
void setMetaValue (const std::string &name, const DataValue &value)
 Sets the DataValue corresponding to a name.
 
void setMetaValue (UInt index, const DataValue &value)
 Sets the DataValue corresponding to an index.
 
void removeMetaValue (const std::string &name)
 Removes the DataValue corresponding to name if it exists.
 
void removeMetaValue (UInt index)
 Removes the DataValue corresponding to index if it exists.
 
void addMetaValues (const MetaInfoInterface &from)
 
void getKeys (std::vector< std::string > &keys) const
 Fills the given vector with a list of all keys for which a value is set.
 
void getKeys (std::vector< UInt > &keys) const
 Fills the given vector with a list of all keys for which a value is set.
 
bool isMetaEmpty () const
 Returns if the MetaInfo is empty.
 
void clearMetaInfo ()
 Removes all meta values.
 
MetaInfoConstIterator metaBegin () const
 Returns a const iterator to the beginning of the meta info entries.
 
MetaInfoConstIterator metaEnd () const
 Returns a const iterator to the end of the meta info entries.
 
Size metaSize () const
 Returns the number of meta info entries.
 

Static Public Member Functions

static StringList getAllNamesOfChecksumType ()
 returns all checksum type names known to OpenMS
 
- Static Public Member Functions inherited from MetaInfoInterface
static MetaInfoRegistrymetaRegistry ()
 Returns a reference to the MetaInfoRegistry.
 

Static Public Attributes

static const std::string NamesOfChecksumType [static_cast< size_t >(ChecksumType::SIZE_OF_CHECKSUMTYPE)]
 Names of checksum types.
 

Protected Attributes

std::string name_of_file_
 
std::string path_to_file_
 
double file_size_
 
std::string file_type_
 
std::string checksum_
 
ChecksumType checksum_type_ = SourceFile::ChecksumType::UNKNOWN_CHECKSUM
 
std::string native_id_type_
 
std::string native_id_type_accession_
 
- Protected Attributes inherited from CVTermList
std::map< std::string, std::vector< CVTerm > > cv_terms_
 
- Protected Attributes inherited from MetaInfoInterface
MetaInfometa_ = nullptr
 Pointer to the MetaInfo object.
 

Additional Inherited Members

- Protected Member Functions inherited from MetaInfoInterface
void createIfNotExists_ ()
 Creates the MetaInfo object if it does not exist.
 

Detailed Description

Description of a file location, used to store the origin of (meta) data.

Member Enumeration Documentation

◆ ChecksumType

enum class ChecksumType
strong

Type of the checksum.

Enumerator
UNKNOWN_CHECKSUM 

Unknown checksum type.

SHA1 

Secure Hash Algorithm-1.

MD5 

Message-Digest algorithm 5.

SIZE_OF_CHECKSUMTYPE 

Constructor & Destructor Documentation

◆ SourceFile() [1/3]

Constructor.

◆ SourceFile() [2/3]

SourceFile ( const SourceFile )
default

Copy constructor.

◆ SourceFile() [3/3]

SourceFile ( SourceFile &&  )
default

Move constructor.

◆ ~SourceFile()

~SourceFile ( )
override

Destructor.

Member Function Documentation

◆ getAllNamesOfChecksumType()

static StringList getAllNamesOfChecksumType ( )
static

returns all checksum type names known to OpenMS

◆ getChecksum()

const std::string & getChecksum ( ) const

returns the file's checksum

◆ getChecksumType()

ChecksumType getChecksumType ( ) const

returns the checksum type

◆ getFileSize()

float getFileSize ( ) const

returns the file size in MB

◆ getFileType()

const std::string & getFileType ( ) const

returns the file type

◆ getNameOfFile()

const std::string & getNameOfFile ( ) const

returns the file name

◆ getNativeIDType()

const std::string & getNativeIDType ( ) const

Returns the native ID type of the spectra.

◆ getNativeIDTypeAccession()

const std::string & getNativeIDTypeAccession ( ) const

Returns the nativeID of the spectra.

◆ getPathToFile()

const std::string & getPathToFile ( ) const

returns the file path

◆ operator!=()

bool operator!= ( const SourceFile rhs) const

Equality operator.

◆ operator=() [1/2]

SourceFile & operator= ( const SourceFile )
default

Assignment operator.

◆ operator=() [2/2]

SourceFile & operator= ( SourceFile &&  )
default

Move assignment operator.

◆ operator==()

bool operator== ( const SourceFile rhs) const

Equality operator.

◆ setChecksum()

void setChecksum ( const std::string &  checksum,
ChecksumType  type 
)

sets the file's checksum

◆ setFileSize()

void setFileSize ( float  file_size)

sets the file size in MB

Referenced by XMassFile::load().

◆ setFileType()

void setFileType ( const std::string &  file_type)

sets the file type

Referenced by XMassFile::load().

◆ setNameOfFile()

void setNameOfFile ( const std::string &  name_of_file)

sets the file name

Referenced by XMassFile::load().

◆ setNativeIDType()

void setNativeIDType ( const std::string &  type)

Sets the native ID type of the spectra.

◆ setNativeIDTypeAccession()

void setNativeIDTypeAccession ( const std::string &  accesssion)

Sets the native ID of the spectra.

◆ setPathToFile()

void setPathToFile ( const std::string &  path_path_to_file)

sets the file path

Referenced by XMassFile::load().

Member Data Documentation

◆ checksum_

std::string checksum_
protected

◆ checksum_type_

◆ file_size_

double file_size_
protected

◆ file_type_

std::string file_type_
protected

◆ name_of_file_

std::string name_of_file_
protected

◆ NamesOfChecksumType

const std::string NamesOfChecksumType[static_cast< size_t >(ChecksumType::SIZE_OF_CHECKSUMTYPE)]
static

Names of checksum types.

◆ native_id_type_

std::string native_id_type_
protected

◆ native_id_type_accession_

std::string native_id_type_accession_
protected

◆ path_to_file_

std::string path_to_file_
protected