BinaryInputDevice.cpp File Reference


Detailed Description

Author:
Daniel Krajzewicz
Date:
2005-09-15
Version:
Id
BinaryInputDevice.cpp 8459 2010-03-17 22:02:19Z behrisch

Definition in file BinaryInputDevice.cpp.

#include <config.h>
#include <string>
#include "BinaryInputDevice.h"

Go to the source code of this file.

Defines

#define BUF_MAX   1000

Functions

BinaryInputDeviceoperator>> (BinaryInputDevice &os, long &l) throw ()
BinaryInputDeviceoperator>> (BinaryInputDevice &os, std::string &s) throw ()
BinaryInputDeviceoperator>> (BinaryInputDevice &os, bool &b) throw ()
BinaryInputDeviceoperator>> (BinaryInputDevice &os, SUMOReal &f) throw ()
BinaryInputDeviceoperator>> (BinaryInputDevice &os, unsigned int &i) throw ()
BinaryInputDeviceoperator>> (BinaryInputDevice &os, int &i) throw ()


Define Documentation

#define BUF_MAX   1000

Definition at line 40 of file BinaryInputDevice.cpp.

Referenced by operator>>().


Function Documentation

BinaryInputDevice& operator>> ( BinaryInputDevice os,
long &  l 
) throw ()

Parameters:
[in,out] os The BinaryInputDevice to read the long from
[in] i The int to store the read value into
Returns:
The used BinaryInputDevice for further processing

Definition at line 103 of file BinaryInputDevice.cpp.

References BinaryInputDevice::myStream.

00103                                                    {
00104     os.myStream.read((char*) &l, sizeof(long));
00105     return os;
00106 }

BinaryInputDevice& operator>> ( BinaryInputDevice os,
std::string &  s 
) throw ()

Reads the length of the string as an unsigned int, first. Reads then the specified number of chars into "myBuffer". Please note that the buffer has a fixed size - longer strings will cause an error.

Parameters:
[in,out] os The BinaryInputDevice to read the string from
[in] i The string to store the read value into
Returns:
The used BinaryInputDevice for further processing
Todo:
Use either a buffer with a flexible size or report an error if the buffer is too small!

Definition at line 89 of file BinaryInputDevice.cpp.

References BUF_MAX, and size.

00089                                                         {
00090     unsigned int size;
00091     os >> size;
00092     if (size<BUF_MAX) {
00093         os.myStream.read((char*) &os.myBuffer, sizeof(char)*size);
00094         os.myBuffer[size] = 0;
00095         s = std::string(os.myBuffer);
00096         return os;
00097     }
00098     return os;
00099 }

BinaryInputDevice& operator>> ( BinaryInputDevice os,
bool b 
) throw ()

Parameters:
[in,out] os The BinaryInputDevice to read the bool from
[in] i The bool to store the read value into
Returns:
The used BinaryInputDevice for further processing

Definition at line 81 of file BinaryInputDevice.cpp.

References BinaryInputDevice::myStream.

00081                                                    {
00082     b = 0;
00083     os.myStream.read((char*) &b, sizeof(char));
00084     return os;
00085 }

BinaryInputDevice& operator>> ( BinaryInputDevice os,
SUMOReal &  f 
) throw ()

Parameters:
[in,out] os The BinaryInputDevice to read the SUMOReal from
[in] i The SUMOReal to store the read value into
Returns:
The used BinaryInputDevice for further processing

Definition at line 74 of file BinaryInputDevice.cpp.

References BinaryInputDevice::myStream, and SUMOReal.

00074                                                        {
00075     os.myStream.read((char*) &f, sizeof(SUMOReal));
00076     return os;
00077 }

BinaryInputDevice& operator>> ( BinaryInputDevice os,
unsigned int &  i 
) throw ()

Parameters:
[in,out] os The BinaryInputDevice to read the unsigned int from
[in] i The unsigned int to store the read value into
Returns:
The used BinaryInputDevice for further processing

Definition at line 67 of file BinaryInputDevice.cpp.

References BinaryInputDevice::myStream.

00067                                                            {
00068     os.myStream.read((char*) &i, sizeof(unsigned int));
00069     return os;
00070 }

BinaryInputDevice& operator>> ( BinaryInputDevice os,
int &  i 
) throw ()

Parameters:
[in,out] os The BinaryInputDevice to read the int from
[in] i The int to store the read value into
Returns:
The used BinaryInputDevice for further processing

Definition at line 60 of file BinaryInputDevice.cpp.

References BinaryInputDevice::myStream.

00060                                                   {
00061     os.myStream.read((char*) &i, sizeof(int));
00062     return os;
00063 }


Generated on Wed May 5 00:06:37 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6