OpenMS
SourceFile.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Marc Sturm $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
12 
13 namespace OpenMS
14 {
20  class OPENMS_DLLAPI SourceFile :
21  public CVTermList
22  {
23 public:
26  {
28  SHA1,
29  MD5,
30  SIZE_OF_CHECKSUMTYPE
31  };
32 
34  static const std::string NamesOfChecksumType[SIZE_OF_CHECKSUMTYPE];
35 
39  SourceFile(const SourceFile&) = default;
41  SourceFile(SourceFile&&) = default;
43  ~SourceFile() override;
44 
46  SourceFile& operator=(const SourceFile&) = default;
49 
51  bool operator==(const SourceFile& rhs) const;
53  bool operator!=(const SourceFile& rhs) const;
54 
56  const String& getNameOfFile() const;
58  void setNameOfFile(const String& name_of_file);
59 
61  const String& getPathToFile() const;
63  void setPathToFile(const String& path_path_to_file);
64 
66  float getFileSize() const;
68  void setFileSize(float file_size);
69 
71  const String& getFileType() const;
73  void setFileType(const String& file_type);
74 
76  const String& getChecksum() const;
78  void setChecksum(const String& checksum, ChecksumType type);
81 
83  const String& getNativeIDType() const;
85  void setNativeIDType(const String& type);
86 
90  void setNativeIDTypeAccession(const String& accesssion);
91 
92 protected:
95  double file_size_;
98  ChecksumType checksum_type_ = SourceFile::ChecksumType::UNKNOWN_CHECKSUM;
101  };
102 } // namespace OpenMS
103 
Representation of controlled vocabulary term list.
Definition: CVTermList.h:28
Description of a file location, used to store the origin of (meta) data.
Definition: SourceFile.h:22
SourceFile & operator=(SourceFile &&)=default
Move assignment operator.
const String & getChecksum() const
returns the file's checksum
SourceFile & operator=(const SourceFile &)=default
Assignment operator.
String checksum_
Definition: SourceFile.h:97
void setFileType(const String &file_type)
sets the file type
void setPathToFile(const String &path_path_to_file)
sets the file path
bool operator!=(const SourceFile &rhs) const
Equality operator.
SourceFile()
Constructor.
const String & getNameOfFile() const
returns the file name
ChecksumType
Type of the checksum.
Definition: SourceFile.h:26
@ SHA1
Secure Hash Algorithm-1.
Definition: SourceFile.h:28
@ UNKNOWN_CHECKSUM
Unknown checksum type.
Definition: SourceFile.h:27
@ MD5
Message-Digest algorithm 5.
Definition: SourceFile.h:29
const String & getFileType() const
returns the file type
SourceFile(SourceFile &&)=default
Move constructor.
~SourceFile() override
Destructor.
float getFileSize() const
returns the file size in MB
String native_id_type_
Definition: SourceFile.h:99
const String & getNativeIDType() const
Returns the native ID type of the spectra.
const String & getNativeIDTypeAccession() const
Returns the nativeID of the spectra.
String path_to_file_
Definition: SourceFile.h:94
ChecksumType getChecksumType() const
returns the checksum type
const String & getPathToFile() const
returns the file path
String native_id_type_accession_
Definition: SourceFile.h:100
SourceFile(const SourceFile &)=default
Copy constructor.
void setNativeIDType(const String &type)
Sets the native ID type of the spectra.
double file_size_
Definition: SourceFile.h:95
void setNameOfFile(const String &name_of_file)
sets the file name
String file_type_
Definition: SourceFile.h:96
String name_of_file_
Definition: SourceFile.h:93
void setNativeIDTypeAccession(const String &accesssion)
Sets the native ID of the spectra.
void setFileSize(float file_size)
sets the file size in MB
bool operator==(const SourceFile &rhs) const
Equality operator.
void setChecksum(const String &checksum, ChecksumType type)
sets the file's checksum
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22