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

A Connector rearranges the connections between several track ends. More...

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

Inheritance diagram for trax::Connector:

Public Member Functions

virtual ConnectorType GetConnectorType () const noexcept=0
virtual const char * TypeName () const noexcept=0
virtual bool IsValid () const noexcept=0
 Checks whether the connector is valid.
virtual void Toggle (bool pulse=true)=0
 Sets the connector to the next setting.
virtual void Set (const Track &trackA, Track::EndType trackendA, const Track &trackB, Track::EndType trackendB, bool pulse=true)=0
 Sets the Connector to the setting that connects the two track ends.
virtual void Disconnect ()=0
 Disconnects all track ends from each other.
virtual std::pair< std::shared_ptr< TrackBuilder >, Track::EndTypeSlot (int slot) const noexcept=0
virtual int Slot (const Track &track, Track::EndType trackend) const =0
virtual int CntSlots () const noexcept=0
virtual void SwapSlots (int slotA, int slotB)=0
 Exchanges the content of the two slots.
virtual bool IsComplete () const =0
virtual bool Check (std::ostream &os, Length e_distance=epsilon__length, Angle e_kink=epsilon__angle, Angle e_twist=epsilon__angle) const noexcept=0
 Checks the connector for consistency.
virtual void Clear (int slot)=0
 clears the slot with index slot.
virtual void Clear ()=0
 Releases all the tracks from the slots.
virtual void GetCenter (spat::Frame< Length, One > &center) const =0
 Gets the center of the tracks the connector is connecting.
virtual MultiPlugPlugToToggle () noexcept=0
virtual const MultiPlugPlugToToggle () const noexcept=0
virtual JackJackOnChange () noexcept=0
virtual const JackJackOnChange () const noexcept=0
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.
virtual void UserData (ConnectorUserData *pData) noexcept=0
 Sets a pointer to user provided data.
virtual ConnectorUserData * UserData () const noexcept=0
Populate the Connector
Parameters
slotZero based index of the slot.
pTrackPointer to track to attach to the slot. If nullptr, the slot gets released.
trackendDenotes the tracks end.
connectAnonymousIf true and if the track end is already member of a Connector, it will not get deconnected from the first Connector, but be ruled by both.
Exceptions
std::out_of_rangeIf the slot id is not available for the connector.
std::logic_errorIf the trackend is not applicable for beeing asssigned to the slot, e.g because it belongs to a track already assigned to some other slot in an impossible way.
Returns
The slot's id that got populated, or -1 if there wasn't a free slot.
virtual int Slot (int slot, std::shared_ptr< TrackBuilder > pTrack, Track::EndType trackend, bool connectAnonymous=false)=0
 Populates a slot with a tracks end.
virtual int Slot (std::shared_ptr< TrackBuilder > pTrack, Track::EndType trackend, bool connectAnonymous=false)=0
 Populates the slot with the smallest ID that is still unpopulated.
Public Member Functions inherited from trax::Identified< Connector >
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

Detailed Description

A Connector rearranges the connections between several track ends.

Tracks only have one connection at each end. A connector will reconnect these connections according to its setting.

Member Function Documentation

◆ Check()

virtual bool trax::Connector::Check ( std::ostream & os,
Length e_distance = epsilon__length,
Angle e_kink = epsilon__angle,
Angle e_twist = epsilon__angle ) const
pure virtualnoexcept

Checks the connector for consistency.

Certain track ends in slots are supposed to align with each other. The method checks the the degree of general smoothness of the track ends that get connected by the connector.

Parameters
osStream to write the error messages to.
e_distanceAllowed deviation for the distance between the tracks ends.
e_kinkAllowed deviation for the kink angle between the tracks.
e_twistAllowed deviation for the twist angle between the tracks.
Returns
True if the connector is consistent with respect to the given tolerances.

◆ Clear()

virtual void trax::Connector::Clear ( int slot)
pure virtual

clears the slot with index slot.

Parameters
slotZero based index of the slot to clear. The method does nothing, if the slot is not existing.

◆ CntSlots()

virtual int trax::Connector::CntSlots ( ) const
pure virtualnoexcept
Returns
The number of slots, the connector provides.

◆ GetConnectorType()

virtual ConnectorType trax::Connector::GetConnectorType ( ) const
pure virtualnoexcept
Returns
Type that implements this interface.

◆ IsComplete()

virtual bool trax::Connector::IsComplete ( ) const
pure virtual
Returns
True if all the track slots are populated.

◆ IsValid()

virtual bool trax::Connector::IsValid ( ) const
pure virtualnoexcept

Checks whether the connector is valid.

Returns
true if the connector is valid.

◆ JackOnChange() [1/2]

virtual const Jack & trax::Connector::JackOnChange ( ) const
pure virtualnoexcept
Returns
A Jack that pulses its Plug if the connector setting is changed.

◆ JackOnChange() [2/2]

virtual Jack & trax::Connector::JackOnChange ( )
pure virtualnoexcept
Returns
A Jack that pulses its Plug if the connector setting is changed.

◆ PlugToToggle() [1/2]

virtual const MultiPlug & trax::Connector::PlugToToggle ( ) const
pure virtualnoexcept
Returns
A Plug to trigger the toggle method.

◆ PlugToToggle() [2/2]

virtual MultiPlug & trax::Connector::PlugToToggle ( )
pure virtualnoexcept
Returns
A Plug to trigger the toggle method.

◆ Set()

virtual void trax::Connector::Set ( const Track & trackA,
Track::EndType trackendA,
const Track & trackB,
Track::EndType trackendB,
bool pulse = true )
pure virtual

Sets the Connector to the setting that connects the two track ends.

Exceptions
std::invalid_argumentif one of the two track ends is not in a slot.
std::logic_error,ifthe two ends can not get connected by the Connector.

Implemented in trax::DoubleSlipSwitch, trax::NarrowSwitch, and trax::SingleSlipSwitch.

◆ Slot() [1/2]

virtual int trax::Connector::Slot ( const Track & track,
Track::EndType trackend ) const
pure virtual
Returns
the slot index, the track end is registered with or -1 if the track is not registered.

◆ Slot() [2/2]

virtual std::pair< std::shared_ptr< TrackBuilder >, Track::EndType > trax::Connector::Slot ( int slot) const
pure virtualnoexcept
Parameters
slotZero based index of the slot.
Returns
The track assigned to slot slot and the assigned end type.

◆ SwapSlots()

virtual void trax::Connector::SwapSlots ( int slotA,
int slotB )
pure virtual

Exchanges the content of the two slots.

Exceptions
std::out_of_rangeIf the slot id is not available for the connector.

◆ Toggle()

virtual void trax::Connector::Toggle ( bool pulse = true)
pure virtual

Sets the connector to the next setting.

Parameters
pulseIf true the call will trigger a pulse on a plug if plugged into an appropriate jack.

◆ TypeName()

virtual const char * trax::Connector::TypeName ( ) const
pure virtualnoexcept
Returns
the name for the object type that implements this interface.

◆ UserData() [1/2]

virtual ConnectorUserData * trax::Connector::UserData ( ) const
pure virtualnoexcept
Returns
User provided data.

◆ UserData() [2/2]

virtual void trax::Connector::UserData ( ConnectorUserData * pData)
pure virtualnoexcept

Sets a pointer to user provided data.

Define ConnectorUserData to specify your data types.


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