Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
trax::TrackSystemDecorator Class Reference

A decorator for TrackSystems. More...

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

Inheritance diagram for trax::TrackSystemDecorator:

Public Types

typedef TrackSystem ComponentType
 Type of the decoree.
Public Types inherited from trax::CollectionDecorator< SimulatedDecorator< ObjectIDDecorator< Decorator< TrackSystem > > > >
typedef SimulatedDecorator< ObjectIDDecorator< Decorator< TrackSystem > > >::InterfaceType InterfaceType
typedef SimulatedDecorator< ObjectIDDecorator< Decorator< TrackSystem > > >::collection_type collection_type
typedef SimulatedDecorator< ObjectIDDecorator< Decorator< TrackSystem > > >::value_type value_type
Public Types inherited from trax::SimulatedDecorator< ObjectIDDecorator< Decorator< TrackSystem > > >
typedef ObjectIDDecorator< Decorator< TrackSystem > >::InterfaceType InterfaceType
 Type of the interface the decorator is decorating.
Public Types inherited from trax::ObjectIDDecorator< Decorator< TrackSystem > >
typedef Decorator< TrackSystem >::InterfaceType InterfaceType
 Type of the interface the decorator is decorating.
Public Types inherited from trax::Decorator< TrackSystem >
typedef TrackSystem InterfaceType
 Type of the interface the decorator is decorating.
Public Types inherited from trax::Collection< TrackSystem, TrackBuilder >
using iterator
using const_iterator
using collection_type
using value_type

Public Member Functions

 TrackSystemDecorator (std::shared_ptr< TrackSystem > pTrackSystem)
 Constructs the decorator.
Forwarding

TrackSystem member function forwarding.

std::shared_ptr< TrackSystemThis () const noexcept override
 Gets a shared pointer to this.
IDType CreateCollection (IDType id=0) override
 Creates a TrackCollection with the supplied id.
void RemoveCollection (IDType id) override
 Removes the TrackCollection with the specified id.
void SetCollectionFrame (IDType id, const spat::Frame< Length, One > &frame) override
 Sets the frame of reference for a TrackCollection.
const spat::Frame< Length, One > & GetCollectionFrame (IDType id) const override
 Gets the frame of reference for a TrackCollection.
IDType SetActiveCollection (IDType id) override
 Sets a TrackCollection to be the active one.
IDType GetActiveCollection () const override
std::shared_ptr< TrackCollectionContainerGetCollectionContainer () const override
std::shared_ptr< TrackCollectionContainerSetTrackCollectionContainer (std::shared_ptr< TrackCollectionContainer > pTrackCollectionContainer) override
std::shared_ptr< ConnectorCollectionSetConnectorCollection (std::shared_ptr< ConnectorCollection > pConnectorCollection) override
 Attaches a ConnectorCollection to the track system.
ConnectorCollectionGetConnectorCollection () const override
void Couple (std::pair< std::shared_ptr< TrackBuilder >, Track::EndType > trackEnd1, std::pair< std::shared_ptr< TrackBuilder >, Track::EndType > trackEnd2) const override
void Couple (const Track::Coupling &coupling, bool bUncoupledOnly=false) const override
std::shared_ptr< SensorGetSensor (IDType id, TrackLocation *pTrackLocation) const override
Length CalculateGapSize (const Track::End &theOne, const Track::End &theOther) const override
std::vector< Track::EndGetUncoupledIn (const spat::Sphere< Length > &area) const override
 Searches for a free, uncoupled track end in the area.
void Connection (Track::Coupling &coupling) const override
 Completes the coupling.
void Connection (const Track::End &end, Track::End &coupled) const override
void Connection (const Track::Coupling &couplings, Track::Coupling &active) const override
 Writes the coupled tracks data of the trackends in couplings to active.
void DeCoupleAll () override
 Uncouples all the Tracks in the TrackSystem from each other.
Public Member Functions inherited from trax::CollectionDecorator< SimulatedDecorator< ObjectIDDecorator< Decorator< TrackSystem > > > >
 CollectionDecorator (std::shared_ptr< InterfaceType > pComponent)
 Decorator constructor.
const char * TypeName () const noexcept override
IDType Add (std::shared_ptr< value_type > pItem) override
IDType AddRelaxed (std::shared_ptr< value_type > pItem) override
bool Remove (value_type *pItem, bool zeroIDs=false) override
int Take (collection_type &ct) override
void Clear () override
int Count () const override
collection_type::iterator begin () override
collection_type::const_iterator cbegin () const override
collection_type::iterator end () override
collection_type::const_iterator cend () const override
std::shared_ptr< value_type > GetFirst () const override
std::shared_ptr< value_type > GetNext (const std::shared_ptr< value_type > &pItem) const override
std::shared_ptr< value_type > GetLast () const override
std::shared_ptr< value_type > GetPrevious (const std::shared_ptr< value_type > &pItem) const override
std::shared_ptr< value_type > Get (IDType id) const override
void PushActive (IDType id) override
void PopActive () override
std::shared_ptr< value_type > GetActive () const override
bool IsMember (const value_type &item) const override
void ShiftIDs (int offset) override
IDType MaxID () const override
IDType MinID () const override
Public Member Functions inherited from trax::SimulatedDecorator< ObjectIDDecorator< Decorator< TrackSystem > > >
 SimulatedDecorator (std::shared_ptr< InterfaceType > pComponent)
 Decorator constructor.
bool Start (Scene &scene) override
void Idle () override
void Update (Time dt) override
void Pause () noexcept override
void Resume () noexcept override
void Stop () noexcept override
Public Member Functions inherited from trax::ObjectIDDecorator< Decorator< TrackSystem > >
 ObjectIDDecorator (std::shared_ptr< InterfaceType > pComponent)
 Decorator constructor.
const std::string & Reference (const std::string &name) const override
const std::vector< char const * > & ReferenceNames (const std::string &namePart) const override
IDType ID () const noexcept override
 ObjectIDDecorator member function forwarding.
Public Member Functions inherited from trax::Decorator< TrackSystem >
Decorator & operator= (const Decorator &)=delete
InterfaceTypeComponent () const noexcept
 Decorator member function forwarding.
Public Member Functions inherited from trax::TrackSystem
virtual void CoupleAll (Length maxDistance=1_m, Angle maxKink=pi, bool bSilent=true)=0
 Couples all open ends in the track system, if they are closer than maxDistance.
Public Member Functions inherited from trax::Collection< TrackSystem, TrackBuilder >
virtual bool IsValid () const noexcept=0
 Checks whether the elements in this collection are valid.
virtual IDType Add (std::shared_ptr< TrackBuilder > pValue_Type)=0
 Adds an element to the container and returns its index in the container.
virtual IDType AddRelaxed (std::shared_ptr< TrackBuilder > pTraxType)=0
 Adds an element to the container and returns its index in the container. Does not throw.
virtual bool Remove (TrackBuilder *pValue_Type, bool zeroIDs=false)=0
 Removes an element from this container.
virtual int Take (TrackSystem &collection_Type)=0
 Moves all the items from another container to this container.
virtual std::shared_ptr< TrackBuilderGetNext (const std::shared_ptr< TrackBuilder > &pValue_Type) const=0
virtual std::shared_ptr< TrackBuilderGetPrevious (const std::shared_ptr< TrackBuilder > &pValue_Type) const=0
 Collection (const Collection &)=delete
Collection & operator= (const Collection &)=delete
virtual bool IsMember (const value_type &item) const=0
Public Member Functions inherited from trax::Identified< TrackSystem >
 Identified (const Identified &)=delete
Identified & operator= (const Identified &)=delete

Additional Inherited Members

Static Public Member Functions inherited from trax::TrackSystem
static dclspc std::shared_ptr< TrackSystemMake () noexcept
 Makes a standard TrackSystem object.
static dclspc std::shared_ptr< TrackSystemMake (std::unique_ptr< TrackCollectionContainer > pTrackCollectionContainer) noexcept
static dclspc std::shared_ptr< TrackSystemMake (std::unique_ptr< TrackCollectionContainer > pTrackCollectionContainer, std::unique_ptr< ConnectorCollection > pConnectorCollection) noexcept
Protected Member Functions inherited from trax::Decorator< TrackSystem >
void SetDecorator (InterfaceType *pDecorator) noexcept override
Protected Attributes inherited from trax::Decorator< TrackSystem >
std::shared_ptr< InterfaceTypem_pComponent
 Pointer to decorated object.
Protected Attributes inherited from trax::Collection< TrackSystem, TrackBuilder >
friend Decorator< Collection_Type >

Detailed Description

A decorator for TrackSystems.

With trax decorators can get used to augment trax objects with additional behaviour and services. Derive your own class from the decorator and overwrite its methods. Create your decorator with the trax object and supply it to the library instead of the original object. In case of a track system one might build e.g. graphics data for a track that gets added to a TrackSystem and destroy it if the track gets removed.

Constructor & Destructor Documentation

◆ TrackSystemDecorator()

trax::TrackSystemDecorator::TrackSystemDecorator ( std::shared_ptr< TrackSystem > pTrackSystem)
inline

Constructs the decorator.

Parameters
pTrackSystemPointer to object to decorate.

Member Function Documentation

◆ CalculateGapSize()

Length trax::TrackSystemDecorator::CalculateGapSize ( const Track::End & theOne,
const Track::End & theOther ) const
inlineoverridevirtual
Returns
the distance between the two track ends.

Implements trax::TrackSystem.

◆ Connection() [1/3]

void trax::TrackSystemDecorator::Connection ( const Track::Coupling & couplings,
Track::Coupling & active ) const
inlineoverridevirtual

Writes the coupled tracks data of the trackends in couplings to active.

Parameters
couplingsTwo track ends.
activeCoupled track end data for the track ends in couplings.

Implements trax::TrackSystem.

◆ Connection() [2/3]

void trax::TrackSystemDecorator::Connection ( const Track::End & end,
Track::End & coupled ) const
inlineoverridevirtual

Implements trax::TrackSystem.

◆ Connection() [3/3]

void trax::TrackSystemDecorator::Connection ( Track::Coupling & coupling) const
inlineoverridevirtual

Completes the coupling.

Parameters
couplingA track coupling with one of its track ids set to 0. This will be completed by the correct connection.

Implements trax::TrackSystem.

◆ Couple() [1/2]

void trax::TrackSystemDecorator::Couple ( const Track::Coupling & coupling,
bool bUncoupledOnly = false ) const
inlineoverridevirtual

Implements trax::TrackSystem.

◆ Couple() [2/2]

void trax::TrackSystemDecorator::Couple ( std::pair< std::shared_ptr< TrackBuilder >, Track::EndType > trackEnd1,
std::pair< std::shared_ptr< TrackBuilder >, Track::EndType > trackEnd2 ) const
inlineoverridevirtual

Implements trax::TrackSystem.

◆ CreateCollection()

IDType trax::TrackSystemDecorator::CreateCollection ( IDType id = 0)
inlineoverridevirtual

Creates a TrackCollection with the supplied id.

Parameters
idid for the new TrackCollection or 0 if one should be made automatically.
Returns
id of the new TrackCollection.

Implements trax::TrackSystem.

◆ DeCoupleAll()

void trax::TrackSystemDecorator::DeCoupleAll ( )
inlineoverridevirtual

Uncouples all the Tracks in the TrackSystem from each other.

This is needed since the coupled tracks hold shared pointer to each other.

Implements trax::TrackSystem.

◆ GetActiveCollection()

IDType trax::TrackSystemDecorator::GetActiveCollection ( ) const
inlineoverridevirtual
Returns
The id of the active TrackCollection.

Implements trax::TrackSystem.

◆ GetCollectionContainer()

std::shared_ptr< TrackCollectionContainer > trax::TrackSystemDecorator::GetCollectionContainer ( ) const
inlineoverridevirtual
Returns
A pointer to the TrackCollectionContainer object that holds the TrackCollection objects.

Implements trax::TrackSystem.

◆ GetCollectionFrame()

const spat::Frame< Length, One > & trax::TrackSystemDecorator::GetCollectionFrame ( IDType id) const
inlineoverridevirtual

Gets the frame of reference for a TrackCollection.

Implements trax::TrackSystem.

◆ GetConnectorCollection()

ConnectorCollection * trax::TrackSystemDecorator::GetConnectorCollection ( ) const
inlineoverridevirtual
Returns
A pointer to the ConnectorCollection attached to this TrackSystem.

Implements trax::TrackSystem.

◆ GetSensor()

std::shared_ptr< Sensor > trax::TrackSystemDecorator::GetSensor ( IDType id,
TrackLocation * pTrackLocation ) const
inlineoverridevirtual
Returns
a pointer to the sensor with the respective id.

Implements trax::TrackSystem.

◆ GetUncoupledIn()

std::vector< Track::End > trax::TrackSystemDecorator::GetUncoupledIn ( const spat::Sphere< Length > & area) const
inlineoverridevirtual

Searches for a free, uncoupled track end in the area.

Implements trax::TrackSystem.

◆ RemoveCollection()

void trax::TrackSystemDecorator::RemoveCollection ( IDType id)
inlineoverridevirtual

Removes the TrackCollection with the specified id.

Parameters
idof the TrackCollection to remove.

Implements trax::TrackSystem.

◆ SetActiveCollection()

IDType trax::TrackSystemDecorator::SetActiveCollection ( IDType id)
inlineoverridevirtual

Sets a TrackCollection to be the active one.

Implements trax::TrackSystem.

◆ SetCollectionFrame()

void trax::TrackSystemDecorator::SetCollectionFrame ( IDType id,
const spat::Frame< Length, One > & frame )
inlineoverridevirtual

Sets the frame of reference for a TrackCollection.

Implements trax::TrackSystem.

◆ SetConnectorCollection()

std::shared_ptr< ConnectorCollection > trax::TrackSystemDecorator::SetConnectorCollection ( std::shared_ptr< ConnectorCollection > pConnectorCollection)
inlineoverridevirtual

Attaches a ConnectorCollection to the track system.

Returns
The old attached connector collection.

Implements trax::TrackSystem.

◆ SetTrackCollectionContainer()

std::shared_ptr< TrackCollectionContainer > trax::TrackSystemDecorator::SetTrackCollectionContainer ( std::shared_ptr< TrackCollectionContainer > pTrackCollectionContainer)
inlineoverridevirtual

Implements trax::TrackSystem.

◆ This()

std::shared_ptr< TrackSystem > trax::TrackSystemDecorator::This ( ) const
inlineoverridevirtualnoexcept

Gets a shared pointer to this.

Implements trax::TrackSystem.


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