NMPB08 Shared Libraries
Public Member Functions
RailwayDatabase Class Reference

the database of railway rolling stock More...

#include <RailwayDatabase.h>

List of all members.

Public Member Functions

 RailwayDatabase (void)
int LoadFile (const char *filename, bool trace=false)
 load an external file into the database
int GetErrorCode (void)
 get the most recent error code
int Dump (const char *filename)
 dump the contents of the database to a text file
int EnumEntities (EnumRailwayEntities enumProc, unsigned int include_types, void *userdata)
 enumerates the contents of the database
int EnumSources (EnumRailwaySources enumProc, IDREF id, void *userdata, double pos=0.0)
 enumerates the elementary sources associated with a unit or a train
RailwaySource const * getSource (IDREF ref)
 get the elementary source record
RailwayUnit const * getUnit (IDREF ref)
 get the rolling stock unit record
RailwayTrain const * getTrain (IDREF ref)
 get the train record

Detailed Description

the database of railway rolling stock

the database is structures at three levels : train, units and elementary sources

a railway traffic may be composed from trains and/or units.

Definition at line 147 of file RailwayDatabase.h.


Constructor & Destructor Documentation

RailwayDatabase::RailwayDatabase ( void  ) [inline]

Definition at line 151 of file RailwayDatabase.h.


Member Function Documentation

int RailwayDatabase::Dump ( const char *  filename)

dump the contents of the database to a text file

Parameters:
filenamename of the text file. If the file name is a NULL pointer or points to an empty string, the output is written to stdout.

Definition at line 485 of file RailwayDatabase.cpp.

int RailwayDatabase::EnumEntities ( EnumRailwayEntities  enumProc,
unsigned int  include_types,
void *  userdata 
)

enumerates the contents of the database

Parameters:
enumProca user defined callback function, called once for each selected entry in the database
include_typestype of database entries to be enumerated
userdatauser defined data to be passed to the callback function

Definition at line 524 of file RailwayDatabase.cpp.

int RailwayDatabase::EnumSources ( EnumRailwaySources  enumProc,
IDREF  id,
void *  userdata,
double  pos = 0.0 
)

enumerates the elementary sources associated with a unit or a train

Parameters:
enumProca user defined callback function, called once for each elementary sources
ididentification code for train or unit
userdatauser defined data to be passed to the callback function
posposition along the train (for internal use only)

Definition at line 583 of file RailwayDatabase.cpp.

int RailwayDatabase::GetErrorCode ( void  ) [inline]

get the most recent error code

Definition at line 163 of file RailwayDatabase.h.

RailwaySource const * RailwayDatabase::getSource ( IDREF  ref)

get the elementary source record

Parameters:
refthe identifier of the elementary source

Definition at line 223 of file RailwayDatabase.cpp.

RailwayTrain const * RailwayDatabase::getTrain ( IDREF  ref)

get the train record

Parameters:
refthe identifier of the train

Definition at line 241 of file RailwayDatabase.cpp.

RailwayUnit const * RailwayDatabase::getUnit ( IDREF  ref)

get the rolling stock unit record

Parameters:
refthe identifier of the rolling stock unit

Definition at line 232 of file RailwayDatabase.cpp.

int RailwayDatabase::LoadFile ( const char *  filename,
bool  trace = false 
)

load an external file into the database

Parameters:
filenamename of the file
traceif true, trace operations to stdout
Returns:
0 if successful, an error code otherwise

Definition at line 144 of file RailwayDatabase.cpp.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines