Alexandria
2.18
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) |
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") |
|
static |
Definition at line 172 of file AsciiReader.cpp.
References std::istream::seekg(), and std::istream::tellg().
Referenced by Euclid::Table::AsciiReader::getComment().
|
static |
Definition at line 45 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 167 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 107 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 171 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 144 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 159 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 64 of file FitsReaderHelper.cpp.
References std::string::back(), std::vector< T >::empty(), std::string::front(), std::isdigit(), std::string::size(), std::stoi(), and std::string::substr().
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 93 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 203 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 181 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 284 of file AsciiReaderHelper.cpp.
References std::type_index::name().
Referenced by Euclid::Table::AsciiReader::readImpl().
std::vector<Row::cell_type> Euclid::Table::convertVectorColumn | ( | CCfits::Column & | column, |
long | first, | ||
long | last | ||
) |
Definition at line 192 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 345 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 163 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::move(), std::vector< T >::push_back(), 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 192 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 204 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 182 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 172 of file FitsWriterHelper.cpp.
References std::vector< T >::emplace_back().
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 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 110 of file FitsWriterHelper.cpp.
References maxWidth(), std::string::push_back(), and std::vector< T >::push_back().
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 236 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 328 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 72 of file AsciiReaderHelper.cpp.
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(), and getBinaryFormatList().
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 98 of file FitsWriterHelper.cpp.
References Euclid::NdArray::NdArray< T >::shape().
std::vector<size_t> Euclid::Table::parseTDIM | ( | const std::string & | tdim | ) |
Definition at line 129 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 274 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 227 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 217 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 111 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 215 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 219 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 44 of file AsciiWriterHelper.cpp.
References 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.
|
static |
Definition at line 40 of file AsciiReaderHelper.cpp.
Referenced by autoDetectColumnNames().