Alexandria
2.22.0
Please provide a description of the project.
|
Classes | |
class | StreamRewinder |
This class gets a stream as argument during construction and when it is deleted it sets the position of the stream back to where it was during the constructor call. More... | |
struct | ToStringVisitor |
class | AsciiReader |
TableReader implementation for reading ASCII tables from streams. More... | |
class | AsciiWriter |
TableWriter implementation for writing ASCII tables to streams. More... | |
class | CastVisitor |
class | CastVisitor< std::string > |
class | CastVisitor< double > |
class | CastVisitor< float > |
class | CastVisitor< int64_t > |
class | CastVisitor< int32_t > |
class | CastVisitor< std::vector< VectorType > > |
class | ColumnDescription |
Contains the description of a specific column of a Table. More... | |
class | ColumnInfo |
Provides information about the columns of a Table. More... | |
class | FitsReader |
TableReader implementation for reading FITS tables. More... | |
class | FitsWriter |
TableWriter implementation for writing tables in FITS format. More... | |
class | Row |
Represents one row of a Table. More... | |
class | Table |
Represents a table. More... | |
class | TableReader |
Interface for classes reading tables. More... | |
class | TableWriter |
Interface for classes writing tables. More... | |
Functions | |
static std::string | _peekLine (std::istream &in) |
size_t | countColumns (std::istream &in, const std::string &comment) |
Returns the number of whitespace separated tokens of the first non commented line. More... | |
std::type_index | keywordToType (const std::string &keyword) |
std::map< std::string, ColumnDescription > | autoDetectColumnDescriptions (std::istream &in, const std::string &comment) |
Reads the column descriptions of the given stream. More... | |
std::vector< std::string > | autoDetectColumnNames (std::istream &in, const std::string &comment, size_t columns_number) |
Reads the column names of the given stream. More... | |
Row::cell_type | convertToCellType (const std::string &value, std::type_index type) |
Converts the given value to a Row::cell_type of the given type. More... | |
bool | hasNextRow (std::istream &in, const std::string &comment) |
std::size_t | countRemainingRows (std::istream &in, const std::string &comment) |
std::string | typeToKeyword (std::type_index type) |
Converts a type to its string representation. More... | |
std::vector< size_t > | calculateColumnLengths (const Table &table) |
Calculates the sizes in characters each column of the table needs. More... | |
std::string | quoted (const std::string &str) |
static CCfits::HDU & | _readKeys (CCfits::HDU &hdu) |
std::vector< std::string > | autoDetectColumnNames (const CCfits::Table &table_hdu) |
Reads the column names of the given table HDU. More... | |
std::type_index | asciiFormatToType (const std::string &format) |
std::type_index | binaryFormatToType (const std::string &format, const std::vector< size_t > &shape) |
std::vector< size_t > | parseTDIM (const std::string &tdim) |
std::vector< std::type_index > | autoDetectColumnTypes (const CCfits::Table &table_hdu) |
Reads the column types of the given table HDU. More... | |
std::vector< std::string > | autoDetectColumnUnits (const CCfits::Table &table_hdu) |
Reads the column units based on the TUNITn keyword. More... | |
std::vector< std::string > | autoDetectColumnDescriptions (const CCfits::Table &table_hdu) |
Reads the column descriptions based on the TDESCn keyword. More... | |
template<typename T > | |
std::vector< Row::cell_type > | convertScalarColumn (CCfits::Column &column, long first, long last) |
template<typename T > | |
std::vector< Row::cell_type > | convertVectorColumn (CCfits::Column &column, long first, long last) |
template<typename T > | |
std::vector< Row::cell_type > | convertNdArrayColumn (CCfits::Column &column, long first, long last) |
std::vector< Row::cell_type > | translateColumn (CCfits::Column &column, std::type_index type) |
Returns a vector representing the given FITS table column data, converted to the requested type. More... | |
std::vector< Row::cell_type > | translateColumn (CCfits::Column &column, std::type_index type, long first, long last) |
template<typename T > | |
std::string | scientificFormat (T value) |
size_t | maxWidth (const Table &table, size_t column_index) |
size_t | maxWidthScientific (const Table &table, size_t column_index) |
std::vector< std::string > | getAsciiFormatList (const Table &table) |
Returns a vector with strings representing the FITS ASCII table formats for the given table. More... | |
template<typename T > | |
size_t | vectorSize (const Table &table, size_t column_index) |
template<typename T > | |
size_t | ndArraySize (const Table &table, size_t column_index) |
template<typename T > | |
static std::string | GenericScalarFormat (const Table &, size_t) |
template<typename T > | |
static std::string | GenericVectorFormat (const Table &table, size_t column_index) |
template<typename T > | |
static std::string | GenericNdFormat (const Table &table, size_t column_index) |
std::vector< std::string > | getBinaryFormatList (const Table &table) |
Returns a vector with strings representing the FITS binary table formats for the given table. More... | |
template<typename T > | |
std::vector< T > | createColumnData (const Euclid::Table::Table &table, size_t column_index) |
template<typename T > | |
std::vector< std::valarray< T > > | createVectorColumnData (const Euclid::Table::Table &table, size_t column_index) |
template<typename T > | |
std::vector< T > | createSingleValueVectorColumnData (const Euclid::Table::Table &table, size_t column_index) |
template<typename T > | |
std::vector< std::valarray< T > > | createNdArrayColumnData (const Euclid::Table::Table &table, size_t column_index) |
template<typename T > | |
std::vector< T > | createSingleNdArrayVectorColumnData (const Euclid::Table::Table &table, size_t column_index) |
template<typename T > | |
void | populateVectorColumn (const Table &table, size_t column_index, CCfits::ExtHDU &table_hdu, long first_row) |
template<typename T > | |
void | populateNdArrayColumn (const Table &table, size_t column_index, CCfits::ExtHDU &table_hdu, long first_row) |
std::string | getTDIM (const Table &table, size_t column_index) |
void | populateColumn (const Table &table, size_t column_index, CCfits::ExtHDU &table_hdu, long first_row) |
std::shared_ptr< ColumnInfo > | createColumnInfo (const std::vector< std::string > &names, const std::vector< std::type_index > &types, const std::vector< std::string > &units, const std::vector< std::string > &descriptions) |
Creates a ColumnInfo object from the given names and types. More... | |
Variables | |
static Elements::Logging | logger = Elements::Logging::getLogger("AsciiReader") |
const std::vector< std::pair< std::string, std::type_index > > | KeywordTypeMap |
const std::map< std::type_index, std::function< Row::cell_type(const std::string &)> > | sCellConverter |
const std::vector< std::pair< char, std::type_index > > | NdTypeMap |
const std::vector< std::pair< char, std::type_index > > | ScalarTypeMap |
const std::vector< std::pair< char, std::type_index > > | VectorTypeMap |
const std::map< std::type_index, std::function< std::string(const Table &, size_t)> > | BinaryFormatter |
|
static |
Definition at line 166 of file AsciiReader.cpp.
References std::istream::seekg(), and std::istream::tellg().
Referenced by Euclid::Table::AsciiReader::getComment().
|
static |
Definition at line 39 of file FitsReader.cpp.
std::type_index Euclid::Table::asciiFormatToType | ( | const std::string & | format | ) |
Definition at line 48 of file FitsReaderHelper.cpp.
Referenced by autoDetectColumnTypes().
ELEMENTS_API std::vector< std::string > Euclid::Table::autoDetectColumnDescriptions | ( | const CCfits::Table & | table_hdu | ) |
Reads the column descriptions based on the TDESCn keyword.
Definition at line 151 of file FitsReaderHelper.cpp.
References std::string::find(), and std::to_string().
ELEMENTS_API std::map< std::string, ColumnDescription > Euclid::Table::autoDetectColumnDescriptions | ( | std::istream & | in, |
const std::string & | comment | ||
) |
Reads the column descriptions of the given stream.
For more information about the auto-detection rules see the constructor of AsciiReader. When the method returns, the given stream is positioned at the same position like before the method was called.
in | The stream to read the column names from |
comment | The comment pattern |
Elements::Exception | if there are duplicate column names |
Elements::Exception | if any of the types is not one of the valid keywords |
Definition at line 115 of file AsciiReaderHelper.cpp.
References std::string::begin(), std::map< K, T >::count(), std::map< K, T >::emplace(), std::string::empty(), std::string::end(), std::string::erase(), std::forward_as_tuple(), keywordToType(), quoted(), and std::stringstream::str().
Referenced by Euclid::Table::AsciiReader::readColumnInfo(), and Euclid::Table::FitsReader::readColumnInfo().
ELEMENTS_API std::vector< std::string > Euclid::Table::autoDetectColumnNames | ( | const CCfits::Table & | table_hdu | ) |
Reads the column names of the given table HDU.
For more information about the column naming see the constructor of FitsReader.
table_hdu | The HDU to read the columns from |
Definition at line 36 of file FitsReaderHelper.cpp.
References std::string::empty(), std::move(), and std::to_string().
ELEMENTS_API std::vector< std::string > Euclid::Table::autoDetectColumnNames | ( | std::istream & | in, |
const std::string & | comment, | ||
size_t | columns_number | ||
) |
Reads the column names of the given stream.
For more information about the auto-detection rules see the constructor of AsciiReader. When the method returns, the given stream is positioned at the same position like before the method was called.
in | The stream to read the column names from |
comment | The comment pattern |
columns_number | The number of columns |
Elements::Exception | if there are duplicate column names |
Definition at line 179 of file AsciiReaderHelper.cpp.
References std::string::empty(), std::string::erase(), std::string::find(), logger, std::move(), quoted(), std::string::substr(), std::to_string(), and Elements::Logging::warn().
Referenced by Euclid::Table::AsciiReader::readColumnInfo(), and Euclid::Table::FitsReader::readColumnInfo().
ELEMENTS_API std::vector< std::type_index > Euclid::Table::autoDetectColumnTypes | ( | const CCfits::Table & | table_hdu | ) |
Reads the column types of the given table HDU.
For more information about the supported types and the type conversion see the FitsReader::read() method.
table_hdu | The HDU to read the types from |
Elements::Exception | if a column type is not supported |
Definition at line 128 of file FitsReaderHelper.cpp.
References asciiFormatToType(), binaryFormatToType(), parseTDIM(), and std::vector< T >::push_back().
Referenced by Euclid::Table::FitsReader::readColumnInfo().
ELEMENTS_API std::vector< std::string > Euclid::Table::autoDetectColumnUnits | ( | const CCfits::Table & | table_hdu | ) |
Reads the column units based on the TUNITn keyword.
Definition at line 143 of file FitsReaderHelper.cpp.
References std::vector< T >::push_back().
Referenced by Euclid::Table::FitsReader::readColumnInfo().
std::type_index Euclid::Table::binaryFormatToType | ( | const std::string & | format, |
const std::vector< size_t > & | shape | ||
) |
Definition at line 76 of file FitsReaderHelper.cpp.
References std::string::back(), std::find_if(), std::string::front(), std::isdigit(), NdTypeMap, ScalarTypeMap, std::vector< T >::size(), std::string::size(), std::stoi(), std::string::substr(), and VectorTypeMap.
Referenced by autoDetectColumnTypes().
ELEMENTS_API std::vector< size_t > Euclid::Table::calculateColumnLengths | ( | const Table & | table | ) |
Calculates the sizes in characters each column of the table needs.
The size is calculated as the size of the longest column entry (including type and name) plus one to ensure separation of the values.
table | The table |
Definition at line 52 of file AsciiWriterHelper.cpp.
References std::max(), quoted(), s, and std::string::size().
Referenced by Euclid::Table::AsciiWriter::append(), and Euclid::Table::AsciiWriter::init().
std::vector<Row::cell_type> Euclid::Table::convertNdArrayColumn | ( | CCfits::Column & | column, |
long | first, | ||
long | last | ||
) |
Definition at line 187 of file FitsReaderHelper.cpp.
References std::begin(), std::end(), std::move(), parseTDIM(), and std::vector< T >::push_back().
std::vector<Row::cell_type> Euclid::Table::convertScalarColumn | ( | CCfits::Column & | column, |
long | first, | ||
long | last | ||
) |
Definition at line 165 of file FitsReaderHelper.cpp.
References std::vector< T >::push_back().
ELEMENTS_API Row::cell_type Euclid::Table::convertToCellType | ( | const std::string & | value, |
std::type_index | type | ||
) |
Converts the given value to a Row::cell_type of the given type.
For more information of the supported types see the documentation of the Euclid::Table::AsciiReader constructor.
value | The value to convert |
type | The type of the cell |
Elements::Exception | if the conversion fails |
Definition at line 324 of file AsciiReaderHelper.cpp.
References std::type_index::name(), and sCellConverter.
Referenced by Euclid::Table::AsciiReader::readImpl().
std::vector<Row::cell_type> Euclid::Table::convertVectorColumn | ( | CCfits::Column & | column, |
long | first, | ||
long | last | ||
) |
Definition at line 176 of file FitsReaderHelper.cpp.
References std::begin(), std::end(), and std::vector< T >::push_back().
ELEMENTS_API size_t Euclid::Table::countColumns | ( | std::istream & | in, |
const std::string & | comment | ||
) |
Returns the number of whitespace separated tokens of the first non commented line.
When the method returns the given stream is positioned at the same position like before the method was called.
in | The string to read from |
comment | The comment pattern |
Elements::Exception | if there is no uncommented, non-empty line |
Definition at line 42 of file AsciiReaderHelper.cpp.
References std::string::empty(), std::string::find(), quoted(), and std::string::substr().
Referenced by Euclid::Table::AsciiReader::readColumnInfo().
ELEMENTS_API std::size_t Euclid::Table::countRemainingRows | ( | std::istream & | in, |
const std::string & | comment | ||
) |
Definition at line 353 of file AsciiReaderHelper.cpp.
References std::string::empty(), std::string::find(), and std::string::substr().
Referenced by Euclid::Table::AsciiReader::rowsLeft().
std::vector<T> Euclid::Table::createColumnData | ( | const Euclid::Table::Table & | table, |
size_t | column_index | ||
) |
Definition at line 192 of file FitsWriterHelper.cpp.
References std::vector< T >::push_back().
std::shared_ptr< ColumnInfo > Euclid::Table::createColumnInfo | ( | const std::vector< std::string > & | names, |
const std::vector< std::type_index > & | types, | ||
const std::vector< std::string > & | units, | ||
const std::vector< std::string > & | descriptions | ||
) |
Creates a ColumnInfo object from the given names and types.
Definition at line 30 of file ReaderHelper.cpp.
References std::vector< T >::emplace_back(), std::move(), and std::vector< T >::size().
Referenced by Euclid::Table::AsciiReader::readColumnInfo(), and Euclid::Table::FitsReader::readColumnInfo().
std::vector<std::valarray<T> > Euclid::Table::createNdArrayColumnData | ( | const Euclid::Table::Table & | table, |
size_t | column_index | ||
) |
Definition at line 221 of file FitsWriterHelper.cpp.
References std::begin(), std::copy(), std::end(), and std::move().
std::vector<T> Euclid::Table::createSingleNdArrayVectorColumnData | ( | const Euclid::Table::Table & | table, |
size_t | column_index | ||
) |
Definition at line 233 of file FitsWriterHelper.cpp.
References std::vector< T >::push_back().
std::vector<T> Euclid::Table::createSingleValueVectorColumnData | ( | const Euclid::Table::Table & | table, |
size_t | column_index | ||
) |
Definition at line 211 of file FitsWriterHelper.cpp.
References std::vector< T >::push_back().
std::vector<std::valarray<T> > Euclid::Table::createVectorColumnData | ( | const Euclid::Table::Table & | table, |
size_t | column_index | ||
) |
Definition at line 201 of file FitsWriterHelper.cpp.
References std::vector< T >::emplace_back().
|
static |
Definition at line 141 of file FitsWriterHelper.cpp.
|
static |
Definition at line 120 of file FitsWriterHelper.cpp.
References ScalarTypeMap.
|
static |
Definition at line 135 of file FitsWriterHelper.cpp.
ELEMENTS_API std::vector< std::string > Euclid::Table::getAsciiFormatList | ( | const Table & | table | ) |
Returns a vector with strings representing the FITS ASCII table formats for the given table.
For more details on the conversions between the table formats and the FITS ASCII formats see the documentation of the FitsWriter::write() method.
table | The table |
Definition at line 63 of file FitsWriterHelper.cpp.
References std::max(), maxWidth(), maxWidthScientific(), and std::vector< T >::push_back().
Referenced by Euclid::Table::FitsWriter::init().
ELEMENTS_API std::vector< std::string > Euclid::Table::getBinaryFormatList | ( | const Table & | table | ) |
Returns a vector with strings representing the FITS binary table formats for the given table.
For more details on the conversions between the table formats and the FITS binary formats see the documentation of the FitsWriter::write() method.
table | The table |
Definition at line 173 of file FitsWriterHelper.cpp.
References BinaryFormatter, std::vector< T >::emplace_back(), and std::vector< T >::reserve().
Referenced by Euclid::Table::FitsWriter::init().
ELEMENTS_API std::string Euclid::Table::getTDIM | ( | const Table & | table, |
size_t | column_index | ||
) |
Serializes the shape of the column, if it is a multidimensional array. Otherwise, returns an empty string
table | |
column_index |
Definition at line 265 of file FitsWriterHelper.cpp.
References std::vector< T >::size(), and std::stringstream::str().
Referenced by Euclid::Table::FitsWriter::init().
ELEMENTS_API bool Euclid::Table::hasNextRow | ( | std::istream & | in, |
const std::string & | comment | ||
) |
Definition at line 336 of file AsciiReaderHelper.cpp.
References std::string::empty(), std::string::find(), and std::string::substr().
Referenced by Euclid::Table::AsciiReader::hasMoreRows().
std::type_index Euclid::Table::keywordToType | ( | const std::string & | keyword | ) |
Definition at line 106 of file AsciiReaderHelper.cpp.
References KeywordTypeMap.
Referenced by autoDetectColumnDescriptions().
size_t Euclid::Table::maxWidth | ( | const Table & | table, |
size_t | column_index | ||
) |
Definition at line 47 of file FitsWriterHelper.cpp.
References std::max().
Referenced by getAsciiFormatList().
size_t Euclid::Table::maxWidthScientific | ( | const Table & | table, |
size_t | column_index | ||
) |
Definition at line 55 of file FitsWriterHelper.cpp.
References std::max(), and scientificFormat().
Referenced by getAsciiFormatList().
size_t Euclid::Table::ndArraySize | ( | const Table & | table, |
size_t | column_index | ||
) |
Definition at line 101 of file FitsWriterHelper.cpp.
References Euclid::NdArray::NdArray< T >::shape().
std::vector<size_t> Euclid::Table::parseTDIM | ( | const std::string & | tdim | ) |
Definition at line 113 of file FitsReaderHelper.cpp.
References std::string::back(), std::string::empty(), std::string::front(), std::reverse(), s, std::string::size(), and std::string::substr().
Referenced by autoDetectColumnTypes(), and convertNdArrayColumn().
void Euclid::Table::populateColumn | ( | const Table & | table, |
size_t | column_index, | ||
CCfits::ExtHDU & | table_hdu, | ||
long | first_row | ||
) |
Definition at line 307 of file FitsWriterHelper.cpp.
Referenced by Euclid::Table::FitsWriter::append().
void Euclid::Table::populateNdArrayColumn | ( | const Table & | table, |
size_t | column_index, | ||
CCfits::ExtHDU & | table_hdu, | ||
long | first_row | ||
) |
Definition at line 256 of file FitsWriterHelper.cpp.
void Euclid::Table::populateVectorColumn | ( | const Table & | table, |
size_t | column_index, | ||
CCfits::ExtHDU & | table_hdu, | ||
long | first_row | ||
) |
Definition at line 246 of file FitsWriterHelper.cpp.
std::string Euclid::Table::quoted | ( | const std::string & | str | ) |
Wrapper for boost::io::quoted
The wrapping is done for two reasons:
str |
Definition at line 70 of file AsciiWriterHelper.cpp.
References std::stringstream::str().
Referenced by autoDetectColumnDescriptions(), autoDetectColumnNames(), calculateColumnLengths(), countColumns(), Euclid::Table::AsciiWriter::init(), Euclid::Table::ToStringVisitor::operator()(), and Euclid::Table::AsciiReader::readImpl().
std::string Euclid::Table::scientificFormat | ( | T | value | ) |
Definition at line 41 of file FitsWriterHelper.cpp.
References std::scientific(), and std::ostringstream::str().
Referenced by maxWidthScientific().
ELEMENTS_API std::vector< Row::cell_type > Euclid::Table::translateColumn | ( | CCfits::Column & | column, |
std::type_index | type | ||
) |
Returns a vector representing the given FITS table column data, converted to the requested type.
Note that the column CCfits::Column does not provide const versions of the read methods, so the column argument cannot be const.
column | The column to convert |
type | The type of the column |
Definition at line 199 of file FitsReaderHelper.cpp.
Referenced by Euclid::Table::FitsReader::readImpl().
ELEMENTS_API std::vector< Row::cell_type > Euclid::Table::translateColumn | ( | CCfits::Column & | column, |
std::type_index | type, | ||
long | first, | ||
long | last | ||
) |
Definition at line 203 of file FitsReaderHelper.cpp.
References std::type_index::name().
ELEMENTS_API std::string Euclid::Table::typeToKeyword | ( | std::type_index | type | ) |
Converts a type to its string representation.
type | The type to convert |
Elements::Exception | if the given type is not supported |
Definition at line 43 of file AsciiWriterHelper.cpp.
References KeywordTypeMap, and std::type_index::name().
Referenced by Euclid::Table::AsciiWriter::init().
size_t Euclid::Table::vectorSize | ( | const Table & | table, |
size_t | column_index | ||
) |
Definition at line 87 of file FitsWriterHelper.cpp.
const std::map<std::type_index, std::function<std::string(const Table&, size_t)> > Euclid::Table::BinaryFormatter |
Definition at line 146 of file FitsWriterHelper.cpp.
Referenced by getBinaryFormatList().
|
extern |
Mapping between string representation of a type and the typeid When doing the reverse lookup (from type id to string), the first one is the preferred one
Definition at line 41 of file AsciiWriterHelper.cpp.
Referenced by keywordToType(), and typeToKeyword().
|
static |
Definition at line 40 of file AsciiReaderHelper.cpp.
Referenced by autoDetectColumnNames().
|
extern |
Referenced by binaryFormatToType().
const std::vector< std::pair< char, std::type_index > > Euclid::Table::ScalarTypeMap |
Definition at line 69 of file FitsReaderHelper.cpp.
Referenced by binaryFormatToType(), and GenericScalarFormat().
const std::map<std::type_index, std::function<Row::cell_type(const std::string&)> > Euclid::Table::sCellConverter |
Definition at line 292 of file AsciiReaderHelper.cpp.
Referenced by convertToCellType().
const std::vector<std::pair<char, std::type_index> > Euclid::Table::VectorTypeMap |
Definition at line 71 of file FitsReaderHelper.cpp.
Referenced by binaryFormatToType().