Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
trax::VelocityControl Struct Referenceabstract

Interface for signals that control the velocity of trains. More...

#include <C:/Trend/Development/Trax3/Code/trax/Signal.h>

Inheritance diagram for trax::VelocityControl:

Public Member Functions

virtual bool AffectTravelVelocity (Status status, bool bTravel)=0
 Set if the signal should affect the velocity permanently.
virtual bool AffectTravelVelocity (Status status) const =0
virtual void SetVelocity (Status status, Velocity velocityMin, Velocity velocityMax)=0
 Set the target velocities.
virtual void SetVelocity (Status status, Velocity velocity)=0
 Set the target velocities.
virtual void VelocityMin (Status status, Velocity velocityMin)=0
 Sets the minimum velocity.
virtual void VelocityMax (Status status, Velocity velocityMax)=0
 Sets the maximum velocity.
virtual Velocity VelocityMin (Status status) const =0
 Get the minimum target velocity.
virtual Velocity VelocityMax (Status status) const =0
 Get the maximum target velocity.
virtual bool IsValidState (Status status) const =0
virtual void Remove (Status status)=0
 Removes thje signal state with index idx.
virtual void Clear ()=0
 Removes all signal states.
virtual void StopDistance (Length distance)=0
 Sets a distance from the far edge to stop at.
virtual Length StopDistance () const =0
virtual JackJackOnVelocity (Status status)=0
virtual MultiPlugPlugToVelocity (Status status)=0
Public Member Functions inherited from trax::Signal
virtual const char * TypeName () const noexcept=0
virtual Status Set (Status status, bool pulse=true)=0
 Set the Signal's setting.
virtual void Toggle (bool pulse=true)=0
 Sets the signal state to the next setting.
virtual Status Get () const =0
 Get the Signal's setting.
virtual int CountStatus () const =0
 Gets the number of signal status the signal provides.
virtual void Attach (TrackBuilder *pTrackBuilder) noexcept=0
 Attaches the Signal to a TrackBuilder.
virtual TrackBuilderTrackAttached () const =0
virtual void GetTrackRange (TrackRange &trackRange) const =0
 Gets the range on the track on wich the signal is effective.
virtual Location GetLocation () const =0
 Creates a Location for the signals reference point on the tracks.
virtual MultiPlugPlugToToggle ()=0
virtual JackJackOnChange ()=0
virtual JackJackOn (Status status)=0
 Gets a Jack that pulses its Plug if the specified Status is set.
virtual JackJackOnChangeTo (Status status)=0
 Gets a Jack that pulses its Plug if the specified Status is set and was not set before.
virtual MultiPlugPlugTo (Status status)=0
 Gets a Plug that switches to the specified Status.
virtual void RegisterSockets (SocketRegistry &modul)=0
 Registers all the Plugs with the module and supplies the Jacks with plug ids for connecting.
virtual void UnregisterSockets (SocketRegistry &modul)=0
 Removes all references to Plugs and Jacks from the module.
Public Member Functions inherited from trax::Identified< Signal >
virtual const std::string & Reference (const std::string &name) const=0
 Gets a reference that was set for this object by name.
virtual const std::vector< char const * > & ReferenceNames (const std::string &namePart) const=0
 Searches for all reference names that countain namePart as substring in the name.
virtual IDType ID () const noexcept=0
 Identified (const Identified &)=delete
Identified & operator= (const Identified &)=delete

Static Public Member Functions

static dclspc std::unique_ptr< VelocityControlMake () noexcept
 Makes a VelocityControl object.

Additional Inherited Members

Public Types inherited from trax::Signal
enum class  Status {
  none = -1 , stop = 0 , clear = 1 , slow ,
  velocity0 = stop , velocity1 = clear , velocity2 = slow , velocity3 ,
  velocity4 , velocity5 , velocity6 , velocity7 ,
  velocity8 , velocity9 , velocity10 , velocity11 ,
  velocity12 , velocityMax = velocity12 , caution , doors_open ,
  doors_close , uncouple , lights_on , jump ,
  count , toggle , change
}
 Various Signal status settings.

Detailed Description

Interface for signals that control the velocity of trains.

A VelocityControl can have several control states; each velocity control maintains a minimum and a maximum velocity, wich a train might feel compelled to maintain if in the signal area.

Member Function Documentation

◆ AffectTravelVelocity() [1/2]

virtual bool trax::VelocityControl::AffectTravelVelocity ( Status status) const
pure virtual
Returns
true if the signal control state affects the travel velocity.
Exceptions
std::invalid_argumentif status is not a velocity signal status.
std::out_of_rangeif status is not a control state, prefiously set.

◆ AffectTravelVelocity() [2/2]

virtual bool trax::VelocityControl::AffectTravelVelocity ( Status status,
bool bTravel )
pure virtual

Set if the signal should affect the velocity permanently.

A train maintains a separate travel velocity and a target velocity. If the train enters a signal's area its target velocity will get influenced, but as soon as it leaves the area the target velocity will get set back to travel velocity. The default setting is false.

Parameters
bTraveltrue if the travel velocity should be affected, false if not.
statusVelocity status of signal control.
Returns
The previous setting.
Exceptions
std::invalid_argumentif status is not a velocity signal status.
std::out_of_rangeif status is not a control state, prefiously set.

◆ IsValidState()

virtual bool trax::VelocityControl::IsValidState ( Status status) const
pure virtual
Returns
true if the signal state for status was defined before.

◆ JackOnVelocity()

virtual Jack & trax::VelocityControl::JackOnVelocity ( Status status)
pure virtual

Gets a Jack that pulses its Plug if the signal is set to its idx'es speed control state.

Parameters
statusVelocity status of signal control.
Exceptions
std::invalid_argumentif status is not a velocity signal status.
std::out_of_rangeif status is not a control state, prefiously set.

◆ PlugToVelocity()

virtual MultiPlug & trax::VelocityControl::PlugToVelocity ( Status status)
pure virtual

Gets a Plug that sets the signal to its idx'es speed control state.

Parameters
statusVelocity status of signal control.
Exceptions
std::invalid_argumentif status is not a velocity signal status.
std::out_of_rangeif status is not a control state, prefiously set.

◆ Remove()

virtual void trax::VelocityControl::Remove ( Status status)
pure virtual

Removes thje signal state with index idx.

Parameters
statusVelocity status of signal control.
Exceptions
std::invalid_argumentif status is not a velocity signal status.

◆ SetVelocity() [1/2]

virtual void trax::VelocityControl::SetVelocity ( Status status,
Velocity velocity )
pure virtual

Set the target velocities.

Set the velocities for one control state to the same value both. It creates the control state if not created yet. This will yield a control that restricts the velocity of a train to a specific value; e.g. 0 for a stop sign.

Parameters
velocityVelocity for the train to maintain.
statusVelocity status of signal control.
Exceptions
std::invalid_argumentif status is not a velocity signal status.

◆ SetVelocity() [2/2]

virtual void trax::VelocityControl::SetVelocity ( Status status,
Velocity velocityMin,
Velocity velocityMax )
pure virtual

Set the target velocities.

Set the velocities for one control state. It creates the control state if not created yet.

Parameters
statusVelocity status of signal control.
velocityMinLower limit of the velocity.
velocityMaxUpper limit of the velocity.
Exceptions
std::invalid_argumentif status is not a velocity signal status.
std::invalid_argumentif velocityMin > velocityMax.

◆ StopDistance() [1/2]

virtual Length trax::VelocityControl::StopDistance ( ) const
pure virtual
Returns
The distance from the far edge to stop at.

◆ StopDistance() [2/2]

virtual void trax::VelocityControl::StopDistance ( Length distance)
pure virtual

Sets a distance from the far edge to stop at.

Parameters
distanceDistance to stop earlyer than the far edge.

◆ VelocityMax() [1/2]

virtual Velocity trax::VelocityControl::VelocityMax ( Status status) const
pure virtual

Get the maximum target velocity.

Parameters
statusVelocity status of signal control.
Returns
The maximum velocity setting for status.
Exceptions
std::invalid_argumentif status is not a velocity signal status.
std::out_of_rangeif status is not a control state, prefiously set.

◆ VelocityMax() [2/2]

virtual void trax::VelocityControl::VelocityMax ( Status status,
Velocity velocityMax )
pure virtual

Sets the maximum velocity.

The minimum velocity will be set to zero. It creates the control state if not created yet.

Parameters
velocityMaxUpper limit of the velocity.
statusVelocity status of signal control.
Exceptions
std::invalid_argumentif status is not a velocity signal status.

◆ VelocityMin() [1/2]

virtual Velocity trax::VelocityControl::VelocityMin ( Status status) const
pure virtual

Get the minimum target velocity.

Parameters
statusVelocity status of signal control.
Returns
The minimum velocity setting for status.
Exceptions
std::invalid_argumentif status is not a velocity signal status.
std::out_of_rangeif status is not a control state, previously created.

◆ VelocityMin() [2/2]

virtual void trax::VelocityControl::VelocityMin ( Status status,
Velocity velocityMin )
pure virtual

Sets the minimum velocity.

The maximum velocity will be set to an infinite value. It creates the control state if not created yet.

Parameters
velocityMinLower limit of the velocity.
statusVelocity status of signal control.
Exceptions
std::invalid_argumentif status is not a velocity signal status.

The documentation for this struct was generated from the following file:
  • C:/Trend/Development/Trax3/Code/trax/Signal.h