33 namespace SourceCatalog {
35 CatalogFromTable::CatalogFromTable(
36 std::shared_ptr<Euclid::Table::ColumnInfo> column_info_ptr,
37 const string& source_id_column_name,
38 std::vector<std::shared_ptr<AttributeFromRow>> attribute_from_row_ptr_vector) {
40 unique_ptr<size_t> source_id_index_ptr = column_info_ptr->find(source_id_column_name);
41 if (source_id_index_ptr ==
nullptr) {
42 throw Elements::Exception() <<
"Column info does not have the column " << source_id_column_name;
44 m_source_id_index = *(source_id_index_ptr);
46 m_attribute_from_row_ptr_vector = std::move(
47 attribute_from_row_ptr_vector);
50 CatalogFromTable::~CatalogFromTable() {
57 vector<Source> source_vector;
63 for (
auto row : input_table) {
65 auto source_id = boost::apply_visitor(castVisitor, row[m_source_id_index]);
67 vector<shared_ptr<Attribute>> attribute_ptr_vector;
69 for (
auto& attribute_from_table_ptr : m_attribute_from_row_ptr_vector) {
70 attribute_ptr_vector.push_back(
71 attribute_from_table_ptr->createAttribute(row));
74 source_vector.push_back(
Source { source_id, move(attribute_ptr_vector) });
77 return Catalog { source_vector };
This type can be used together with boost::apply_visitor to cast boost::variant with an unknown under...
The Source class includes all information related to a sky source.
Catalog contains a container of sources.