A class representing an ascii file. More...
#include "ascii-file.h"
Public Member Functions | |
AsciiFile () | |
~AsciiFile () | |
void | Close () |
Close the underlying file. | |
bool | Eof () const |
bool | Fail () const |
void | Open (const std::string &filename, std::ios::openmode mode) |
Create a new ascii file or open an existing ascii file. | |
void | Read (std::string &line) |
Read next line from file. | |
Static Public Member Functions | |
static bool | Diff (const std::string &f1, const std::string &f2, uint64_t &lineNumber) |
Compare two ASCII files line-by-line. | |
Private Attributes | |
std::fstream | m_file |
output file | |
std::string | m_filename |
output file name | |
A class representing an ascii file.
This class represents an ascii file
Definition at line 26 of file ascii-file.h.
ns3::AsciiFile::AsciiFile | ( | ) |
Definition at line 27 of file ascii-file.cc.
References m_file, and ns3::FatalImpl::RegisterStream().
ns3::AsciiFile::~AsciiFile | ( | ) |
Definition at line 33 of file ascii-file.cc.
References Close(), m_file, and ns3::FatalImpl::UnregisterStream().
void ns3::AsciiFile::Close | ( | ) |
Close the underlying file.
Definition at line 52 of file ascii-file.cc.
References m_file.
Referenced by ~AsciiFile().
|
static |
Compare two ASCII files line-by-line.
f1 | First ASCII file name |
f2 | Second ASCII file name |
lineNumber | [out] Line number of first different line. |
Definition at line 76 of file ascii-file.cc.
References Eof(), Fail(), Open(), and Read().
bool ns3::AsciiFile::Eof | ( | ) | const |
Definition at line 46 of file ascii-file.cc.
References m_file.
Referenced by Diff().
bool ns3::AsciiFile::Fail | ( | ) | const |
Definition at line 40 of file ascii-file.cc.
References m_file.
Referenced by Diff().
void ns3::AsciiFile::Open | ( | const std::string & | filename, |
std::ios::openmode | mode ) |
Create a new ascii file or open an existing ascii file.
filename | String containing the name of the file. |
mode | the access mode for the file. |
Definition at line 58 of file ascii-file.cc.
References m_file, and NS_ASSERT.
Referenced by Diff().
void ns3::AsciiFile::Read | ( | std::string & | line | ) |
Read next line from file.
line | [out] line from file |
Definition at line 67 of file ascii-file.cc.
References m_file, and NS_ASSERT.
Referenced by Diff().
|
private |
output file
Definition at line 75 of file ascii-file.h.
Referenced by AsciiFile(), ~AsciiFile(), Close(), Eof(), Fail(), Open(), and Read().
|
private |
output file name
Definition at line 74 of file ascii-file.h.