EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
|
#include <acts/blob/sPHENIX/thirdparty/dfelibs/dfe/dfe_io_dsv.hpp>
Public Member Functions | |
NamedTupleDsvReader ()=delete | |
NamedTupleDsvReader (const NamedTupleDsvReader &)=delete | |
NamedTupleDsvReader (NamedTupleDsvReader &&)=default | |
~NamedTupleDsvReader ()=default | |
NamedTupleDsvReader & | operator= (const NamedTupleDsvReader &)=delete |
NamedTupleDsvReader & | operator= (NamedTupleDsvReader &&)=default |
NamedTupleDsvReader (const std::string &path, const std::vector< std::string > &optional_columns={}, bool verify_header=true) | |
bool | read (NamedTuple &record) |
template<typename T > | |
bool | read (NamedTuple &record, std::vector< T > &extra) |
std::size_t | num_extra_columns () const |
Return the number of additional columns that are not part of the tuple. | |
std::size_t | num_records () const |
Return the number of records read so far. | |
Private Types | |
using | Tuple = typename NamedTuple::Tuple |
Private Member Functions | |
void | use_default_columns () |
void | parse_header (const std::vector< std::string > &optional_columns) |
template<std::size_t... I> | |
void | parse_record (NamedTuple &record, std::index_sequence< I...>) const |
template<std::size_t I> | |
void | parse_element (NamedTuple &record) const |
Private Attributes | |
DsvReader< Delimiter > | m_reader |
std::vector< std::string > | m_columns |
std::size_t | m_num_columns = SIZE_MAX |
std::array< std::size_t, std::tuple_size< Tuple > ::value > | m_tuple_column_map |
std::vector< std::size_t > | m_extra_columns |
Read records as delimiter-separated values from a text file.
The reader is strict about its input format to avoid ambiguities. If header verification is disabled, the first line will be skipped and each line must contain exactly as many columns as there are tuple members in exactly the same order. If header verification is enabled, the first line is interpreted as the header. Names in the header must match exactly to the tuple members but can be in arbitrary order. The file can contain extra columns that are not tuple members. Each following row must have exactly the same number of columns as the header.
Definition at line 183 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 183 of file dfe_io_dsv.hpp
|
private |
Definition at line 229 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 229 of file dfe_io_dsv.hpp
|
delete |
|
delete |
|
default |
|
default |
|
inline |
Open a file at the given path.
path | Path to the input file |
optional_columns | Record columns that can be missing in the file |
verify_header | true to check header column names, false to skip |
The set of optional columns must match names in the record. When allowing optional columns, header verification must be set to true.
Definition at line 387 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 387 of file dfe_io_dsv.hpp
References dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::m_columns, dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::m_reader, dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::parse_header(), and dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::use_default_columns().
|
inline |
Return the number of additional columns that are not part of the tuple.
Definition at line 223 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 223 of file dfe_io_dsv.hpp
References dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::m_extra_columns.
|
inline |
Return the number of records read so far.
Definition at line 225 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 225 of file dfe_io_dsv.hpp
References dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::m_reader, and Acts::UnitConstants::u.
|
delete |
|
default |
|
inlineprivate |
Definition at line 250 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 250 of file dfe_io_dsv.hpp
References nlohmann::detail::get(), I, dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::m_columns, dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::m_tuple_column_map, and dfe::io_dsv_impl::parse().
|
inlineprivate |
Definition at line 459 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 459 of file dfe_io_dsv.hpp
References c, it, name, and eicpy.verify::names.
Referenced by dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::NamedTupleDsvReader().
|
inlineprivate |
Definition at line 243 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 243 of file dfe_io_dsv.hpp
References nlohmann::detail::void().
|
inline |
Read the next record from the file.
Extra columns in the file will be ignored. Elements of the record that correspond to missing, optional columns will not be set and retain their value.
Definition at line 409 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 409 of file dfe_io_dsv.hpp
References nlohmann::to_string(), and value.
|
inline |
Read the next record and any extra columns from the file.
Definition at line 431 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 431 of file dfe_io_dsv.hpp
References dfe::io_dsv_impl::parse(), and read().
|
inlineprivate |
Definition at line 447 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 447 of file dfe_io_dsv.hpp
References value.
Referenced by dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::NamedTupleDsvReader().
|
private |
Definition at line 232 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 232 of file dfe_io_dsv.hpp
Referenced by dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::NamedTupleDsvReader(), and dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::parse_element().
|
private |
Definition at line 238 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 238 of file dfe_io_dsv.hpp
Referenced by dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::num_extra_columns().
|
private |
Definition at line 234 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 234 of file dfe_io_dsv.hpp
|
private |
Definition at line 231 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 231 of file dfe_io_dsv.hpp
Referenced by dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::NamedTupleDsvReader(), and dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::num_records().
|
private |
Definition at line 236 of file dfe_io_dsv.hpp.
View newest version in sPHENIX GitHub at line 236 of file dfe_io_dsv.hpp
Referenced by dfe::io_dsv_impl::NamedTupleDsvReader< Delimiter, NamedTuple >::parse_element().