Next: Appendix: Downloading and Installing
Up: BRITE: Universal Topology Generation
Previous: Appendix: Heavy-tailed Distributions
Appendix: Parsing Support Routines (C++ Version)
In order to parse files such as the configuration files for a given
model, the programmer will make use of the parsing functionality
provided by BRITE. First it is neccesary to create an instance object
of the Parse class. The corresponding constructor takes as an
argument the name of the file that will be parsed. Following is a
summary of the parsing routines provided in the C++ version of BRITE.
- int GetNextTokenList(vector
string
& toks): Returns
the set of string tokens in the vector toks, corresponding to
the next line in the file being parsed.
- int GetNextTokenList(string& from, int& pos,
vector
string
& toks): Same as the previous routine but the
tokens are extracted from a string instead of a file.
- void ParseIntField(char* f, int& v): Used to parse
configuration files. It parses an integer value which is preceded by a
label represented by f. The parsed value is returned in v.
- void ParseIntField(int& v): Used to parse imported files.
It parses the next integer value. The parsed value is returned in v.
- void ParseDoubleField(char* f, double& v): Used to parse
configuration files. It parses a double value which is preceded by a
label represented by f. The parsed value is returned in v.
- void ParseDoubleField(double& v): Used to parse imported
files. It parses the next double value. The parsed value is returned
in v.
- void ParseStringField(char* f): Parses a string from a
file. It does not return any value because it is used to verify that
the file being parsed is written in the right format.
- void ParseStringField(char* f, string& s): Used to parse
configuration files. Parses the next string field which is preceded by
a label represented by f. The string field parsed is returned in
s.
- int FileSize(): Used when parsing imported files
(e.g. NLANR data). Returns the size of the file being parsed (in
number of lines).
- bool IsDelim(char ch): The Parse class contains an array
of delimiters. Given a characters ch it returns whether or not
the character is a delimiter.
- bool IsComment(char ch): Used when parsing configuration
files. Returns true if ch matches character '#'.
Next: Appendix: Downloading and Installing
Up: BRITE: Universal Topology Generation
Previous: Appendix: Heavy-tailed Distributions
Alberto Medina
2001-04-12