A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
ascii-file.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012 University of Washington
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Mitch Watrous (watrous@u.washington.edu)
18
*
19
* This file is based on pcap-file.h by Craig Dowell (craigdo@ee.washington.edu)
20
*/
21
22
#ifndef ASCII_FILE_H
23
#define ASCII_FILE_H
24
25
#include <fstream>
26
#include <stdint.h>
27
#include <string>
28
29
namespace
ns3
30
{
31
37
class
AsciiFile
38
{
39
public
:
40
AsciiFile
();
41
~AsciiFile
();
42
46
bool
Fail
()
const
;
50
bool
Eof
()
const
;
51
58
void
Open
(
const
std::string& filename, std::ios::openmode mode);
59
63
void
Close
();
64
71
void
Read
(std::string& line);
72
82
static
bool
Diff
(
const
std::string& f1,
const
std::string& f2, uint64_t& lineNumber);
83
84
private
:
85
std::string
m_filename
;
86
std::fstream
m_file
;
87
};
88
89
}
// namespace ns3
90
91
#endif
/* ASCII_FILE_H */
ns3::AsciiFile
A class representing an ascii file.
Definition:
ascii-file.h:38
ns3::AsciiFile::Eof
bool Eof() const
Definition:
ascii-file.cc:57
ns3::AsciiFile::Close
void Close()
Close the underlying file.
Definition:
ascii-file.cc:63
ns3::AsciiFile::Fail
bool Fail() const
Definition:
ascii-file.cc:51
ns3::AsciiFile::AsciiFile
AsciiFile()
Definition:
ascii-file.cc:38
ns3::AsciiFile::m_file
std::fstream m_file
output file
Definition:
ascii-file.h:86
ns3::AsciiFile::m_filename
std::string m_filename
output file name
Definition:
ascii-file.h:85
ns3::AsciiFile::~AsciiFile
~AsciiFile()
Definition:
ascii-file.cc:44
ns3::AsciiFile::Open
void Open(const std::string &filename, std::ios::openmode mode)
Create a new ascii file or open an existing ascii file.
Definition:
ascii-file.cc:69
ns3::AsciiFile::Read
void Read(std::string &line)
Read next line from file.
Definition:
ascii-file.cc:78
ns3::AsciiFile::Diff
static bool Diff(const std::string &f1, const std::string &f2, uint64_t &lineNumber)
Compare two ASCII files line-by-line.
Definition:
ascii-file.cc:87
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
core
model
ascii-file.h
Generated on Sun Mar 3 2024 17:10:55 for ns-3 by
1.9.1