g4tools  5.4.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::rcsv::fntuple Class Reference
Inheritance diagram for tools::rcsv::fntuple:
Inheritance graph
[legend]
Collaboration diagram for tools::rcsv::fntuple:
Collaboration graph
[legend]

Public Member Functions

 fntuple (const std::string &a_file)
 
virtual ~fntuple ()
 
bool open ()
 
bool initialize (std::ostream &a_out, char a_sep=0, const std::string &a_suffix="x", bool a_verbose=false)
 
- Public Member Functions inherited from tools::rcsv::ntuple
virtual void start ()
 
virtual bool next ()
 
virtual read::icolfind_icol (const std::string &a_name)
 
virtual const std::vector< read::icol * > & columns () const
 
virtual const std::string & title () const
 
virtual bool number_of_entries (tools::uint64 &a_value) const
 
 ntuple (std::istream &a_reader)
 
virtual ~ntuple ()
 
void set_vec_sep (char a_c)
 
void set_sep (char a_c)
 
void set_hippo (bool a_hippo)
 
std::istream & istrm ()
 
bool initialize (std::ostream &a_out, char a_sep=0, const std::string &a_suffix="x", bool a_verbose=false)
 
void dump_columns (std::ostream &a_out) const
 
bool initialize (std::ostream &a_out, const ntuple_binding &a_bd=ntuple_binding())
 
bool initialize_from_commented_header (std::ostream &a_out)
 
bool get_row () const
 
- Public Member Functions inherited from tools::read::intuple
virtual ~intuple ()
 
virtual void stop ()
 
size_t number_of_columns () const
 
void column_names (std::vector< std::string > &a_names) const
 
icolfind_icol_case_insensitive (const std::string &a_name)
 
template<class T >
icolumn< T > * find_column (const std::string &a_name)
 
template<class T >
bool find_column (const std::string &a_name, icolumn< T > *&a_col, bool a_case_sensitive=true)
 
template<class T >
bool column_is_of_type (const std::string &a_name, bool &a_is, bool a_case_sensitive=true)
 
template<class T >
bool column_min (unsigned int a_col, T &a_value)
 
template<class T >
bool column_max (unsigned int a_col, T &a_value)
 

Static Public Member Functions

static const std::string & s_class ()
 
- Static Public Member Functions inherited from tools::rcsv::ntuple
static bool find_sep (std::ostream &a_out, std::istream &a_reader, bool a_hippo, bool a_verbose, char &a_sep)
 
static const std::string & s_cid (cid a_id)
 
- Static Public Member Functions inherited from tools::read::intuple
static const std::string & s_class ()
 

Protected Member Functions

 fntuple (const fntuple &a_from)
 
fntupleoperator= (const fntuple &a_from)
 
- Protected Member Functions inherited from tools::rcsv::ntuple
 ntuple (const ntuple &a_from)
 
ntupleoperator= (const ntuple &a_from)
 
bool read_commented_header (std::ostream &a_out, std::istream &a_reader, std::string &a_title, char &a_sep, char &a_vec_sep, std::vector< col_desc > &a_cols)
 
template<class T >
column< T > * create_column (const std::string &a_name, T *a_user_var=0)
 
bool _read_line ()
 

Protected Attributes

std::string m_file
 
std::ifstream m_freader
 
- Protected Attributes inherited from tools::rcsv::ntuple
std::istream & m_reader
 
std::string m_title
 
char m_sep
 
char m_vec_sep
 
std::vector< read::icol * > m_cols
 
std::streampos m_sz
 
int m_rows
 
bool m_hippo
 

Additional Inherited Members

- Public Types inherited from tools::rcsv::ntuple
typedef std::pair< std::string, std::string > col_desc
 
- Static Protected Member Functions inherited from tools::rcsv::ntuple
static bool read_line (std::istream &a_reader, std::streampos a_sz, std::string &a_s)
 
static bool skip_line (std::istream &a_reader, std::streampos a_sz)
 
static bool skip_comment (std::istream &a_reader, std::streampos a_sz)
 
template<class T >
static bool _read (std::istream &a_reader, std::streampos, char, T &a_v)
 
static bool _read_time (std::istream &a_reader, std::streampos a_sz, char a_sep, time_t &a_v)
 
static bool _read (std::istream &a_reader, std::streampos a_sz, char a_sep, std::string &a_v)
 
static bool _vec_read (std::istream &a_reader, std::streampos a_sz, std::istringstream &, std::vector< std::string > &, char a_sep, const std::string &a_vec_sep, std::vector< std::string > &a_v)
 
template<class T >
static bool _vec_read (std::istream &a_reader, std::streampos a_sz, std::istringstream &a_iss, std::vector< std::string > &a_tmp, char a_sep, const std::string &a_vec_sep, std::vector< T > &a_v)
 

Detailed Description

Definition at line 1065 of file rcsv_ntuple.

Constructor & Destructor Documentation

◆ fntuple() [1/2]

tools::rcsv::fntuple::fntuple ( const std::string &  a_file)
inline

Definition at line 1073 of file rcsv_ntuple.

1074  :parent(m_freader)
1075  ,m_file(a_file)
1076  {}

◆ ~fntuple()

virtual tools::rcsv::fntuple::~fntuple ( )
inlinevirtual

Definition at line 1077 of file rcsv_ntuple.

1077 {m_freader.close();}

◆ fntuple() [2/2]

tools::rcsv::fntuple::fntuple ( const fntuple a_from)
inlineprotected

Definition at line 1079 of file rcsv_ntuple.

1080  :read::intuple(a_from)
1081  ,parent(a_from)
1082  ,m_file(a_from.m_file)
1083  {}

Member Function Documentation

◆ initialize()

bool tools::rcsv::fntuple::initialize ( std::ostream &  a_out,
char  a_sep = 0,
const std::string &  a_suffix = "x",
bool  a_verbose = false 
)
inline

Definition at line 1094 of file rcsv_ntuple.

1097  {
1098  if(!m_freader.is_open()) {
1099  m_freader.open(m_file.c_str());
1100  if(m_freader.fail()) {
1101  a_out << "tools::rcsv::fntuple::initialize :"
1102  << " can't open " << m_file << "."
1103  << std::endl;
1104  return false;
1105  }
1106  }
1107  return parent::initialize(a_out,a_sep,a_suffix,a_verbose);
1108  }

◆ open()

bool tools::rcsv::fntuple::open ( )
inline

Definition at line 1090 of file rcsv_ntuple.

1090  {
1091  m_freader.open(m_file.c_str());
1092  return m_freader.fail()?false:true;
1093  }

◆ operator=()

fntuple& tools::rcsv::fntuple::operator= ( const fntuple a_from)
inlineprotected

Definition at line 1084 of file rcsv_ntuple.

1084  {
1085  parent::operator=(a_from);
1086  m_file = a_from.m_file;
1087  return *this;
1088  }

◆ s_class()

static const std::string& tools::rcsv::fntuple::s_class ( )
inlinestatic

Definition at line 1068 of file rcsv_ntuple.

1068  {
1069  static const std::string s_v("tools::rcsv::fntuple");
1070  return s_v;
1071  }

Member Data Documentation

◆ m_file

std::string tools::rcsv::fntuple::m_file
protected

Definition at line 1110 of file rcsv_ntuple.

◆ m_freader

std::ifstream tools::rcsv::fntuple::m_freader
protected

Definition at line 1111 of file rcsv_ntuple.


The documentation for this class was generated from the following file:
tools::rcsv::ntuple::initialize
bool initialize(std::ostream &a_out, char a_sep=0, const std::string &a_suffix="x", bool a_verbose=false)
Definition: rcsv_ntuple:312
tools::rcsv::fntuple::m_file
std::string m_file
Definition: rcsv_ntuple:1110
tools::rcsv::fntuple::m_freader
std::ifstream m_freader
Definition: rcsv_ntuple:1111
tools::rcsv::ntuple::operator=
ntuple & operator=(const ntuple &a_from)
Definition: rcsv_ntuple:194