AURobotServers  4
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
USmlFile Class Reference

#include <usmlfile.h>

Inheritance diagram for USmlFile:
Inheritance graph

Public Member Functions

void closeSmlFile ()
 
virtual int getLineNumber ()
 
virtual const char * getSourceName ()
 
bool openSmlFile (const char *filename)
 
virtual void setLineNumber (int newLineNumber)
 
void setVerbose (bool value)
 
virtual void syntaxError (const char *message)
 
 USmlFile ()
 
 ~USmlFile ()
 
- Public Member Functions inherited from USmlSource
void allowTagAtStartOfLineOnly ()
 
const char * getErrorBuffer ()
 
virtual int getNBytes (char *buffer, int n, int msTimeout=100)
 
virtual bool getNextTag (USmlTag *tag, int msTimeout=100, USmlTagIn *failEndTag=NULL, char *beforeTagBuffer=NULL, int *beforeTagCnt=NULL)
 
char * getRxDataBuffer ()
 
int getRxDataBufferCnt ()
 
bool getToEndTag (USmlTagIn *tag, char *buffer, const int bufferSize, int msTimeout=100, USmlTagIn *lastTag=NULL)
 
bool isErrorText ()
 
bool isVerbose ()
 
virtual bool logSourceData (const char *, int)
 
virtual bool outputData (const char *message)
 
void setErrorBuffer (char *buf, const int bufCnt)
 
int setRxDataBufferCnt (int newMaxLength)
 
virtual bool skipNBytes (int n, int msTimeout=100)
 
virtual bool skipToEndTag (USmlTagIn *tag, int msTimeout=100)
 
 USmlSource ()
 
virtual ~USmlSource ()
 

Protected Member Functions

virtual bool doVerboseMessages ()
 
virtual int getMoreData (char *buffer, int bufferSize, int pollTimeoutMs)
 
virtual bool isSourceAvailable ()
 
- Protected Member Functions inherited from USmlSource
void clearRxBuffer ()
 

Protected Attributes

FILE * fh
 
char fn [MAX_FILENAME_LENGTH]
 
int line
 
bool verbose
 
- Protected Attributes inherited from USmlSource
int dataCnt
 
char * errorBuffer
 
int errorBufferCnt
 
bool gotFirstTag
 
bool tagStartAtStartOfLineOnly
 

Additional Inherited Members

- Public Attributes inherited from USmlSource
const char * ifName
 

Detailed Description

File source for SML (XML) source

    @author Christian Andersen <chrand@mail.dk>

Constructor & Destructor Documentation

USmlFile::USmlFile ( )

Constructor

References USmlSource::errorBufferCnt, fh, fn, line, and verbose.

USmlFile::~USmlFile ( )

Destructor

References fh.

Member Function Documentation

void USmlFile::closeSmlFile ( )

close SML (XML) file

References fh, and line.

Referenced by UResRule::loadFile().

bool USmlFile::doVerboseMessages ( )
protectedvirtual

Should additional messaves be printed to console

Reimplemented from USmlSource.

References verbose.

Referenced by getSourceName().

virtual int USmlFile::getLineNumber ( )
inlinevirtual

Get current line number from the source - first line is 1

Returns
-1 if line numbers are unavalable (file not open)

Reimplemented from USmlSource.

References line.

int USmlFile::getMoreData ( char *  buffer,
int  bufferSize,
int  pollTimeoutMs 
)
protectedvirtual

Get more data, if more data is available

Reimplemented from USmlSource.

References fh, and line.

Referenced by getSourceName().

virtual const char* USmlFile::getSourceName ( )
inlinevirtual

Get source name (filename) pointer

Reimplemented from USmlSource.

References doVerboseMessages(), fn, getMoreData(), and isSourceAvailable().

bool USmlFile::isSourceAvailable ( )
protectedvirtual

Is tha data source (still) open.

Returns
true if open

Reimplemented from USmlSource.

References fh.

Referenced by getSourceName().

bool USmlFile::openSmlFile ( const char *  filename)

Open file. If file is open, then old file will be closed first.

References dataPath, fh, fn, getFullFilename(), line, and MAX_FILENAME_LENGTH.

Referenced by UResRule::loadFile().

virtual void USmlFile::setLineNumber ( int  newLineNumber)
inlinevirtual

Set current line number from the source

Parameters
newLineNumbermay be used to set a new series of line numbers

Reimplemented from USmlSource.

References line.

void USmlFile::setVerbose ( bool  value)
inline

Set if the console messages should be verbose

References verbose.

Referenced by UResRule::loadFile().

void USmlFile::syntaxError ( const char *  message)
virtual

A syntax error has occured with the provided message

Parameters
messageis a description of the error type.

Reimplemented from USmlSource.

References line, and USmlSource::syntaxError().

Member Data Documentation

FILE* USmlFile::fh
protected

file handle for XML type file

Referenced by closeSmlFile(), getMoreData(), isSourceAvailable(), openSmlFile(), USmlFile(), and ~USmlFile().

char USmlFile::fn[MAX_FILENAME_LENGTH]
protected

file name

Referenced by getSourceName(), openSmlFile(), and USmlFile().

int USmlFile::line
protected
bool USmlFile::verbose
protected

Should more debug data be output to console

Referenced by doVerboseMessages(), setVerbose(), and USmlFile().


The documentation for this class was generated from the following files: