Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Classes | Functions | Variables
Euclid::Table Namespace Reference

Classes

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< double >
 
class  CastVisitor< float >
 
class  CastVisitor< int32_t >
 
class  CastVisitor< int64_t >
 
class  CastVisitor< std::string >
 
class  CastVisitor< std::vector< VectorType > >
 
struct  cell_stream_adaptor
 
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...
 
struct  StreamCellVisitor
 
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...
 
class  Table
 Represents a table. More...
 
class  TableReader
 Interface for classes reading tables. More...
 
class  TableWriter
 Interface for classes writing tables. More...
 
struct  ToStringVisitor
 

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.
 
std::type_index keywordToType (const std::string &keyword)
 
std::map< std::string, ColumnDescriptionautoDetectColumnDescriptions (std::istream &in, const std::string &comment)
 Reads the column descriptions of the given stream.
 
std::vector< std::stringautoDetectColumnNames (std::istream &in, const std::string &comment, size_t columns_number)
 Reads the column names of the given stream.
 
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.
 
bool hasNextRow (std::istream &in, const std::string &comment)
 
std::size_t countRemainingRows (std::istream &in, const std::string &comment)
 
std::vector< std::stringsplitLine (std::string line, const std::string &comment)
 
std::vector< std::stringfirstDataLine (std::istream &in, const std::string &comment)
 
std::pair< std::type_index, std::size_tguessColumnType (const std::string &token)
 
std::string typeToKeyword (std::type_index type)
 Converts a type to its string representation.
 
std::vector< size_t > calculateColumnLengths (const Table &table)
 Calculates the sizes in characters each column of the table needs.
 
std::string quoted (const std::string &str)
 
static CCfits::HDU & _readKeys (CCfits::HDU &hdu)
 
std::vector< std::stringautoDetectColumnNames (const CCfits::Table &table_hdu)
 Reads the column names of the given table HDU.
 
std::pair< std::type_index, std::size_tasciiFormatToType (const std::string &format)
 
std::pair< std::type_index, std::size_tbinaryFormatToType (const std::string &format, const std::vector< size_t > &shape)
 
std::vector< size_t > parseTDIM (const std::string &tdim)
 
std::vector< std::pair< std::type_index, std::size_t > > autoDetectColumnTypes (const CCfits::Table &table_hdu)
 Reads the column types of the given table HDU.
 
std::vector< std::stringautoDetectColumnUnits (const CCfits::Table &table_hdu)
 Reads the column units based on the TUNITn keyword.
 
std::vector< std::stringautoDetectColumnDescriptions (const CCfits::Table &table_hdu)
 Reads the column descriptions based on the TDESCn keyword.
 
template<typename T >
std::vector< Row::cell_typeconvertScalarColumn (CCfits::Column &column, long first, long last)
 
template<typename T >
std::vector< Row::cell_typeconvertVectorColumn (CCfits::Column &column, long first, long last)
 
template<typename T >
std::vector< Row::cell_typeconvertNdArrayColumn (CCfits::Column &column, long first, long last)
 
std::vector< Row::cell_typetranslateColumn (CCfits::Column &column, std::type_index type)
 Returns a vector representing the given FITS table column data, converted to the requested type.
 
std::vector< Row::cell_typetranslateColumn (CCfits::Column &column, std::type_index type, long first, long last)
 
template<typename T >
std::string scientificFormat (const 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::stringgetAsciiFormatList (const Table &table)
 Returns a vector with strings representing the FITS ASCII table formats for the given table.
 
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::stringgetBinaryFormatList (const Table &table)
 Returns a vector with strings representing the FITS binary table formats for the given table.
 
template<typename T >
std::vector< T > createColumnData (const 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, int column_index, const CCfits::ExtHDU &table_hdu, long first_row)
 
template<typename T >
void populateNdArrayColumn (const Table &table, int column_index, const CCfits::ExtHDU &table_hdu, long first_row)
 
std::string getTDIM (const Table &table, int column_index)
 
void populateColumn (const Table &table, int column_index, const CCfits::ExtHDU &table_hdu, long first_row)
 
std::shared_ptr< ColumnInfocreateColumnInfo (const std::vector< std::string > &names, const std::vector< std::pair< std::type_index, std::size_t > > &types, const std::vector< std::string > &units, const std::vector< std::string > &descriptions)
 Creates a ColumnInfo object from the given names and types.
 
std::ostreamoperator<< (std::ostream &s, const cell_stream_adaptor &cell)
 

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
 

Function Documentation

◆ _peekLine()

static std::string Euclid::Table::_peekLine ( std::istream in)
static

Definition at line 45 of file AsciiReader.cpp.

References std::istream::seekg(), and std::istream::tellg().

Referenced by Euclid::Table::AsciiReader::getComment().

Here is the call graph for this function:

◆ _readKeys()

static CCfits::HDU & Euclid::Table::_readKeys ( CCfits::HDU &  hdu)
static

Definition at line 39 of file FitsReader.cpp.

◆ asciiFormatToType()

std::pair< std::type_index, std::size_t > Euclid::Table::asciiFormatToType ( const std::string format)

Definition at line 48 of file FitsReaderHelper.cpp.

References std::stoi(), and std::string::substr().

Referenced by autoDetectColumnTypes().

Here is the call graph for this function:

◆ autoDetectColumnDescriptions() [1/2]

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 152 of file FitsReaderHelper.cpp.

References std::string::find(), and std::to_string().

Here is the call graph for this function:

◆ autoDetectColumnDescriptions() [2/2]

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.

Parameters
inThe stream to read the column names from
commentThe comment pattern
Returns
The column descriptions from the stream comments
Exceptions
Elements::Exceptionif there are duplicate column names
Elements::Exceptionif any of the types is not one of the valid keywords

Definition at line 116 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(), and std::stringstream::str().

Referenced by Euclid::Table::AsciiReader::readColumnInfo(), and Euclid::Table::FitsReader::readColumnInfo().

Here is the call graph for this function:

◆ autoDetectColumnNames() [1/2]

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.

Parameters
table_hduThe HDU to read the columns from
Returns
the column names

Definition at line 36 of file FitsReaderHelper.cpp.

References std::string::empty(), std::move(), and std::to_string().

Here is the call graph for this function:

◆ autoDetectColumnNames() [2/2]

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.

Parameters
inThe stream to read the column names from
commentThe comment pattern
columns_numberThe number of columns
Returns
The auto-detected names of the columns
Exceptions
Elements::Exceptionif there are duplicate column names

Definition at line 176 of file AsciiReaderHelper.cpp.

References std::string::empty(), std::string::erase(), std::string::find(), logger, std::move(), std::string::substr(), std::to_string(), and Elements::Logging::warn().

Referenced by Euclid::Table::AsciiReader::readColumnInfo(), and Euclid::Table::FitsReader::readColumnInfo().

Here is the call graph for this function:

◆ autoDetectColumnTypes()

ELEMENTS_API std::vector< std::pair< std::type_index, std::size_t > > 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.

Parameters
table_hduThe HDU to read the types from
Returns
the column types
Exceptions
Elements::Exceptionif a column type is not supported

Definition at line 129 of file FitsReaderHelper.cpp.

References asciiFormatToType(), binaryFormatToType(), parseTDIM(), and std::vector< T >::push_back().

Referenced by Euclid::Table::FitsReader::readColumnInfo().

Here is the call graph for this function:

◆ autoDetectColumnUnits()

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 144 of file FitsReaderHelper.cpp.

References std::vector< T >::push_back().

Referenced by Euclid::Table::FitsReader::readColumnInfo().

Here is the call graph for this function:

◆ binaryFormatToType()

std::pair< std::type_index, std::size_t > Euclid::Table::binaryFormatToType ( const std::string format,
const std::vector< size_t > &  shape 
)

◆ calculateColumnLengths()

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.

Parameters
tableThe table
Returns
the sizes of the columns

Definition at line 52 of file AsciiWriterHelper.cpp.

References std::for_each(), std::max(), quoted(), and std::string::size().

Referenced by Euclid::Table::AsciiWriter::append(), and Euclid::Table::AsciiWriter::init().

Here is the call graph for this function:

◆ convertNdArrayColumn()

template<typename T >
std::vector< Row::cell_type > Euclid::Table::convertNdArrayColumn ( CCfits::Column &  column,
long  first,
long  last 
)

◆ convertScalarColumn()

template<typename T >
std::vector< Row::cell_type > Euclid::Table::convertScalarColumn ( CCfits::Column &  column,
long  first,
long  last 
)

Definition at line 166 of file FitsReaderHelper.cpp.

References std::back_inserter(), std::vector< T >::begin(), std::copy(), and std::vector< T >::end().

Here is the call graph for this function:

◆ convertToCellType()

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.

Parameters
valueThe value to convert
typeThe type of the cell
Returns
The Row::cell_type representing the value
Exceptions
Elements::Exceptionif the conversion fails

Definition at line 320 of file AsciiReaderHelper.cpp.

References std::string::find(), std::type_index::name(), and sCellConverter.

Here is the call graph for this function:

◆ convertVectorColumn()

template<typename T >
std::vector< Row::cell_type > Euclid::Table::convertVectorColumn ( CCfits::Column &  column,
long  first,
long  last 
)

◆ countColumns()

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.

Parameters
inThe string to read from
commentThe comment pattern
Returns
The number of columns
Exceptions
Elements::Exceptionif there is no uncommented, non-empty line

Definition at line 43 of file AsciiReaderHelper.cpp.

References std::string::empty(), std::string::find(), and std::string::substr().

Referenced by Euclid::Table::AsciiReader::readColumnInfo().

Here is the call graph for this function:

◆ countRemainingRows()

ELEMENTS_API std::size_t Euclid::Table::countRemainingRows ( std::istream in,
const std::string comment 
)
Parameters
inThe stream to read the column names from
commentThe comment pattern
Returns
The number of remaining rows

Definition at line 349 of file AsciiReaderHelper.cpp.

References std::string::empty(), std::string::find(), and std::string::substr().

Referenced by Euclid::Table::AsciiReader::rowsLeft().

Here is the call graph for this function:

◆ createColumnData()

template<typename T >
std::vector< T > Euclid::Table::createColumnData ( const Table table,
size_t  column_index 
)

Definition at line 189 of file FitsWriterHelper.cpp.

References std::vector< T >::begin(), and std::transform().

Here is the call graph for this function:

◆ createColumnInfo()

std::shared_ptr< ColumnInfo > Euclid::Table::createColumnInfo ( const std::vector< std::string > &  names,
const std::vector< std::pair< std::type_index, std::size_t > > &  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().

Here is the call graph for this function:

◆ createNdArrayColumnData()

template<typename T >
std::vector< std::valarray< T > > Euclid::Table::createNdArrayColumnData ( const Euclid::Table::Table table,
size_t  column_index 
)

Definition at line 217 of file FitsWriterHelper.cpp.

References std::begin(), std::copy(), std::end(), and std::move().

Here is the call graph for this function:

◆ createSingleNdArrayVectorColumnData()

template<typename T >
std::vector< T > Euclid::Table::createSingleNdArrayVectorColumnData ( const Euclid::Table::Table table,
size_t  column_index 
)

Definition at line 229 of file FitsWriterHelper.cpp.

References std::vector< T >::push_back().

Here is the call graph for this function:

◆ createSingleValueVectorColumnData()

template<typename T >
std::vector< T > Euclid::Table::createSingleValueVectorColumnData ( const Euclid::Table::Table table,
size_t  column_index 
)

Definition at line 207 of file FitsWriterHelper.cpp.

References std::vector< T >::push_back().

Here is the call graph for this function:

◆ createVectorColumnData()

template<typename T >
std::vector< std::valarray< T > > Euclid::Table::createVectorColumnData ( const Euclid::Table::Table table,
size_t  column_index 
)

Definition at line 197 of file FitsWriterHelper.cpp.

References std::vector< T >::emplace_back().

Here is the call graph for this function:

◆ firstDataLine()

ELEMENTS_API std::vector< std::string > Euclid::Table::firstDataLine ( std::istream in,
const std::string comment 
)
Parameters
inThe stream to read the column names from
commentThe comment pattern
Returns
The tokens within the first data line (skipping comments)

Definition at line 389 of file AsciiReaderHelper.cpp.

References splitLine().

Referenced by Euclid::Table::AsciiReader::readColumnInfo().

Here is the call graph for this function:

◆ GenericNdFormat()

template<typename T >
static std::string Euclid::Table::GenericNdFormat ( const Table table,
size_t  column_index 
)
static

Definition at line 138 of file FitsWriterHelper.cpp.

◆ GenericScalarFormat()

template<typename T >
static std::string Euclid::Table::GenericScalarFormat ( const Table ,
size_t   
)
static

Definition at line 122 of file FitsWriterHelper.cpp.

References std::find_if(), and ScalarTypeMap.

Here is the call graph for this function:

◆ GenericVectorFormat()

template<typename T >
static std::string Euclid::Table::GenericVectorFormat ( const Table table,
size_t  column_index 
)
static

Definition at line 132 of file FitsWriterHelper.cpp.

◆ getAsciiFormatList()

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.

Parameters
tableThe table
Returns
The list of FITS ASCII table formats

Definition at line 65 of file FitsWriterHelper.cpp.

References std::vector< T >::emplace_back(), std::max(), maxWidth(), and maxWidthScientific().

Referenced by Euclid::Table::FitsWriter::init().

Here is the call graph for this function:

◆ getBinaryFormatList()

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.

Parameters
tableThe table
Returns
The list of FITS binary table formats

Definition at line 170 of file FitsWriterHelper.cpp.

References BinaryFormatter, std::vector< T >::emplace_back(), and std::vector< T >::reserve().

Referenced by Euclid::Table::FitsWriter::init().

Here is the call graph for this function:

◆ getTDIM()

ELEMENTS_API std::string Euclid::Table::getTDIM ( const Table table,
int  column_index 
)

Serializes the shape of the column, if it is a multidimensional array. Otherwise, returns an empty string

Parameters
table
column_index
Returns
A string directly usable with TDIM (i.e. (3,2))

Definition at line 261 of file FitsWriterHelper.cpp.

References std::accumulate(), std::vector< T >::begin(), std::vector< T >::end(), std::vector< T >::size(), and std::stringstream::str().

Referenced by Euclid::Table::FitsWriter::init().

Here is the call graph for this function:

◆ guessColumnType()

ELEMENTS_API std::pair< std::type_index, std::size_t > Euclid::Table::guessColumnType ( const std::string token)

Guess the data type of a given token (i.e. if a float, an integer or a string)

Parameters
token
Returns
A pair type, length (if it can be inferred)

Definition at line 398 of file AsciiReaderHelper.cpp.

References std::string::begin(), and std::string::end().

Referenced by Euclid::Table::AsciiReader::readColumnInfo().

Here is the call graph for this function:

◆ hasNextRow()

ELEMENTS_API bool Euclid::Table::hasNextRow ( std::istream in,
const std::string comment 
)
Parameters
inThe stream to read the column names from
commentThe comment pattern
Returns
true if there is at least one more row

Definition at line 332 of file AsciiReaderHelper.cpp.

References std::string::empty(), std::string::find(), and std::string::substr().

Referenced by Euclid::Table::AsciiReader::hasMoreRows().

Here is the call graph for this function:

◆ keywordToType()

std::type_index Euclid::Table::keywordToType ( const std::string keyword)

Definition at line 107 of file AsciiReaderHelper.cpp.

References std::find_if(), and KeywordTypeMap.

Referenced by autoDetectColumnDescriptions().

Here is the call graph for this function:

◆ maxWidth()

size_t Euclid::Table::maxWidth ( const Table table,
size_t  column_index 
)

Definition at line 49 of file FitsWriterHelper.cpp.

References std::max().

Referenced by getAsciiFormatList().

Here is the call graph for this function:

◆ maxWidthScientific()

size_t Euclid::Table::maxWidthScientific ( const Table table,
size_t  column_index 
)

Definition at line 57 of file FitsWriterHelper.cpp.

References std::max(), and scientificFormat().

Referenced by getAsciiFormatList().

Here is the call graph for this function:

◆ ndArraySize()

template<typename T >
size_t Euclid::Table::ndArraySize ( const Table table,
size_t  column_index 
)

Definition at line 103 of file FitsWriterHelper.cpp.

References Euclid::NdArray::NdArray< T >::shape().

Here is the call graph for this function:

◆ operator<<()

std::ostream & Euclid::Table::operator<< ( std::ostream s,
const cell_stream_adaptor cell 
)

Definition at line 66 of file Row.cpp.

References Euclid::Table::cell_stream_adaptor::m_cell.

◆ parseTDIM()

std::vector< size_t > Euclid::Table::parseTDIM ( const std::string tdim)

◆ populateColumn()

void Euclid::Table::populateColumn ( const Table table,
int  column_index,
const CCfits::ExtHDU &  table_hdu,
long  first_row 
)

Definition at line 300 of file FitsWriterHelper.cpp.

Referenced by Euclid::Table::FitsWriter::append().

◆ populateNdArrayColumn()

template<typename T >
void Euclid::Table::populateNdArrayColumn ( const Table table,
int  column_index,
const CCfits::ExtHDU &  table_hdu,
long  first_row 
)

Definition at line 252 of file FitsWriterHelper.cpp.

◆ populateVectorColumn()

template<typename T >
void Euclid::Table::populateVectorColumn ( const Table table,
int  column_index,
const CCfits::ExtHDU &  table_hdu,
long  first_row 
)

Definition at line 242 of file FitsWriterHelper.cpp.

◆ quoted()

std::string Euclid::Table::quoted ( const std::string str)

Wrapper for boost::io::quoted

The wrapping is done for two reasons:

  1. When setting the width of a column, only the starting quote will be padded to the given width, which breaks the expected alignment
  2. For keeping known behaviour, quotes are added only if needed
    Parameters
    str
    Returns

Definition at line 68 of file AsciiWriterHelper.cpp.

References std::stringstream::str().

Referenced by calculateColumnLengths(), Euclid::Table::AsciiWriter::init(), and Euclid::Table::ToStringVisitor::operator()().

Here is the call graph for this function:

◆ scientificFormat()

template<typename T >
std::string Euclid::Table::scientificFormat ( const T &  value)

Definition at line 43 of file FitsWriterHelper.cpp.

References std::scientific(), and std::ostringstream::str().

Referenced by maxWidthScientific().

Here is the call graph for this function:

◆ splitLine()

ELEMENTS_API std::vector< std::string > Euclid::Table::splitLine ( std::string  line,
const std::string comment 
)
Parameters
lineLine from the file
commentThe comment pattern
Returns
The tokens within the line (splitting based on whitespaces, trimmed)

Definition at line 367 of file AsciiReaderHelper.cpp.

References std::vector< T >::emplace_back(), std::string::empty(), std::string::find(), and std::string::substr().

Referenced by firstDataLine(), and Euclid::Table::AsciiReader::readImpl().

Here is the call graph for this function:

◆ translateColumn() [1/2]

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.

Parameters
columnThe column to convert
typeThe type of the column
Returns
The data in Row::cell_type format

Definition at line 198 of file FitsReaderHelper.cpp.

References translateColumn().

Referenced by Euclid::Table::FitsReader::readImpl(), and translateColumn().

Here is the call graph for this function:

◆ translateColumn() [2/2]

ELEMENTS_API std::vector< Row::cell_type > Euclid::Table::translateColumn ( CCfits::Column &  column,
std::type_index  type,
long  first,
long  last 
)

Definition at line 202 of file FitsReaderHelper.cpp.

References std::type_index::name().

Here is the call graph for this function:

◆ typeToKeyword()

ELEMENTS_API std::string Euclid::Table::typeToKeyword ( std::type_index  type)

Converts a type to its string representation.

Parameters
typeThe type to convert
Returns
The string representation
Exceptions
Elements::Exceptionif the given type is not supported

Definition at line 43 of file AsciiWriterHelper.cpp.

References std::find_if(), KeywordTypeMap, and std::type_index::name().

Referenced by Euclid::Table::AsciiWriter::init().

Here is the call graph for this function:

◆ vectorSize()

template<typename T >
size_t Euclid::Table::vectorSize ( const Table table,
size_t  column_index 
)

Definition at line 89 of file FitsWriterHelper.cpp.

References std::vector< T >::size().

Here is the call graph for this function:

Variable Documentation

◆ BinaryFormatter

const std::map<std::type_index, std::function<std::string(const Table&, size_t)> > Euclid::Table::BinaryFormatter
Initial value:
{
{typeid(bool), GenericScalarFormat<bool>},
{typeid(int32_t), GenericScalarFormat<int32_t>},
{typeid(int64_t), GenericScalarFormat<int64_t>},
{typeid(float), GenericScalarFormat<float>},
{typeid(double), GenericScalarFormat<double>},
{typeid(std::vector<bool>), GenericVectorFormat<bool>},
{typeid(std::vector<int32_t>), GenericVectorFormat<int32_t>},
{typeid(std::vector<int64_t>), GenericVectorFormat<int64_t>},
{typeid(std::vector<float>), GenericVectorFormat<float>},
{typeid(std::vector<double>), GenericVectorFormat<double>},
{typeid(std::string),
[](const Table& table, size_t column) {
size_t width = maxWidth(table, column);
return boost::lexical_cast<std::string>(std::max(static_cast<size_t>(1), width)) + "A";
}},
{typeid(NdArray<int32_t>), GenericNdFormat<int32_t>},
{typeid(NdArray<int64_t>), GenericNdFormat<int64_t>},
{typeid(NdArray<float>), GenericNdFormat<float>},
{typeid(NdArray<double>), GenericNdFormat<double>},
}
T max(T... args)
size_t maxWidth(const Table &table, size_t column_index)

Definition at line 143 of file FitsWriterHelper.cpp.

Referenced by getBinaryFormatList().

◆ KeywordTypeMap

const std::vector< std::pair< std::string, std::type_index > > Euclid::Table::KeywordTypeMap
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().

◆ logger

Elements::Logging Euclid::Table::logger = Elements::Logging::getLogger("AsciiReader")
static

Definition at line 41 of file AsciiReaderHelper.cpp.

Referenced by autoDetectColumnNames().

◆ NdTypeMap

const std::vector<std::pair<char, std::type_index> > Euclid::Table::NdTypeMap
extern
Initial value:
{
{'J', typeid(NdArray<int32_t>)}, {'B', typeid(NdArray<int32_t>)}, {'I', typeid(NdArray<int32_t>)},
{'K', typeid(NdArray<int64_t>)}, {'E', typeid(NdArray<float>)}, {'D', typeid(NdArray<double>)},
}

Referenced by binaryFormatToType().

◆ ScalarTypeMap

const std::vector< std::pair< char, std::type_index > > Euclid::Table::ScalarTypeMap
Initial value:
{{'L', typeid(bool)}, {'J', typeid(int32_t)}, {'B', typeid(int32_t)}, {'I', typeid(int32_t)},
{'K', typeid(int64_t)}, {'E', typeid(float)}, {'D', typeid(double)}, {'A', typeid(std::string)}}

Definition at line 70 of file FitsReaderHelper.cpp.

Referenced by binaryFormatToType(), and GenericScalarFormat().

◆ sCellConverter

const std::map<std::type_index, std::function<Row::cell_type(const std::string&)> > Euclid::Table::sCellConverter

Definition at line 288 of file AsciiReaderHelper.cpp.

Referenced by convertToCellType().

◆ VectorTypeMap

const std::vector<std::pair<char, std::type_index> > Euclid::Table::VectorTypeMap
Initial value:
{{'B', typeid(std::vector<int32_t>)}, {'I', typeid(std::vector<int32_t>)},
{'J', typeid(std::vector<int32_t>)}, {'K', typeid(std::vector<int64_t>)},
{'E', typeid(std::vector<float>)}, {'D', typeid(std::vector<double>)},
{'A', typeid(std::string)}}

Definition at line 72 of file FitsReaderHelper.cpp.

Referenced by binaryFormatToType().