Alexandria  2.16
Please provide a description of the project.
PdfCatalogConfig.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2020 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 /*
20  * @file PdfCatalogConfig.h
21  * @author nikoapos
22  */
23 
24 #ifndef CONFIGURATION_PDFCATALOGCONFIG_H
25 #define CONFIGURATION_PDFCATALOGCONFIG_H
26 
31 
32 namespace Euclid {
33 namespace Configuration {
34 
35 template <typename T>
37 
38 public:
39 
40  explicit PdfCatalogConfig(long manager_id) : Configuration(manager_id) {
41  declareDependency<CatalogConfig>();
42  }
43 
44  virtual ~PdfCatalogConfig() = default;
45 
46  void addPdfColumn(const std::string& pdf_name, const std::string& col_name,
47  std::vector<T> keys) {
49  throw Elements::Exception() << "addPdfColumn() call to initialized PdfCatalogConfig";
50  }
51  m_keys.emplace(pdf_name, std::move(keys));
52  m_column_names.emplace(pdf_name, col_name);
53  }
54 
55  void initialize(const UserValues&) override {
56  getDependency<CatalogConfig>().addAttributeHandler(std::make_shared<SourceCatalog::PdfFromRow<T>>(m_keys, m_column_names));
57  }
58 
59 
60 private:
61 
62  std::map<std::string, std::vector<T>> m_keys;
63  std::map<std::string, std::string> m_column_names;
64 
65 };
66 
67 }
68 }
69 
70 #endif /* CONFIGURATION_PDFCATALOGCONFIG_H */
71 
std::map< std::string, std::string > m_column_names
Superclass of all configuration classes.
Definition: Configuration.h:45
State & getCurrentState()
Returns the current state of the configuration.
void initialize(const UserValues &) override
Method which is called during the initialization phase.
The initialize() method has been called.
std::map< std::string, std::vector< T > > m_keys
void addPdfColumn(const std::string &pdf_name, const std::string &col_name, std::vector< T > keys)
std::map< std::string, boost::program_options::variable_value > UserValues
Definition: Configuration.h:62