Model Railroad System  2.2.1
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
Parsers::MRRXtrkCad Class Reference

MRRXtrkCad parser class. More...

#include <ParserClassesGroup.h>

Inheritance diagram for Parsers::MRRXtrkCad:
Parsers::LayoutFile Parsers::ParseFile

Public Types

enum  YY_MRRXtrkCad_ENUM_TOKEN {
  YY_MRRXtrkCad_NULL_TOKEN =0, INTEGER =258, FLOAT =259, STRING =260,
  RESTOFLINE =261, MULTILINE =262, EOL =263, UNTERMSTRING =264,
  NOTWORD =265, END =266, _VERSION =267, TITLE =268,
  MAPSCALE =269, ROOMSIZE =270, SCALE =271, HO =272,
  N =273, O =274, LAYERS =275, CURRENT =276,
  STRUCTURE =277, DRAW =278, CURVE =279, TURNOUT =280,
  TURNTABLE =281, STRAIGHT =282, CAR =283, JOINT =284,
  NOTE =285, TEXT =286, MAIN =287, B =288,
  J =289, D =290, L =291, M =292,
  F =293, T =294, E =295, G =296,
  A =297, P =298, S =299, C =300,
  X =301, Y =302, Q =303, BLOCK =304,
  TRK =305, SWITCHMOTOR =306
}
 

Public Member Functions

int yyparse (void)
 
virtual void yyerror (char *msg)
 
virtual int yylex ()
 
 MRRXtrkCad (const char *filename)
 The constructor function. More...
 
virtual ~MRRXtrkCad ()
 
- Public Member Functions inherited from Parsers::LayoutFile
 LayoutFile (const char *filename, MRRXtrkCad *p)
 Constructor. More...
 
virtual ~LayoutFile ()
 Destructor. More...
 
void Emit (ostream &outstream)
 Function to Emit a track graph to an output stream. More...
 
bool IsNodeP (int nid) const
 Tests if a node id exists in the graph. More...
 
int NumEdges (int nid) const
 Returns the number of edges for the specificed node id. More...
 
int EdgeIndex (int nid, int edgenum) const
 Returns the node id of the specificed edge of the node. More...
 
float EdgeX (int nid, int edgenum) const
 Returns the $X$ coordinate of the specificed edge of the node. More...
 
float EdgeY (int nid, int edgenum) const
 Returns the $Y$ coordinate of the specificed edge of the node. More...
 
float EdgeA (int nid, int edgenum) const
 Returns the angle of the specificed edge of the node. More...
 
float EdgeLength (int nid, int edgenum) const
 Returns the length of an edge. More...
 
TrackGraph::NodeType TypeOfNode (int nid) const
 Returns the type of the node. More...
 
const TurnoutGraphicNodeTurnoutGraphic (int nid) const
 Returns the TurnoutGraphic of the node. More...
 
const TurnoutRoutelistNodeTurnoutRoutelist (int nid) const
 Returns the TurnoutRoutelist of the node. More...
 
float LengthOfNode (int nid) const
 Return the track length of a node. More...
 
const IntegerListTrackList (int nid) const
 Return a block's tracklist. More...
 
int TurnoutNumber (int nid) const
 Return a switchmotor's turnout number. More...
 
const char * NameOfNode (int nid) const
 Return a block's or switchmotor's name. More...
 
const char * SenseScript (int nid) const
 Return a block's or switchmotor's sense script. More...
 
const char * NormalActionScript (int nid) const
 Return a switchmotor's normal action script. More...
 
const char * ReverseActionScript (int nid) const
 Return a block's or switchmotor's reverse action script. More...
 
int NumberOfHeads (int nid) const
 Return a Signal's number of heads. More...
 
const StringPairList * SignalAspects (int nid) const
 Return a Signal's aspect list. More...
 
float OrigX (int nid) const
 Return the $x$ coordinate of the signal base. More...
 
float OrigY (int nid) const
 Return the $y$ coordinate of the signal base. More...
 
float Angle (int nid) const
 Return the angle of the signal. More...
 
const char * OnScript (int nid) const
 Return the on action script. More...
 
const char * OffScript (int nid) const
 Return the off action script. More...
 
int LowestNode () const
 Returns the lowest numbered node id. More...
 
int HighestNode () const
 Returns the highest numbered node id. More...
 
void CompressGraph ()
 Create a compressed graph. More...
 
int CompressedEdgeCount (int cnid) const
 Number of compressed graph edges. More...
 
float CompressedEdgeLength (int cnid, int edgenum) const
 Length of a compressed graph edge. More...
 
int CompressedEdgeNode (int cnid, int edgenum) const
 Next Edge node. More...
 
IntegerListCompressedNodeSegments (int cnid) const
 Raw nodes in a compressed graph node. More...
 
bool IsCompressed () const
 
const IntegerListHeads ()
 
bool IsCompressedNode (int cnid) const
 Is cid a node in the compressed graph? More...
 
const IntegerListRoots ()
 Compressed graph roots. More...
 
double CompressedNodePositionX (int cnid) const
 X Coordinate of a Compressed Node position. More...
 
double CompressedNodePositionY (int cnid) const
 X Coordinate of a Compressed Node position. More...
 
void CompressedGraphCircleLayout (double radius)
 Run the BGL circle_graph_layout for a given radius. More...
 
bool CompressedGraphKamadaKawaiSpring (double sidelength)
 Run the BGL kamada_kawai_spring_layout for a given side length. More...
 
TrackGraph::CompressedEdgePairVector CompressedGraphKruskalMinimumSpanningTree ()
 Run the kruskal_minimum_spanning_tree algorithm and return a vector of edge pairs. More...
 
TrackGraph::CompressedEdgePairVector CompressedGraphPrimMinimumSpanningTree ()
 Run the prim_minimum_spanning_tree algorithm and return a vector of edge pairs. More...
 
- Public Member Functions inherited from Parsers::ParseFile
const char * SourceFile () const
 Return the name of the source file. More...
 
 ParseFile (const char *filename)
 Constructor. More...
 
virtual ~ParseFile ()
 Destructor. More...
 
int ProcessFile (ostream &err)
 open file and parse it. More...
 

Public Attributes

yy_MRRXtrkCad_stype yylval
 
yyltype yylloc
 
int yynerrs
 
int yychar
 
int yydebug
 

Private Member Functions

int lookup_word (const char *word) const
 
void yyerror1 (const char *message, const char *s) const
 

Private Attributes

bool scanEol
 
bool scanToEND
 
int fieldflag
 
double CurrentScale
 

Additional Inherited Members

- Protected Member Functions inherited from Parsers::LayoutFile
virtual int Parse ()
 Parseer function. More...
 
virtual void ParseError (const char *m)
 Parse error handler. More...
 
- Protected Attributes inherited from Parsers::LayoutFile
MRRXtrkCadparser
 Parser. More...
 
TrackGraphtrackGraph
 Track graph, a graph of all of the trackwork in the layput file. More...
 
- Protected Attributes inherited from Parsers::ParseFile
char * lp
 Input line buffer pointer. More...
 
FILE * fp
 Input file pointer. More...
 
int source_line
 Source line number. More...
 
char line_buffer [buffersize]
 Input line buffer. More...
 
ostream * errorstream
 Stream for error reporting. More...
 
char * source_file
 Name of the source file. More...
 
- Static Protected Attributes inherited from Parsers::ParseFile
static const int buffersize = 1024
 Size of line buffer. More...
 

Detailed Description

MRRXtrkCad parser class.

Include MRRXtrkCad.tab.h to get this class (the docs are wrong).

Author
Robert Heller <heller@deepsoft.com>

Member Enumeration Documentation

◆ YY_MRRXtrkCad_ENUM_TOKEN

Enumerator
YY_MRRXtrkCad_NULL_TOKEN 
INTEGER 
FLOAT 
STRING 
RESTOFLINE 
MULTILINE 
EOL 
UNTERMSTRING 
NOTWORD 
END 
_VERSION 
TITLE 
MAPSCALE 
ROOMSIZE 
SCALE 
HO 
LAYERS 
CURRENT 
STRUCTURE 
DRAW 
CURVE 
TURNOUT 
TURNTABLE 
STRAIGHT 
CAR 
JOINT 
NOTE 
TEXT 
MAIN 
BLOCK 
TRK 
SWITCHMOTOR 

Constructor & Destructor Documentation

◆ MRRXtrkCad()

Parsers::MRRXtrkCad::MRRXtrkCad ( const char *  filename)

The constructor function.

The constructor is the only function that is directly called from user code. See LayoutFile for all other access methods.

◆ ~MRRXtrkCad()

virtual Parsers::MRRXtrkCad::~MRRXtrkCad ( )
inlinevirtual

Member Function Documentation

◆ lookup_word()

int Parsers::MRRXtrkCad::lookup_word ( const char *  word) const
private

◆ yyerror()

virtual void Parsers::MRRXtrkCad::yyerror ( char *  msg)
virtual

◆ yyerror1()

void Parsers::MRRXtrkCad::yyerror1 ( const char *  message,
const char *  s 
) const
private

◆ yylex()

virtual int Parsers::MRRXtrkCad::yylex ( )
virtual

◆ yyparse()

int Parsers::MRRXtrkCad::yyparse ( void  )

Member Data Documentation

◆ CurrentScale

double Parsers::MRRXtrkCad::CurrentScale
private

◆ fieldflag

int Parsers::MRRXtrkCad::fieldflag
private

◆ scanEol

bool Parsers::MRRXtrkCad::scanEol
private

◆ scanToEND

bool Parsers::MRRXtrkCad::scanToEND
private

◆ yychar

int Parsers::MRRXtrkCad::yychar

◆ yydebug

int Parsers::MRRXtrkCad::yydebug

◆ yylloc

yyltype Parsers::MRRXtrkCad::yylloc

◆ yylval

yy_MRRXtrkCad_stype Parsers::MRRXtrkCad::yylval

◆ yynerrs

int Parsers::MRRXtrkCad::yynerrs