OpenMS
MetaInfoInterface.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, 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 
11 #include <vector>
12 
13 #include <OpenMS/CONCEPT/Types.h>
16 
17 namespace OpenMS
18 {
19  class String;
20  class MetaInfo;
21 
34  class OPENMS_DLLAPI MetaInfoInterface
35  {
36 public:
37 
46 
48  MetaInfoInterface& operator=(const MetaInfoInterface& rhs);
50  MetaInfoInterface& operator=(MetaInfoInterface&&) noexcept;
51 
53  void swap(MetaInfoInterface& rhs);
54 
56  bool operator==(const MetaInfoInterface& rhs) const;
58  bool operator!=(const MetaInfoInterface& rhs) const;
59 
61  const DataValue& getMetaValue(const String& name) const;
62 
64  DataValue getMetaValue(const String& name, const DataValue& default_value) const; // Note: return needs to be by value to prevent life-time issues at caller site (e.g. if he passes a temporary to default-value)
65 
67  const DataValue& getMetaValue(UInt index) const;
68 
70  DataValue getMetaValue(UInt index, const DataValue& default_value) const; // Note: return needs to be by value to prevent life-time issues at caller site
71 
73  bool metaValueExists(const String& name) const;
75  bool metaValueExists(UInt index) const;
76 
78  void setMetaValue(const String& name, const DataValue& value);
80  void setMetaValue(UInt index, const DataValue& value);
81 
83  void removeMetaValue(const String& name);
85  void removeMetaValue(UInt index);
86 
88  void addMetaValues(const MetaInfoInterface& from);
89 
91  static MetaInfoRegistry& metaRegistry();
92 
94  void getKeys(std::vector<String>& keys) const;
95 
97  void getKeys(std::vector<UInt>& keys) const;
98 
100  bool isMetaEmpty() const;
101 
103  void clearMetaInfo();
104 
105 protected:
106 
108  inline void createIfNotExists_();
109 
111  MetaInfo* meta_;
112  };
113 
114 } // namespace OpenMS
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:33
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
MetaInfoInterface(MetaInfoInterface &&) noexcept
Move constructor.
MetaInfoInterface()
Constructor.
MetaInfoInterface(const MetaInfoInterface &rhs)
Copy constructor.
Registry which assigns unique integer indices to strings.
Definition: MetaInfoRegistry.h:50
A Type-Name-Value tuple class.
Definition: MetaInfo.h:43
A more convenient string class.
Definition: String.h:34
unsigned int UInt
Unsigned integer type.
Definition: Types.h:64
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19