Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSCAR::RobotData Class Reference
[FileData]

Acts as the base class for all classes that are used to read and parse data files. More...

#include <RobotData.h>

Inheritance diagram for OSCAR::RobotData:

Inheritance graph
[legend]
List of all members.

Public Methods

 RobotData (OSCARError &err=DUMMY_ERROR(noError), const String &name=String(""))
 RobotData (const RobotData &rhs)
virtual ~RobotData ()

Protected Methods

bool open (const String &filename, std::ifstream &fileStream)
virtual bool parseComments (std::ifstream &fileStream, const char commentMarker)
virtual int getNoofEntries (std::ifstream &fileStream, const char commentMarker)
RobotData & operator= (const RobotData &rhs)

Protected Attributes

bool isOpen

Detailed Description

Author:
Chetan Kapoor
Acts as the base class for all classes that are used to read data files and parse them for comments and data. This class implements two key methods that are used by derived classes. One of these allows to read a file while skipping the comments, while the other one allows to count the number of valid items in the data file.


Constructor & Destructor Documentation

OSCAR::RobotData::RobotData OSCARError   err = DUMMY_ERROR(noError),
const String   name = String("")
 

Constructor.

This is the Constructor for an object of type RobotData. Use this to construct an RobotData object with a name and an OSCARError object. If no values are provided for the parameters, then the default values are used.

Parameters:
err A reference to an object of type OSCARError. The default OSCARError object holds values that imply a "No Error" state. This will hold the value of the error code that was generated when the constructor was called.
name An String that specifies the name of the RobotData object being created. The default is an empty String.

OSCAR::RobotData::RobotData const RobotData &    rhs
 

Copy Constructor.

This is the Copy Constructor for an object of type RobotData. Use this to construct an RobotData object from an existing RobotData object.

Parameters:
rhs An RobotData object that will be used to initialize this new object.

virtual OSCAR::RobotData::~RobotData   [virtual]
 

Virtual Destructor.

This is the Destructor for an object of type RobotData.


Member Function Documentation

virtual int OSCAR::RobotData::getNoofEntries std::ifstream &    fileStream,
const char    commentMarker
[protected, virtual]
 

Counts the number of valid entries in a data file.

This method is used to parse a file and count the number of valid entries in the file. This information can then be used to allocate the appropriate data structures to then store the data that will be read.

Parameters:
fileStream A valid input file stream from which data has to be read.
commentMarker This character defines the beginning of a comment. Once this is encountered, the whole line after this is assumed to be comment information.
Returns:
The number of valid entries in the file.
See also:
parseComments()

bool OSCAR::RobotData::open const String   filename,
std::ifstream &    fileStream
[protected]
 

Open a file for input.

This method is used to open a file for input. Possible errors that might occur include a fileOpenError error.

Parameters:
filename Specifies the name of the file to be opened
fileStream On return, fileStream contains a valid reference to an ifstream associated with the opened file.
Returns:
True or False based on whether the file was opened successfully or not. Call GetError() to get details of the error if the return value was false
Exceptions:
fileOpenError fileOpenError

RobotData& OSCAR::RobotData::operator= const RobotData &    rhs [protected]
 

Assignment Operator.

This is the Assignment Operator for an object of type RobotData.

Parameters:
rhs An RobotData object that goes on the right hand side of the = operator
Returns:
A reference to the object on the left hand side of the = operator

virtual bool OSCAR::RobotData::parseComments std::ifstream &    fileStream,
const char    commentMarker
[protected, virtual]
 

Parses a data file and moves the file pointer to the next valid entry.

This method is used to parse a data file and advance the file pointer to point to the next valid entry. It does that by skipping the comments, blank spaces, tabs, carriage returns and line feeds. Consecutive calls to this method can be used to read all the valid file entries.

Parameters:
fileStream A valid input file stream from which data has to be read.
commentMarker This character defines the beginning of a comment. Once this is encountered, the whole line after this is assumed to be comment information.
Returns:
True or False based on whether the method was succesful or not. Call GetError() to get details of the error if the return value was false
See also:
getNoofEntries()


Member Data Documentation

bool OSCAR::RobotData::isOpen [protected]
 


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations