OpenMS
include/OpenMS/METADATA/ID/InputFile.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: Hendrik Weisser $
6 // $Authors: Hendrik Weisser $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
12 
13 #include <boost/multi_index_container.hpp>
14 #include <boost/multi_index/ordered_index.hpp>
15 #include <boost/multi_index/member.hpp>
16 
17 #include <set>
18 
19 namespace OpenMS
20 {
21  namespace IdentificationDataInternal
22  {
24  struct InputFile
25  {
27 
29 
30  std::set<String> primary_files;
31 
32  explicit InputFile(const String& name,
33  const String& experimental_design_id = "",
34  const std::set<String>& primary_files =
35  std::set<String>()):
38  {
39  }
40 
41  InputFile(const InputFile& other) = default;
42 
44  InputFile& merge(const InputFile& other)
45  {
46  if (experimental_design_id.empty())
47  {
49  }
50  else if (!other.experimental_design_id.empty() && experimental_design_id != other.experimental_design_id)
51  {
52  throw Exception::InvalidValue(__FILE__, __LINE__,
53  OPENMS_PRETTY_FUNCTION,
54  "Trying to overwrite InputFile experimental design id with conflicting value.",
56  }
57  primary_files.insert(other.primary_files.begin(),
58  other.primary_files.end());
59  return *this;
60  }
61  };
62 
63  typedef boost::multi_index_container<
64  InputFile,
65  boost::multi_index::indexed_by<
66  boost::multi_index::ordered_unique<boost::multi_index::member<
70 
71  }
72 }
OpenMS::InputFile InputFile
Definition: FLASHDeconvTabWidget.h:101
Invalid value exception.
Definition: Exception.h:303
A more convenient string class.
Definition: String.h:34
IteratorWrapper< InputFiles::iterator > InputFileRef
Definition: include/OpenMS/METADATA/ID/InputFile.h:69
boost::multi_index_container< InputFile, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< InputFile, String, &InputFile::name > > > > InputFiles
Definition: include/OpenMS/METADATA/ID/InputFile.h:68
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Information about input files that were processed.
Definition: include/OpenMS/METADATA/ID/InputFile.h:25
std::set< String > primary_files
Definition: include/OpenMS/METADATA/ID/InputFile.h:30
InputFile & merge(const InputFile &other)
Merge in data from another object.
Definition: include/OpenMS/METADATA/ID/InputFile.h:44
InputFile(const InputFile &other)=default
String name
Definition: include/OpenMS/METADATA/ID/InputFile.h:26
InputFile(const String &name, const String &experimental_design_id="", const std::set< String > &primary_files=std::set< String >())
Definition: include/OpenMS/METADATA/ID/InputFile.h:32
String experimental_design_id
Definition: include/OpenMS/METADATA/ID/InputFile.h:28