Alexandria  2.22.0
Please provide a description of the project.
CatalogConfig.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2021 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
5  * Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option)
6  * any later version.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
9  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
10  * details.
11  *
12  * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
13  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14  */
15 
22 #ifndef _CONFIGURATION_CATALOGCONFIG_H
23 #define _CONFIGURATION_CATALOGCONFIG_H
24 
27 #include "SourceCatalog/Catalog.h"
28 #include "Table/Table.h"
29 #include "Table/TableReader.h"
30 #include <boost/filesystem.hpp>
31 #include <functional>
32 #include <memory>
33 #include <vector>
34 
35 namespace Euclid {
36 namespace Configuration {
37 
66 class CatalogConfig : public Configuration {
67 
68 public:
72 
74  explicit CatalogConfig(long manager_id);
75 
77  virtual ~CatalogConfig() = default;
78 
95 
110  void preInitialize(const UserValues& args) override;
111 
128  void initialize(const UserValues& args) override;
129 
143  void setBaseDir(const boost::filesystem::path& base_dir);
144 
160 
166 
172 
177  std::string getIdColumn() const;
178 
184 
206  Table::Table readAsTable() const;
207 
230 
244  const boost::filesystem::path& getFilename() const;
245 
246 private:
247  boost::filesystem::path m_base_dir;
248  boost::filesystem::path m_filename;
249  bool m_fits_format = true;
253 
254 }; /* End of CatalogConfig class */
255 
256 } /* namespace Configuration */
257 } /* namespace Euclid */
258 
259 #endif
Configuration class for enabling catalog input.
Definition: CatalogConfig.h:66
boost::filesystem::path m_filename
void addAttributeHandler(std::shared_ptr< SourceCatalog::AttributeFromRow > handler)
Adds an attribute handler which will be used for adding attributes at the catalog objects.
const boost::filesystem::path & getFilename() const
Returns the filename of the input catalog.
std::map< std::string, OptionDescriptionList > getProgramOptions() override
Returns the program options defined by the CatalogConfig.
Table::Table readAsTable() const
Returns the catalog as a Table::Table object.
CatalogConfig(long manager_id)
Constructs a new CatalogConfig object.
SourceCatalog::Catalog readAsCatalog() const
Returns the Catalog object.
std::shared_ptr< Table::ColumnInfo > m_column_info
TableToCatalogConverter getTableToCatalogConverter() const
std::unique_ptr< Table::TableReader > getTableReader() const
void setBaseDir(const boost::filesystem::path &base_dir)
Sets the directory used when resolving relative paths.
std::vector< std::shared_ptr< SourceCatalog::AttributeFromRow > > m_attribute_handlers
boost::filesystem::path m_base_dir
std::shared_ptr< Table::ColumnInfo > getColumnInfo() const
void preInitialize(const UserValues &args) override
Checks that all the options are valid. See the exceptions thrown for a detailed list of the checks.
void initialize(const UserValues &args) override
Initializes the CatalogConfig instance.
virtual ~CatalogConfig()=default
Destructor.
Superclass of all configuration classes.
Definition: Configuration.h:45
Catalog contains a container of sources.
Definition: Catalog.h:47
Represents a table.
Definition: Table.h:49