ChimeraTK-DeviceAccess  03.18.00
MetadataCatalogue.cc
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 
4 #include "MetadataCatalogue.h"
5 
6 #include "Exception.h"
7 
8 #include <stdexcept>
9 
10 namespace ChimeraTK {
11 
12  /********************************************************************************************************************/
13 
14  const std::string& MetadataCatalogue::getMetadata(const std::string& key) const {
15  try {
16  return metadata.at(key);
17  }
18  catch(std::out_of_range&) {
19  throw ChimeraTK::logic_error("");
20  }
21  }
22 
23  /********************************************************************************************************************/
24 
26  return metadata.size();
27  }
28 
29  /********************************************************************************************************************/
30 
31  void MetadataCatalogue::addMetadata(const std::string& key, const std::string& value) {
32  metadata[key] = value;
33  }
34 
35  /********************************************************************************************************************/
36 
38  return metadata.begin();
39  }
40 
41  /********************************************************************************************************************/
42 
44  return metadata.cbegin();
45  }
46 
47  /********************************************************************************************************************/
48 
50  return metadata.end();
51  }
52 
53  /********************************************************************************************************************/
54 
56  return metadata.cend();
57  }
58 
59  /********************************************************************************************************************/
60 
61 } // namespace ChimeraTK
ChimeraTK::MetadataCatalogue::getNumberOfMetadata
size_t getNumberOfMetadata() const
Get number of metadata entries in the catalogue.
Definition: MetadataCatalogue.cc:25
ChimeraTK::MetadataCatalogue::getMetadata
const std::string & getMetadata(const std::string &key) const
Get metadata information for the given key.
Definition: MetadataCatalogue.cc:14
ChimeraTK::MetadataCatalogue::addMetadata
void addMetadata(const std::string &key, const std::string &value)
Add metadata information to the catalogue.
Definition: MetadataCatalogue.cc:31
ChimeraTK::MetadataCatalogue::const_iterator
std::map< std::string, std::string >::const_iterator const_iterator
Definition: MetadataCatalogue.h:33
ChimeraTK::MetadataCatalogue::cend
const_iterator cend() const
Definition: MetadataCatalogue.cc:55
ChimeraTK::MetadataCatalogue::metadata
std::map< std::string, std::string > metadata
Map of meta data.
Definition: MetadataCatalogue.h:41
MetadataCatalogue.h
ChimeraTK::MetadataCatalogue::iterator
std::map< std::string, std::string >::iterator iterator
Iterators for meta data.
Definition: MetadataCatalogue.h:32
ChimeraTK::MetadataCatalogue::begin
iterator begin()
Definition: MetadataCatalogue.cc:37
Exception.h
ChimeraTK::MetadataCatalogue::cbegin
const_iterator cbegin() const
Definition: MetadataCatalogue.cc:43
ChimeraTK
Definition: DummyBackend.h:16
ChimeraTK::MetadataCatalogue::end
iterator end()
Definition: MetadataCatalogue.cc:49
ChimeraTK::logic_error
Exception thrown when a logic error has occured.
Definition: Exception.h:51