Alexandria  2.16
Please provide a description of the project.
Catalog.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 
27 #ifndef CATALOG_H_
28 #define CATALOG_H_
29 
30 #include <map>
31 #include <memory>
32 
33 #include "ElementsKernel/Export.h"
34 
35 #include "SourceCatalog/Source.h"
36 
37 namespace Euclid {
38 namespace SourceCatalog {
39 
48 {
49 
50 public:
51 
65  explicit Catalog(std::vector<Source> source_vector);
66 
68 
72  virtual ~Catalog() = default;
73 
82  const_iterator begin() const { return m_source_vector.cbegin() ; }
83 
92  const_iterator end() const { return m_source_vector.cend() ; }
93 
103  std::shared_ptr<Source> find(const Source::id_type &source_id) const;
104 
111  size_t size() const { return m_source_vector.size();}
112 
113 private:
114  // Vector of Source objects
115  std::vector<Source> m_source_vector { };
116  // Map of the Source identification and their location
117  // in the Source vector
118  std::map<Source::id_type, size_t> m_source_index_map { };
119 
120 };
121 
122 } /* namespace SourceCatalog */
123 } // end of namespace Euclid
124 
125 #endif /* CATALOG_H_ */
std::shared_ptr
STL class.
Export.h
std::vector
STL class.
Source.h
Euclid::SourceCatalog::Catalog
Catalog contains a container of sources.
Definition: Catalog.h:48
Euclid::SourceCatalog::Catalog::~Catalog
virtual ~Catalog()=default
Destructor.
ELEMENTS_API
#define ELEMENTS_API
std::map< Source::id_type, size_t >
Euclid::SourceCatalog::Catalog::end
const_iterator end() const
Get an const_iterator pointing to the last element in the m_source_vector vector.
Definition: Catalog.h:92
Euclid::SourceCatalog::Source::id_type
boost::variant< int64_t, std::string > id_type
Definition: Source.h:51
Euclid::SourceCatalog::Catalog::begin
const_iterator begin() const
Get a const_iterator pointing to the first element in the m_source_vector vector.
Definition: Catalog.h:82
Euclid::SourceCatalog::Catalog::size
size_t size() const
Get the size of the vector container.
Definition: Catalog.h:111
Euclid
Definition: InstOrRefHolder.h:29
Euclid::SourceCatalog::Catalog::const_iterator
std::vector< Source >::const_iterator const_iterator
Definition: Catalog.h:67