OpenMS
TOPPASResources.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: Johannes Veit $
6 // $Authors: Johannes Junker $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // OpenMS_GUI config
12 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13 
17 
18 #include <QtCore/QString>
19 #include <QtCore/QObject>
20 
21 #include <map>
22 
23 namespace OpenMS
24 {
30  class OPENMS_GUI_DLLAPI TOPPASResources :
31  QObject
32  {
33  Q_OBJECT
34 
35 public:
36 
42  ~TOPPASResources() override;
46  void add(const QString & key, const QList<TOPPASResource> & resource_list);
48  const QList<TOPPASResource> & get(const QString & key) const;
50  void load(const QString & file_name);
52  void store(const QString & file_name);
54  void clear();
55 
56 protected:
57 
59  std::map<QString, QList<TOPPASResource> > map_;
61  QList<TOPPASResource> empty_list_;
62  };
63 }
64 
A dictionary mapping string keys to lists of TOPPASResource objects.
Definition: TOPPASResources.h:32
TOPPASResources & operator=(const TOPPASResources &rhs)
Assignment operator.
TOPPASResources(const TOPPASResources &rhs)
Copy constructor.
void add(const QString &key, const QList< TOPPASResource > &resource_list)
Adds the (key,resource_list) pair to the dictionary.
void load(const QString &file_name)
Loads the dictionary from file file_name.
QList< TOPPASResource > empty_list_
The empty list.
Definition: TOPPASResources.h:61
TOPPASResources()
Constructor.
const QList< TOPPASResource > & get(const QString &key) const
Returns the resource list that key is mapped to, or an empty list if key does not exist.
~TOPPASResources() override
Destructor.
void clear()
Clears the dictionary.
std::map< QString, QList< TOPPASResource > > map_
The dictionary.
Definition: TOPPASResources.h:59
void store(const QString &file_name)
Writes the dictionary to file file_name.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22