Alexandria 2.32.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Euclid::SourceCatalog::Catalog Class Reference

Catalog contains a container of sources. More...

#include <Catalog.h>

Collaboration diagram for Euclid::SourceCatalog::Catalog:

Public Types

typedef std::vector< Source >::const_iterator const_iterator

Public Member Functions

 Catalog (const std::vector< Source > &source_vector)
 Build a catalog of Source objects.
virtual ~Catalog ()=default
 Destructor.
const_iterator begin () const
 Get a const_iterator pointing to the first element in the m_source_vector vector.
const_iterator end () const
 Get an const_iterator pointing to the last element in the m_source_vector vector.
std::shared_ptr< Sourcefind (const Source::id_type &source_id) const
 Find the Source object from its identification number.
size_t size () const
 Get the size of the vector container.

Private Attributes

std::vector< Sourcem_source_vector {}
std::map< Source::id_type, size_tm_source_index_map {}

Detailed Description

Catalog contains a container of sources.

Definition at line 47 of file Catalog.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 65 of file Catalog.h.

Constructor & Destructor Documentation

◆ Catalog()

Euclid::SourceCatalog::Catalog::Catalog ( const std::vector< Source > & source_vector)
explicit

Build a catalog of Source objects.

Constructs a vector container of Source objects, a map of source identification and an index which is the location of the Source object in the vector container

Parameters
source_vectorVector container of Source objects
Exceptions
Elements::ExceptionA Source object can not be inserted twice in the map

Definition at line 36 of file Catalog.cpp.

References m_source_index_map, and m_source_vector.

◆ ~Catalog()

virtual Euclid::SourceCatalog::Catalog::~Catalog ( )
virtualdefault

Destructor.

Member Function Documentation

◆ begin()

const_iterator Euclid::SourceCatalog::Catalog::begin ( ) const
inline

Get a const_iterator pointing to the first element in the m_source_vector vector.

Returns
Returns a const_iterator pointing to the first element in the m_source_vector container

Definition at line 80 of file Catalog.h.

References m_source_vector.

◆ end()

const_iterator Euclid::SourceCatalog::Catalog::end ( ) const
inline

Get an const_iterator pointing to the last element in the m_source_vector vector.

Returns
Returns a const_iterator pointing to the past-the-end element in the m_source_vector container

Definition at line 92 of file Catalog.h.

References m_source_vector.

◆ find()

std::shared_ptr< Source > Euclid::SourceCatalog::Catalog::find ( const Source::id_type & source_id) const

Find the Source object from its identification number.

Parameters
source_idThe source identification number
Returns
A shared pointer to the Source object or a null pointer in case of no object was found for this source_id

Definition at line 52 of file Catalog.cpp.

References m_source_index_map, m_source_vector, and std::make_shared().

Here is the call graph for this function:

◆ size()

size_t Euclid::SourceCatalog::Catalog::size ( ) const
inline

Get the size of the vector container.

Returns
The size of the container which is the number of Source objects

Definition at line 113 of file Catalog.h.

References m_source_vector.

Member Data Documentation

◆ m_source_index_map

std::map<Source::id_type, size_t> Euclid::SourceCatalog::Catalog::m_source_index_map {}
private

Definition at line 122 of file Catalog.h.

Referenced by Catalog(), and find().

◆ m_source_vector

std::vector<Source> Euclid::SourceCatalog::Catalog::m_source_vector {}
private

Definition at line 119 of file Catalog.h.

Referenced by begin(), Catalog(), end(), find(), and size().


The documentation for this class was generated from the following files: