Eclipse SUMO - Simulation of Urban MObility
ParametrisedWrappingCommand< T, S > Class Template Reference

A wrapper for a Command function with parameter. More...

#include <ParametrisedWrappingCommand.h>

Inheritance diagram for ParametrisedWrappingCommand< T, S >:
Collaboration diagram for ParametrisedWrappingCommand< T, S >:

Public Types

typedef SUMOTime(T::* Operation) (SUMOTime, S)
 Type of the function to execute. (with parameter) More...
 

Public Member Functions

void deschedule ()
 Marks this Command as being descheduled. More...
 
bool isDescheduled ()
 whether this command has been descheduled More...
 
 ParametrisedWrappingCommand (T *receiver, const S &param, Operation operation)
 Constructor. More...
 
 ~ParametrisedWrappingCommand ()
 Destructor. More...
 
Derived from Command
SUMOTime execute (SUMOTime currentTime)
 Executes the command. More...
 

Private Attributes

bool myAmDescheduledByParent
 Whether this command was descheduled (is invalid) and shall not be executed. More...
 
Operation myOperation
 The object's operation to perform. More...
 
myParameter
 The parameter. More...
 
T * myReceiver
 The object the action is directed to. More...
 

Detailed Description

template<class T, class S>
class ParametrisedWrappingCommand< T, S >

A wrapper for a Command function with parameter.

See also
WrappingCommand.h

Definition at line 32 of file ParametrisedWrappingCommand.h.

Member Typedef Documentation

◆ Operation

template<class T , class S >
typedef SUMOTime(T::* ParametrisedWrappingCommand< T, S >::Operation) (SUMOTime, S)

Type of the function to execute. (with parameter)

Definition at line 36 of file ParametrisedWrappingCommand.h.

Constructor & Destructor Documentation

◆ ParametrisedWrappingCommand()

template<class T , class S >
ParametrisedWrappingCommand< T, S >::ParametrisedWrappingCommand ( T *  receiver,
const S &  param,
Operation  operation 
)
inline

Constructor.

Parameters
[in]receiverPointer to object of type T that will receive a call to one of it's methods.
[in]parameterThe methods parameter (must be copy-constructable)
[in]operationThe objects' method that will be called on execute()

Definition at line 47 of file ParametrisedWrappingCommand.h.

◆ ~ParametrisedWrappingCommand()

template<class T , class S >
ParametrisedWrappingCommand< T, S >::~ParametrisedWrappingCommand ( )
inline

Destructor.

Definition at line 53 of file ParametrisedWrappingCommand.h.

Member Function Documentation

◆ deschedule()

template<class T , class S >
void ParametrisedWrappingCommand< T, S >::deschedule ( )
inline

Marks this Command as being descheduled.

A simple boolean marker ("myAmDescheduledByParent") is set which prevents this command from being executed.

Definition at line 61 of file ParametrisedWrappingCommand.h.

References ParametrisedWrappingCommand< T, S >::myAmDescheduledByParent.

◆ execute()

template<class T , class S >
SUMOTime ParametrisedWrappingCommand< T, S >::execute ( SUMOTime  currentTime)
inlinevirtual

Executes the command.

If the command is not descheduled, the stored method of the stored instance is called.

Parameters
[in]currentTimeThe current simulation time
Returns
The time after which the command shall be executed again, 0 if this command shall be descheduled.
Exceptions
ProcessErrorDerived actions may throw this exception

Implements Command.

Definition at line 83 of file ParametrisedWrappingCommand.h.

References ParametrisedWrappingCommand< T, S >::myAmDescheduledByParent, ParametrisedWrappingCommand< T, S >::myOperation, ParametrisedWrappingCommand< T, S >::myParameter, and ParametrisedWrappingCommand< T, S >::myReceiver.

◆ isDescheduled()

template<class T , class S >
bool ParametrisedWrappingCommand< T, S >::isDescheduled ( )
inline

whether this command has been descheduled

Definition at line 66 of file ParametrisedWrappingCommand.h.

References ParametrisedWrappingCommand< T, S >::myAmDescheduledByParent.

Field Documentation

◆ myAmDescheduledByParent

template<class T , class S >
bool ParametrisedWrappingCommand< T, S >::myAmDescheduledByParent
private

Whether this command was descheduled (is invalid) and shall not be executed.

Definition at line 105 of file ParametrisedWrappingCommand.h.

Referenced by ParametrisedWrappingCommand< T, S >::deschedule(), ParametrisedWrappingCommand< T, S >::execute(), and ParametrisedWrappingCommand< T, S >::isDescheduled().

◆ myOperation

template<class T , class S >
Operation ParametrisedWrappingCommand< T, S >::myOperation
private

The object's operation to perform.

Definition at line 102 of file ParametrisedWrappingCommand.h.

Referenced by ParametrisedWrappingCommand< T, S >::execute().

◆ myParameter

template<class T , class S >
S ParametrisedWrappingCommand< T, S >::myParameter
private

The parameter.

Definition at line 99 of file ParametrisedWrappingCommand.h.

Referenced by ParametrisedWrappingCommand< T, S >::execute().

◆ myReceiver

template<class T , class S >
T* ParametrisedWrappingCommand< T, S >::myReceiver
private

The object the action is directed to.

Definition at line 96 of file ParametrisedWrappingCommand.h.

Referenced by ParametrisedWrappingCommand< T, S >::execute().


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