class TCCparser : public MStream

Class which parses the L2 global configuration file

Inheritance:


Public Methods

void addParser(ObjectParser *oparser)
Adds the code to parse the given object
string errorLine(void)
Returns a string containing the line number of the current input file
void getLine(ParseString &line)
Reads in a line from the current input file
bool parseFile(char *fname)
Opens the given file and parses it
TCCparser(char *saddr, char *eaddr)
Constructor to set up the MemoryStream
TCCparser(char *saddr, int size)
Constructor to set up the MemoryStream

Private Fields

string errline
string for error line reporting (must have scope outside of function)
ifstream ipfile
input file stream
int nline
current line number of the input file
map ObjectParser *> parser
map of object types to object parsers
TCCparserState state
current state of the TCCparser class

Inherited from MStream:

Public Methods

char* end(void)
MStream& operator<<(double d)
MStream& operator<<(const char *s)
MStream& operator<<(int i)
MStream& operator<<(float f)
MStream& operator>>(float &f)
MStream& operator>>(char *s)
MStream& operator>>(int &i)
MStream& operator>>(double &d)
char* start(void)

Private Fields

char* eom
char* ptr
char* som
bool swapflag

Private Methods

bool byteOrder(void)
float swap(float f)
int swap(int i)

Documentation

Class which parses the L2 global configuration file. It reads the low level ASCII format and turns it into a binary file for downloading to the Alpha VME cards. The writing to memory is done through the MemoryStream class.
TCCparser(char *saddr, int size)
Constructor to set up the MemoryStream. The arguments are identical to those of the MStream class constructor which requires the start address and size of the available memory block. This constructor calls inherited MStream class constructor with the given arguments.
Parameters:
saddr - start address of memory stream
size - size in bytes of ememory stream buffer

TCCparser(char *saddr, char *eaddr)
Constructor to set up the MemoryStream. The arguments are identical to those of the MStream class constructor which requires the start and end addresses of the available memory block. This constructor calls inherited MStream class constructor with the given arguments.
Parameters:
saddr - start address of memory stream
eaddr - end address of memory stream

void getLine(ParseString &line)
Reads in a line from the current input file. The routine checks that the current parser state is open and then reads in the next line using the getline method of the ifstream class. This character array is used to initialize the ParseString class and the lower and tidy methods of this class are called to format the line. Finally the line number of the input file is increased by one.
Parameters:
line - parse string in which to return the next input line

bool parseFile(char *fname)
Opens the given file and parses it. The routine loads the ASCII file line by line. Each line is then scanned for "new ____ {". When this pattern is found the parser calls the object parser associated with the given string. This object parser is then responsible for reading the entire ASCII data for that object and converting it into its binary format.

void addParser(ObjectParser *oparser)
Adds the code to parse the given object. The name of the object and its parser are stored in the internal object map. This map is used to link the object type detected in the data with the correct parsing code for that object type.
Parameters:
name - type name of the object associated with this parser
oparser - parser class which can read in this type of object

string errorLine(void)
Returns a string containing the line number of the current input file. This routine is intended for use for printing error messages. When called it returns the string " at line XXXX", where XXXX is the current line number of the input file.
Returns:
string containing current input file line number

TCCparserState state
current state of the TCCparser class

map ObjectParser *> parser
map of object types to object parsers

ifstream ipfile
input file stream

int nline
current line number of the input file

string errline
string for error line reporting (must have scope outside of function)


Direct child classes:
L2Gparser
Author:
Roger Moore (moore@pa.msu.edu)

alphabetic index hierarchy of classes


This page has been generated automatically by doc++.

Copyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de