SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tcpip::Storage Class Reference

#include <storage.h>

Public Types

typedef std::vector< unsigned
char > 
StorageType

Public Member Functions

StorageType::const_iterator begin () const
StorageType::const_iterator end () const
std::string hexDump () const
 Dump storage content as series of hex values.
virtual unsigned int position () const
virtual int readByte () throw (std::invalid_argument)
virtual unsigned char readChar () throw (std::invalid_argument)
virtual double readDouble () throw (std::invalid_argument)
virtual float readFloat () throw (std::invalid_argument)
virtual int readInt () throw (std::invalid_argument)
virtual int readShort () throw (std::invalid_argument)
virtual std::string readString () throw (std::invalid_argument)
virtual std::vector< std::string > readStringList () throw (std::invalid_argument)
virtual int readUnsignedByte () throw (std::invalid_argument)
void reset ()
StorageType::size_type size () const
 Storage ()
 Standard Constructor.
 Storage (const unsigned char[], int length=-1)
 Constructor, that fills the storage with an char array. If length is -1, the whole array is handed over.
virtual bool valid_pos ()
virtual void writeByte (int) throw (std::invalid_argument)
virtual void writeChar (unsigned char) throw ()
virtual void writeDouble (double) throw ()
virtual void writeFloat (float) throw ()
virtual void writeInt (int) throw ()
virtual void writePacket (unsigned char *packet, int length)
virtual void writePacket (const std::vector< unsigned char > &packet)
virtual void writeShort (int) throw (std::invalid_argument)
virtual void writeStorage (tcpip::Storage &store)
virtual void writeString (const std::string &s) throw ()
virtual void writeStringList (const std::vector< std::string > &s) throw ()
virtual void writeUnsignedByte (int) throw (std::invalid_argument)
virtual ~Storage ()

Private Member Functions

void checkReadSafe (unsigned int num) const throw (std::invalid_argument)
 Check if the next num bytes can be read safely.
void init ()
 Used in constructors to initialize local variables.
void readByEndianess (unsigned char *array, int size)
 Read size elements into array according to endianess.
unsigned char readCharUnsafe ()
 Read a byte without validity check.
void writeByEndianess (const unsigned char *begin, unsigned int size)
 Write size elements of array begin according to endianess.

Private Attributes

bool bigEndian_
StorageType::const_iterator iter_
StorageType store

Detailed Description

Definition at line 37 of file storage.h.


Member Typedef Documentation

typedef std::vector<unsigned char> tcpip::Storage::StorageType

Definition at line 41 of file storage.h.


Constructor & Destructor Documentation

tcpip::Storage::Storage ( )

Standard Constructor.

tcpip::Storage::Storage ( const unsigned  char[],
int  length = -1 
)

Constructor, that fills the storage with an char array. If length is -1, the whole array is handed over.

virtual tcpip::Storage::~Storage ( )
virtual

Member Function Documentation

StorageType::const_iterator tcpip::Storage::begin ( ) const
inline

Definition at line 117 of file storage.h.

References store.

Referenced by tcpip::Socket::sendExact().

void tcpip::Storage::checkReadSafe ( unsigned int  num) const throw (std::invalid_argument)
private

Check if the next num bytes can be read safely.

StorageType::const_iterator tcpip::Storage::end ( ) const
inline

Definition at line 118 of file storage.h.

References store.

Referenced by tcpip::Socket::sendExact().

std::string tcpip::Storage::hexDump ( ) const

Dump storage content as series of hex values.

void tcpip::Storage::init ( )
private

Used in constructors to initialize local variables.

void tcpip::Storage::readByEndianess ( unsigned char *  array,
int  size 
)
private

Read size elements into array according to endianess.

virtual int tcpip::Storage::readByte ( ) throw (std::invalid_argument)
virtual
virtual unsigned char tcpip::Storage::readChar ( ) throw (std::invalid_argument)
virtual
unsigned char tcpip::Storage::readCharUnsafe ( )
private

Read a byte without validity check.

virtual float tcpip::Storage::readFloat ( ) throw (std::invalid_argument)
virtual
virtual int tcpip::Storage::readShort ( ) throw (std::invalid_argument)
virtual
virtual std::string tcpip::Storage::readString ( ) throw (std::invalid_argument)
virtual
virtual std::vector<std::string> tcpip::Storage::readStringList ( ) throw (std::invalid_argument)
virtual
virtual int tcpip::Storage::readUnsignedByte ( ) throw (std::invalid_argument)
virtual
void tcpip::Storage::reset ( )
virtual bool tcpip::Storage::valid_pos ( )
virtual
void tcpip::Storage::writeByEndianess ( const unsigned char *  begin,
unsigned int  size 
)
private

Write size elements of array begin according to endianess.

virtual void tcpip::Storage::writeByte ( int  ) throw (std::invalid_argument)
virtual
virtual void tcpip::Storage::writeChar ( unsigned  char) throw ()
virtual
virtual void tcpip::Storage::writeFloat ( float  ) throw ()
virtual
virtual void tcpip::Storage::writePacket ( unsigned char *  packet,
int  length 
)
virtual
virtual void tcpip::Storage::writePacket ( const std::vector< unsigned char > &  packet)
virtual
virtual void tcpip::Storage::writeShort ( int  ) throw (std::invalid_argument)
virtual

Field Documentation

bool tcpip::Storage::bigEndian_
private

Definition at line 48 of file storage.h.

StorageType::const_iterator tcpip::Storage::iter_
private

Definition at line 45 of file storage.h.

StorageType tcpip::Storage::store
private

Definition at line 44 of file storage.h.

Referenced by begin(), and end().


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