Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

rovsoft::io::BinaryLenSegmentIStreamer Class Reference

This class is able to read data from a binary stream with the encoding used for the communication with the PIC and the robot board. More...

#include <BinaryLenSegmentIStreamer.hh>

Inheritance diagram for rovsoft::io::BinaryLenSegmentIStreamer:

Inheritance graph
[legend]
Collaboration diagram for rovsoft::io::BinaryLenSegmentIStreamer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BinaryLenSegmentIStreamer (std::istream *in, const char *chars, char lengthFieldOffset, bool is_PIC=false) throw (lib::NullPointerExceptionPtr)
 A SegmentIStreamer must be initialised with a dynamically created istream object.
virtual char readByte () throw (UnprefixedMetaDataExceptionPtr, PrefixedDataExceptionPtr, EndOfSegmentExceptionPtr)
virtual char readChar () throw (IOExceptionPtr)
virtual unsigned char readUByte () throw (IOExceptionPtr)
virtual short readShort () throw (IOExceptionPtr)
virtual unsigned short readUShort () throw (IOExceptionPtr)
virtual long readLong () throw (IOExceptionPtr)
virtual unsigned long readULong () throw (IOExceptionPtr)
virtual long long readLongLong () throw (IOExceptionPtr)
virtual unsigned long long readULongLong () throw (IOExceptionPtr)
virtual float readFloat () throw (IOExceptionPtr)
virtual double readDouble () throw (IOExceptionPtr)
virtual std::string readString () throw (IOExceptionPtr)
virtual std::string readString (int length) throw (IOExceptionPtr)
 Reads a string with fix length.
virtual int nextStart () throw (IOExceptionPtr)
 Calls readByte() subsequently until an UnprefixedMetaDataExceptionPtr is raised, then it checks the read byte if it is the start byte if yes it returns.
virtual bool isStart () throw (IOExceptionPtr)
 Test if we are at the beginning of a segment.
virtual bool isEnd () throw (IOExceptionPtr)
 Test if we are at the end of a segment.

Protected Attributes

short byteCount
 The number of bytes read, this counter gets incremented by readByte, (or readUnprefixed().
bool start
 True if nextStart() has been called and no other reading method yet.
short length
 When the length byte is read its value is stored in this member.
int segmentCount
bool isPIC
 If the Pic is on the other side of the line.

Detailed Description

This class is able to read data from a binary stream with the encoding used for the communication with the PIC and the robot board.

The end of a segment is detected by reading a in the segement specified number of bytes.


Constructor & Destructor Documentation

rovsoft::io::BinaryLenSegmentIStreamer::BinaryLenSegmentIStreamer std::istream *  in,
const char *  chars,
char  lengthFieldOffset,
bool  is_PIC = false
throw (lib::NullPointerExceptionPtr) [inline]
 

A SegmentIStreamer must be initialised with a dynamically created istream object.

The deletion of the object is accomplished by this SegmentIStreamer object at destruction.

Parameters:
chars A two character string. The first character specifies the prefix being used for substitution, the second is the character used for the detection of the beginning of a message.
lengthFieldOffset The offset at which the length field is placed. The length of the following data should be stored there.
is_PIC Currently the transmission of floats in binary form to the pic isn't working, so shorts are used.


Member Function Documentation

bool rovsoft::io::BinaryLenSegmentIStreamer::isEnd  )  throw (IOExceptionPtr) [virtual]
 

Test if we are at the end of a segment.

Returns:
true if we are at the end of a segment.

Implements rovsoft::io::SegmentIStreamer.

bool rovsoft::io::BinaryLenSegmentIStreamer::isStart  )  throw (IOExceptionPtr) [virtual]
 

Test if we are at the beginning of a segment.

Returns:
true if we are at the beginning of a segment, this is only true if a nextStart() method had been called previously and no data was read yet.

Implements rovsoft::io::SegmentIStreamer.

int rovsoft::io::BinaryLenSegmentIStreamer::nextStart  )  throw (IOExceptionPtr) [virtual]
 

Calls readByte() subsequently until an UnprefixedMetaDataExceptionPtr is raised, then it checks the read byte if it is the start byte if yes it returns.

Implements rovsoft::io::SegmentIStreamer.

Here is the call graph for this function:

char rovsoft::io::BinaryLenSegmentIStreamer::readByte  )  throw (UnprefixedMetaDataExceptionPtr, PrefixedDataExceptionPtr, EndOfSegmentExceptionPtr) [virtual]
 

Exceptions:
EndOfSegmentExceptionPtr If the end of the segment is detected, so if you read a complete segment you should call nextStart(), before reading any more data, with any of the reading methods of this class.

Reimplemented from rovsoft::io::BinarySubstitutionIStreamer.

Here is the call graph for this function:

char rovsoft::io::BinaryLenSegmentIStreamer::readChar  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

double rovsoft::io::BinaryLenSegmentIStreamer::readDouble  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

float rovsoft::io::BinaryLenSegmentIStreamer::readFloat  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

long rovsoft::io::BinaryLenSegmentIStreamer::readLong  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

long long rovsoft::io::BinaryLenSegmentIStreamer::readLongLong  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

short rovsoft::io::BinaryLenSegmentIStreamer::readShort  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

std::string rovsoft::io::BinaryLenSegmentIStreamer::readString int  length  )  throw (IOExceptionPtr) [virtual]
 

Reads a string with fix length.

Parameters:
length the number of characters to read.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

std::string rovsoft::io::BinaryLenSegmentIStreamer::readString  )  throw (IOExceptionPtr) [virtual]
 

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

unsigned char rovsoft::io::BinaryLenSegmentIStreamer::readUByte  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

unsigned long rovsoft::io::BinaryLenSegmentIStreamer::readULong  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

unsigned long long rovsoft::io::BinaryLenSegmentIStreamer::readULongLong  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:

unsigned short rovsoft::io::BinaryLenSegmentIStreamer::readUShort  )  throw (IOExceptionPtr) [virtual]
 

See also:
readByte() used by this method for reading. So for details of thrown exceptions, please see this method.

Reimplemented from rovsoft::io::BinaryIStreamer.

Here is the call graph for this function:


Member Data Documentation

short rovsoft::io::BinaryLenSegmentIStreamer::byteCount [protected]
 

The number of bytes read, this counter gets incremented by readByte, (or readUnprefixed().

) --> if it would exist. When reading a prefixed character this counter gets only incremented by one, although actually two characters were read. This field can be used for detection of the end of a message or for detection of the length byte.

bool rovsoft::io::BinaryLenSegmentIStreamer::isPIC [protected]
 

If the Pic is on the other side of the line.

short rovsoft::io::BinaryLenSegmentIStreamer::length [protected]
 

When the length byte is read its value is stored in this member.

If we are not in the data part of the message this field should contain -1. The length field is the sixth byte in a segment, (exclusive any prefixes and the start character.) For details please see the RobotBoardCommunication protocol.

int rovsoft::io::BinaryLenSegmentIStreamer::segmentCount [protected]
 

bool rovsoft::io::BinaryLenSegmentIStreamer::start [protected]
 

True if nextStart() has been called and no other reading method yet.


The documentation for this class was generated from the following files:
Generated on Tue May 31 14:19:27 2005 for Rovsoft by  doxygen 1.4.3