OpenMS
Loading...
Searching...
No Matches
Software.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- 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
15#include <functional>
16
17namespace OpenMS
18{
24 class OPENMS_DLLAPI Software :
25 public CVTermList
26 {
27public:
29 explicit Software(const std::string& name = "", const std::string& version = "");
31 Software(const Software&) = default;
33 Software(Software&&) = default;
35 ~Software() override;
36
38 Software& operator=(const Software&) = default;
40 Software& operator=(Software&&)& = default;
41
43 bool operator==(const Software& rhs) const;
45 bool operator!=(const Software& rhs) const;
47 bool operator<(const Software& rhs) const;
48
50 const std::string& getName() const;
52 void setName(const std::string& name);
53
55 const std::string& getVersion() const;
57 void setVersion(const std::string& version);
58
59protected:
60 std::string name_;
61 std::string version_;
62 };
63} // namespace OpenMS
64
65// Hash function specialization for Software
66namespace std
67{
76 template<>
77 struct hash<OpenMS::Software>
78 {
79 std::size_t operator()(const OpenMS::Software& s) const noexcept
80 {
81 std::size_t seed = OpenMS::fnv1a_hash_string(s.getName());
83 return seed;
84 }
85 };
86} // namespace std
87
Representation of controlled vocabulary term list.
Definition CVTermList.h:29
Description of the software used for processing.
Definition Software.h:26
bool operator==(const Software &rhs) const
Equality operator.
Software(Software &&)=default
Move constructor.
const std::string & getName() const
Returns the name of the software.
Software & operator=(Software &&) &=default
Move assignment operator.
std::string name_
Definition Software.h:60
const std::string & getVersion() const
Returns the software version.
std::string version_
Definition Software.h:61
bool operator<(const Software &rhs) const
Less-than operator (for sorting)
Software(const std::string &name="", const std::string &version="")
Constructor.
void setName(const std::string &name)
Sets the name of the software.
bool operator!=(const Software &rhs) const
Inequality operator.
void setVersion(const std::string &version)
Sets the software version.
~Software() override
Destructor.
Software & operator=(const Software &)=default
Assignment operator.
Software(const Software &)=default
Copy constructor.
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
void hash_combine(std::size_t &seed, std::size_t value) noexcept
Combine a hash value with additional data using golden ratio mixing.
Definition HashUtils.h:87
std::size_t fnv1a_hash_string(const std::string &s) noexcept
FNV-1a hash for a string.
Definition HashUtils.h:70
STL namespace.
std::size_t operator()(const OpenMS::Software &s) const noexcept
Definition Software.h:79