9#ifndef NS3_CSV_READER_H_
10#define NS3_CSV_READER_H_
370 std::tuple<std::string, std::string::const_iterator>
ParseColumn(
371 std::string::const_iterator begin,
372 std::string::const_iterator end);
Provides functions for parsing and extracting data from Comma Separated Value (CSV) formatted text fi...
virtual ~CsvReader()
Destructor.
bool GetValue(std::size_t columnIndex, T &value) const
Attempt to convert from the string data in the specified column to the specified data type.
std::size_t RowNumber() const
The number of lines that have been read.
char Delimiter() const
Returns the delimiter character specified during object construction.
std::istream * m_stream
Pointer to the input stream containing the data.
bool IsDelimiter(char c) const
Returns true if the supplied character matches the delimiter.
void ParseLine(const std::string &line)
Scans the string and splits it into individual columns based on the delimiter.
std::size_t ColumnCount() const
Returns the number of columns in the csv data.
std::size_t m_rowsRead
Number of lines processed.
std::ifstream m_fileStream
File stream containing the data.
bool m_blankRow
Line contains no data (blank line or comment only).
bool FetchNextRow()
Reads one line from the input until a new line is encountered.
std::vector< std::string > Columns
Container of CSV data.
bool IsBlankRow() const
Check if the current row is blank.
Columns m_columns
Fields extracted from the current line.
bool GetValueAs(std::string input, double &value) const
Attempt to convert from the string data stored at the specified column index into the specified type.
char m_delimiter
Character used to separate fields.
std::tuple< std::string, std::string::const_iterator > ParseColumn(std::string::const_iterator begin, std::string::const_iterator end)
Extracts the data for one column in a csv row.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static unsigned int value(char c)