SUMO - Simulation of Urban MObility
tcpip::Storage Class Reference

#include <storage.h>

Collaboration diagram for tcpip::Storage:
Collaboration graph

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

§ StorageType

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

Definition at line 41 of file storage.h.

Constructor & Destructor Documentation

§ Storage() [1/2]

tcpip::Storage::Storage ( )

Standard Constructor.

§ Storage() [2/2]

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.

§ ~Storage()

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

Member Function Documentation

§ begin()

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

§ checkReadSafe()

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

Check if the next num bytes can be read safely.

§ end()

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

§ hexDump()

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

Dump storage content as series of hex values.

§ init()

void tcpip::Storage::init ( )
private

Used in constructors to initialize local variables.

§ position()

virtual unsigned int tcpip::Storage::position ( ) const
virtual

§ readByEndianess()

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

Read size elements into array according to endianess.

§ readByte()

virtual int tcpip::Storage::readByte ( )
throw (std::invalid_argument
)
virtual

§ readChar()

virtual unsigned char tcpip::Storage::readChar ( )
throw (std::invalid_argument
)
virtual

§ readCharUnsafe()

unsigned char tcpip::Storage::readCharUnsafe ( )
private

Read a byte without validity check.

§ readDouble()

§ readFloat()

virtual float tcpip::Storage::readFloat ( )
throw (std::invalid_argument
)
virtual

§ readInt()

§ readShort()

virtual int tcpip::Storage::readShort ( )
throw (std::invalid_argument
)
virtual

§ readString()

virtual std::string tcpip::Storage::readString ( )
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(), TraCIAPI::TrafficLightScope::getCompleteRedYellowGreenDefinition(), TraCIAPI::TrafficLightScope::getControlledLinks(), TraCIAPI::VehicleScope::getNextTLS(), TraCIAPI::getString(), TraCIAPI::getStringVector(), TraCIAPI::InductionLoopScope::getVehicleData(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_TLS::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_VehicleType::processSet(), TraCIServer::processSingleSubscription(), TraCITestClient::readAndReportTypeDependent(), TraCIAPI::readContextSubscription(), TraCIServer::readTypeCheckingString(), TraCIAPI::readVariables(), TraCIAPI::readVariableSubscription(), and TraCITestClient::validateSubscription().

§ readStringList()

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

§ readUnsignedByte()

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::VehicleScope::getNextTLS(), TraCIAPI::getUnsignedByte(), TraCIAPI::InductionLoopScope::getVehicleData(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_TLS::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_VehicleType::processSet(), TraCIServer::processSingleSubscription(), TraCITestClient::readAndReportTypeDependent(), TraCIAPI::readContextSubscription(), TraCIServer::readTypeCheckingBoundary(), TraCIServer::readTypeCheckingByte(), TraCIServer::readTypeCheckingColor(), TraCIServer::readTypeCheckingDouble(), TraCIServer::readTypeCheckingInt(), TraCIServer::readTypeCheckingPolygon(), TraCIServer::readTypeCheckingPosition2D(), TraCIServer::readTypeCheckingString(), TraCIServer::readTypeCheckingStringList(), TraCIServer::readTypeCheckingUnsignedByte(), TraCIAPI::readVariables(), TraCIAPI::readVariableSubscription(), TraCIServerAPI_VehicleType::setVariable(), and TraCITestClient::validateSubscription().

§ reset()

void tcpip::Storage::reset ( )

§ size()

§ valid_pos()

virtual bool tcpip::Storage::valid_pos ( )
virtual

§ writeByEndianess()

void tcpip::Storage::writeByEndianess ( const unsigned char *  begin,
unsigned int  size 
)
private

Write size elements of array begin according to endianess.

§ writeByte()

§ writeChar()

virtual void tcpip::Storage::writeChar ( unsigned  char)
throw (
)
virtual

§ writeDouble()

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(), TraCIAPI::VehicleScope::moveTo(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_Lane::processGet(), TraCIAPI::send_commandMoveToXY(), TraCIAPI::send_commandSubscribeObjectContext(), TraCIAPI::VehicleTypeScope::setAccel(), TraCIAPI::GUIScope::setBoundary(), TraCIAPI::VehicleTypeScope::setDecel(), TraCIAPI::EdgeScope::setEffort(), TraCIAPI::VehicleTypeScope::setHeight(), 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::VehicleScope::setSpeed(), TraCIAPI::VehicleTypeScope::setSpeedDeviation(), TraCIAPI::VehicleTypeScope::setSpeedFactor(), TraCIAPI::VehicleTypeScope::setTau(), TraCITestClient::setValueTypeDependant(), TraCIAPI::VehicleTypeScope::setWidth(), TraCIAPI::GUIScope::setZoom(), and TraCIAPI::VehicleScope::slowDown().

§ writeFloat()

virtual void tcpip::Storage::writeFloat ( float  )
throw (
)
virtual

§ writeInt()

virtual void tcpip::Storage::writeInt ( int  )
throw (
)
virtual

Referenced by TraCIAPI::EdgeScope::adaptTraveltime(), TraCIAPI::POIScope::add(), TraCIAPI::PolygonScope::add(), TraCIAPI::VehicleScope::add(), TraCIServer::commandGetVersion(), TraCIAPI::EdgeScope::getAdaptedTraveltime(), TraCIAPI::EdgeScope::getEffort(), TraCIAPI::VehicleScope::moveTo(), TraCIServer::postProcessSimulationStep2(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServer::processSingleSubscription(), TraCIAPI::POIScope::remove(), TraCIAPI::PolygonScope::remove(), TraCIAPI::send_commandMoveToXY(), TraCIAPI::send_commandSimulationStep(), TraCIAPI::send_commandSubscribeObjectContext(), TraCIAPI::send_commandSubscribeObjectVariable(), tcpip::Socket::sendExact(), TraCIAPI::LaneScope::setAllowed(), TraCIAPI::TrafficLightScope::setCompleteRedYellowGreenDefinition(), TraCIAPI::LaneScope::setDisallowed(), TraCIAPI::EdgeScope::setEffort(), TraCIAPI::TrafficLightScope::setPhase(), TraCIAPI::TrafficLightScope::setPhaseDuration(), TraCIAPI::PolygonScope::setShape(), TraCITestClient::setValueTypeDependant(), TraCIAPI::VehicleScope::slowDown(), TraCIServer::writeResponseWithLength(), and TraCIServerAPI_Simulation::writeVehicleStateNumber().

§ writePacket() [1/2]

virtual void tcpip::Storage::writePacket ( unsigned char *  packet,
int  length 
)
virtual

§ writePacket() [2/2]

virtual void tcpip::Storage::writePacket ( const std::vector< unsigned char > &  packet)
virtual

§ writeShort()

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

§ writeStorage()

§ writeString()

virtual void tcpip::Storage::writeString ( const std::string &  s)
throw (
)
virtual

Referenced by TraCIAPI::POIScope::add(), TraCIAPI::PolygonScope::add(), TraCIAPI::VehicleScope::add(), TraCIServer::commandGetVersion(), TraCIServerAPI_Simulation::commandPositionConversion(), TraCIServerAPI_VehicleType::getVariable(), TraCIAPI::VehicleScope::moveTo(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServer::processSingleSubscription(), TraCIAPI::GUIScope::screenshot(), TraCIAPI::send_commandGetVariable(), TraCIAPI::send_commandMoveToXY(), 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().

§ writeStringList()

§ writeUnsignedByte()

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

Referenced by TraCIAPI::POIScope::add(), TraCIAPI::PolygonScope::add(), TraCIAPI::RouteScope::add(), TraCIAPI::VehicleScope::add(), TraCIServerAPI_Vehicle::commandDistanceRequest(), TraCIServerAPI_Simulation::commandDistanceRequest(), TraCIServer::commandGetVersion(), TraCIServerAPI_Simulation::commandPositionConversion(), TraCIServerAPI_VehicleType::getVariable(), TraCIAPI::VehicleScope::moveTo(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_ArealDetector::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServer::processSingleSubscription(), TraCIAPI::POIScope::remove(), TraCIAPI::PolygonScope::remove(), TraCIAPI::VehicleScope::remove(), TraCIAPI::GUIScope::screenshot(), TraCIAPI::send_commandClose(), TraCIAPI::send_commandGetVariable(), TraCIAPI::send_commandMoveToXY(), 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::VehicleScope::setColor(), TraCIAPI::TrafficLightScope::setCompleteRedYellowGreenDefinition(), TraCIAPI::VehicleTypeScope::setDecel(), TraCIAPI::LaneScope::setDisallowed(), TraCIAPI::VehicleTypeScope::setEmissionClass(), TraCIAPI::VehicleTypeScope::setHeight(), 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::GUIScope::setSchema(), TraCIAPI::PolygonScope::setShape(), TraCIAPI::VehicleTypeScope::setShapeClass(), TraCIAPI::VehicleScope::setSpeed(), TraCIAPI::VehicleTypeScope::setSpeedDeviation(), TraCIAPI::VehicleTypeScope::setSpeedFactor(), TraCIAPI::VehicleTypeScope::setTau(), TraCIAPI::POIScope::setType(), TraCIAPI::PolygonScope::setType(), TraCITestClient::setValueTypeDependant(), TraCIAPI::VehicleTypeScope::setVehicleClass(), TraCIAPI::VehicleTypeScope::setWidth(), TraCIAPI::VehicleScope::slowDown(), TraCIAPI::GUIScope::trackVehicle(), TraCIServer::writeResponseWithLength(), TraCIServer::writeStatusCmd(), TraCIServerAPI_Simulation::writeVehicleStateIDs(), and TraCIServerAPI_Simulation::writeVehicleStateNumber().

Field Documentation

§ bigEndian_

bool tcpip::Storage::bigEndian_
private

Definition at line 48 of file storage.h.

§ iter_

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

Definition at line 45 of file storage.h.

§ store

StorageType tcpip::Storage::store
private

Definition at line 44 of file storage.h.


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