A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::AsciiFile Class Reference

Public Member Functions

void Close (void)
 
bool Eof (void) const
 
bool Fail (void) const
 
void Open (std::string const &filename, std::ios::openmode mode)
 
void Read (std::string &line)
 Read next line from file. More...
 

Static Public Member Functions

static bool Diff (std::string const &f1, std::string const &f2, uint64_t &lineNumber)
 Compare two ASCII files line-by-line. More...
 

Private Attributes

std::fstream m_file
 
std::string m_filename
 

Detailed Description

Definition at line 37 of file ascii-file.h.

Member Function Documentation

void ns3::AsciiFile::Close ( void  )

Close the underlying file.

Definition at line 59 of file ascii-file.cc.

bool ns3::AsciiFile::Diff ( std::string const &  f1,
std::string const &  f2,
uint64_t &  lineNumber 
)
static

Compare two ASCII files line-by-line.

Returns
true if files are different, false otherwise
Parameters
f1First ASCII file name
f2Second ASCII file name
lineNumbe[out] Line number of first different line.

Definition at line 83 of file ascii-file.cc.

References Eof(), Fail(), Open(), and Read().

bool ns3::AsciiFile::Eof ( void  ) const
Returns
true if the 'eof' bit is set in the underlying iostream, false otherwise.

Definition at line 53 of file ascii-file.cc.

Referenced by Diff().

bool ns3::AsciiFile::Fail ( void  ) const
Returns
true if the 'fail' bit is set in the underlying iostream, false otherwise.

Definition at line 48 of file ascii-file.cc.

Referenced by Diff().

void ns3::AsciiFile::Open ( std::string const &  filename,
std::ios::openmode  mode 
)

Create a new ascii file or open an existing ascii file.

Parameters
filenameString containing the name of the file.
modethe access mode for the file.

Definition at line 65 of file ascii-file.cc.

References NS_ASSERT.

Referenced by Diff().

void ns3::AsciiFile::Read ( std::string &  line)

Read next line from file.

Parameters
line[out] line from file

Definition at line 74 of file ascii-file.cc.

References NS_ASSERT.

Referenced by Diff().


The documentation for this class was generated from the following files: