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. More...
 
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. More...
 
 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. More...
 
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. More...
 
void init ()
 Used in constructors to initialize local variables. More...
 
void readByEndianess (unsigned char *array, int size)
 Read size elements into array according to endianess. More...
 
unsigned char readCharUnsafe ()
 Read a byte without validity check. More...
 
void writeByEndianess (const unsigned char *begin, unsigned int size)
 Write size elements of array begin according to endianess. More...
 

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.

virtual unsigned int tcpip::Storage::position ( ) const
virtual
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

Referenced by TraCIServer::addObjectVariableSubscription(), TraCIAPI::check_resultState(), TraCIServerAPI_Vehicle::commandDistanceRequest(), TraCIServerAPI_Simulation::commandDistanceRequest(), TraCITestClient::commandGetVariable(), TraCIServerAPI_Simulation::commandPositionConversion(), TraCIAPI::TrafficLightScope::getCompleteRedYellowGreenDefinition(), TraCIAPI::TrafficLightScope::getControlledLinks(), TraCIAPI::getString(), TraCIAPI::getStringVector(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_TLS::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_VehicleType::processSet(), TraCIServer::processSingleSubscription(), TraCITestClient::readAndReportTypeDependent(), TraCIServer::readTypeCheckingString(), and TraCITestClient::validateSubscription().

virtual std::vector<std::string> tcpip::Storage::readStringList ( )
throw (std::invalid_argument
)
virtual
virtual int tcpip::Storage::readUnsignedByte ( )
throw (std::invalid_argument
)
virtual

Referenced by TraCIServer::addObjectVariableSubscription(), TraCIAPI::check_commandGetResult(), TraCIAPI::check_resultState(), TraCIServerAPI_Vehicle::commandDistanceRequest(), TraCIServerAPI_Simulation::commandDistanceRequest(), TraCITestClient::commandGetVariable(), TraCIServerAPI_Simulation::commandPositionConversion(), TraCIServer::dispatchCommand(), TraCIAPI::getColor(), TraCIAPI::TrafficLightScope::getCompleteRedYellowGreenDefinition(), TraCIAPI::TrafficLightScope::getControlledLinks(), TraCIAPI::getUnsignedByte(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_TLS::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_VehicleType::processSet(), TraCIServer::processSingleSubscription(), TraCITestClient::readAndReportTypeDependent(), TraCIServer::readTypeCheckingBoundary(), TraCIServer::readTypeCheckingByte(), TraCIServer::readTypeCheckingColor(), TraCIServer::readTypeCheckingDouble(), TraCIServer::readTypeCheckingInt(), TraCIServer::readTypeCheckingPolygon(), TraCIServer::readTypeCheckingPosition2D(), TraCIServer::readTypeCheckingString(), TraCIServer::readTypeCheckingStringList(), TraCIServer::readTypeCheckingUnsignedByte(), and TraCITestClient::validateSubscription().

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::writeDouble ( double  )
throw (
)
virtual

Referenced by TraCIAPI::EdgeScope::adaptTraveltime(), TraCIAPI::POIScope::add(), TraCIAPI::PolygonScope::add(), TraCIServerAPI_Vehicle::commandDistanceRequest(), TraCIServerAPI_Simulation::commandDistanceRequest(), TraCIServerAPI_Simulation::commandPositionConversion(), TraCIServerAPI_VehicleType::getVariable(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_GUI::processGet(), TraCIAPI::send_commandSubscribeObjectContext(), TraCIAPI::VehicleTypeScope::setAccel(), TraCIAPI::GUIScope::setBoundary(), TraCIAPI::VehicleTypeScope::setDecel(), TraCIAPI::EdgeScope::setEffort(), TraCIAPI::VehicleTypeScope::setImperfection(), TraCIAPI::LaneScope::setLength(), TraCIAPI::VehicleTypeScope::setLength(), TraCIAPI::EdgeScope::setMaxSpeed(), TraCIAPI::LaneScope::setMaxSpeed(), TraCIAPI::VehicleTypeScope::setMaxSpeed(), TraCIAPI::VehicleTypeScope::setMinGap(), TraCIAPI::GUIScope::setOffset(), TraCIAPI::POIScope::setPosition(), TraCIAPI::PolygonScope::setShape(), TraCIAPI::VehicleTypeScope::setSpeedDeviation(), TraCIAPI::VehicleTypeScope::setSpeedFactor(), TraCIAPI::VehicleTypeScope::setTau(), TraCITestClient::setValueTypeDependant(), TraCIAPI::VehicleTypeScope::setWidth(), and TraCIAPI::GUIScope::setZoom().

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
virtual void tcpip::Storage::writeString ( const std::string &  s)
throw (
)
virtual

Referenced by TraCIAPI::POIScope::add(), TraCIAPI::PolygonScope::add(), TraCIServer::commandGetVersion(), TraCIServerAPI_Simulation::commandPositionConversion(), TraCIServerAPI_VehicleType::getVariable(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServer::processSingleSubscription(), TraCIAPI::GUIScope::screenshot(), TraCIAPI::send_commandGetVariable(), TraCIAPI::send_commandSetValue(), TraCIAPI::send_commandSubscribeObjectContext(), TraCIAPI::send_commandSubscribeObjectVariable(), TraCIAPI::LaneScope::setAllowed(), TraCIAPI::TrafficLightScope::setCompleteRedYellowGreenDefinition(), TraCIAPI::LaneScope::setDisallowed(), TraCIAPI::VehicleTypeScope::setEmissionClass(), TraCIAPI::TrafficLightScope::setProgram(), TraCIAPI::TrafficLightScope::setRedYellowGreenState(), TraCIAPI::GUIScope::setSchema(), TraCIAPI::VehicleTypeScope::setShapeClass(), TraCIAPI::POIScope::setType(), TraCIAPI::PolygonScope::setType(), TraCITestClient::setValueTypeDependant(), TraCIAPI::VehicleTypeScope::setVehicleClass(), TraCIAPI::GUIScope::trackVehicle(), and TraCIServer::writeStatusCmd().

virtual void tcpip::Storage::writeUnsignedByte ( int  )
throw (std::invalid_argument
)
virtual

Referenced by TraCIAPI::POIScope::add(), TraCIAPI::PolygonScope::add(), TraCIAPI::RouteScope::add(), TraCIServerAPI_Vehicle::commandDistanceRequest(), TraCIServerAPI_Simulation::commandDistanceRequest(), TraCIServer::commandGetVersion(), TraCIServerAPI_Simulation::commandPositionConversion(), TraCIServerAPI_VehicleType::getVariable(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServer::processSingleSubscription(), TraCIAPI::POIScope::remove(), TraCIAPI::PolygonScope::remove(), TraCIAPI::send_commandClose(), TraCIAPI::send_commandGetVariable(), TraCIAPI::send_commandSetValue(), TraCIAPI::send_commandSimulationStep(), TraCIAPI::send_commandSubscribeObjectContext(), TraCIAPI::send_commandSubscribeObjectVariable(), TraCIAPI::VehicleTypeScope::setAccel(), TraCIAPI::LaneScope::setAllowed(), TraCIAPI::GUIScope::setBoundary(), TraCIAPI::POIScope::setColor(), TraCIAPI::PolygonScope::setColor(), TraCIAPI::VehicleTypeScope::setColor(), TraCIAPI::TrafficLightScope::setCompleteRedYellowGreenDefinition(), TraCIAPI::VehicleTypeScope::setDecel(), TraCIAPI::LaneScope::setDisallowed(), TraCIAPI::VehicleTypeScope::setEmissionClass(), TraCIAPI::VehicleTypeScope::setImperfection(), TraCIAPI::LaneScope::setLength(), TraCIAPI::VehicleTypeScope::setLength(), TraCIAPI::LaneScope::setMaxSpeed(), TraCIAPI::VehicleTypeScope::setMaxSpeed(), TraCIAPI::VehicleTypeScope::setMinGap(), TraCIAPI::GUIScope::setOffset(), TraCIAPI::TrafficLightScope::setPhase(), TraCIAPI::TrafficLightScope::setPhaseDuration(), TraCIAPI::POIScope::setPosition(), TraCIAPI::TrafficLightScope::setProgram(), TraCIAPI::TrafficLightScope::setRedYellowGreenState(), TraCIAPI::PolygonScope::setShape(), TraCIAPI::VehicleTypeScope::setShapeClass(), TraCIAPI::VehicleTypeScope::setSpeedDeviation(), TraCIAPI::VehicleTypeScope::setSpeedFactor(), TraCIAPI::VehicleTypeScope::setTau(), TraCIAPI::POIScope::setType(), TraCIAPI::PolygonScope::setType(), TraCITestClient::setValueTypeDependant(), TraCIAPI::VehicleTypeScope::setVehicleClass(), TraCIAPI::VehicleTypeScope::setWidth(), TraCIServer::writeResponseWithLength(), TraCIServer::writeStatusCmd(), TraCIServerAPI_Simulation::writeVehicleStateIDs(), and TraCIServerAPI_Simulation::writeVehicleStateNumber().

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: