VANET Simulator
 All Classes Functions Variables
Public Member Functions | List of all members
vanetsim.scenario.KnownMessages Class Reference

Public Member Functions

 KnownMessages (Vehicle vehicle)
 
synchronized void addMessage (Message message, boolean doExecute, boolean doForward)
 
synchronized void deleteForwardMessage (int position, boolean addToOld)
 
synchronized void deleteAllForwardMessages (boolean addToOld)
 
synchronized void deleteAllFloodingForwardMessages (boolean addToOld)
 
void processMessages ()
 
void checkOutdatedMessages (boolean addToOld)
 
Message[] getForwardMessages ()
 
boolean hasNewMessages ()
 
int getSize ()
 
int getOldMessagesSize ()
 
int getFailedForwardCount ()
 
void clear ()
 

Detailed Description

This class stores various messages in multiple separate arrays:

The arrays are not resized on every operation. Deletion of an element only changes the corresponding size variable, addition only leads to a larger array if there's not enough space left.

Constructor & Destructor Documentation

vanetsim.scenario.KnownMessages.KnownMessages ( Vehicle  vehicle)
inline

Constructor.

Parameters
vehiclethe vehicle this data structure belongs to

Member Function Documentation

synchronized void vanetsim.scenario.KnownMessages.addMessage ( Message  message,
boolean  doExecute,
boolean  doForward 
)
inline

Adds a message.

Parameters
messagethe message
doExecutetrue if you want the message to be executed, else false
doForwardtrue if you want the message to be forwarded, else false
void vanetsim.scenario.KnownMessages.checkOutdatedMessages ( boolean  addToOld)
inline

Checks for outdated messages and deletes them. Note that this function is not synchronized! You need to make sure that no other thread uses any function on this object at the same time!

Parameters
addToOldtrue to add all to outdated forward messages to the old messages, else false
void vanetsim.scenario.KnownMessages.clear ( )
inline

Clears everything from this data structure.

synchronized void vanetsim.scenario.KnownMessages.deleteAllFloodingForwardMessages ( boolean  addToOld)
inline

Deletes all forward messages which are in flooding/broadcast mode and optionally adds them to the old messages.

Parameters
addToOldtrue to add the removed flooding messages to the old messages, else false
synchronized void vanetsim.scenario.KnownMessages.deleteAllForwardMessages ( boolean  addToOld)
inline

Deletes all forward messages and optionally adds them to the old messages.

Parameters
addToOldtrue to add all to the old messages, else false
synchronized void vanetsim.scenario.KnownMessages.deleteForwardMessage ( int  position,
boolean  addToOld 
)
inline

Deletes a forward message and optionally adds it to the old messages.

Parameters
positionthe position
addToOldtrue to add it to the old messages, else false
int vanetsim.scenario.KnownMessages.getFailedForwardCount ( )
inline

Gets the amount of messages which failed to be forwarded.

Returns
the size
Message [] vanetsim.scenario.KnownMessages.getForwardMessages ( )
inline

Gets all messages which shall be forwarded. Note that there might be garbage at the end so use the getSize()-methode to get the real size!

Returns
the array with all messages
int vanetsim.scenario.KnownMessages.getOldMessagesSize ( )
inline

Gets the amount of old messages stored.

Returns
the size
int vanetsim.scenario.KnownMessages.getSize ( )
inline

Gets the amount of known messages stored (=forward messages).

Returns
the size
boolean vanetsim.scenario.KnownMessages.hasNewMessages ( )
inline

Returns if there are news messages which need to be processed.

Returns
true if there are new messages, else false
void vanetsim.scenario.KnownMessages.processMessages ( )
inline

Process messages. Note that this function is not synchronized! You need to make sure that no other thread uses any function on this object at the same time!


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