Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Fleet.h
1// trax track library
2// AD 2014
3//
4// "If you want to be a hero
5// well just follow me."
6//
7// John Lennon
8//
9//
10// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
11// Copyright (c) 2019 Marc-Michael Horstmann
12//
13// Permission is hereby granted to any person obtaining a copy of this software
14// and associated source code (the "Software"), to use, view, and study the
15// Software for personal or internal business purposes, subject to the following
16// conditions:
17//
18// 1. Redistribution, modification, sublicensing, or commercial use of the
19// Software is NOT permitted without prior written consent from the copyright
20// holder.
21//
22// 2. The Software is provided "AS IS", without warranty of any kind, express
23// or implied.
24//
25// 3. All copies of the Software must retain this license notice.
26//
27// For further information, please contact: horstmann.marc@trendverlag.de
28
29#pragma once
30
31#include "trax/Configuration.h"
32#include "trax/collections/Collection.h"
33
34#include "trax/Simulated.h"
35//#include "trax/collections/CollectionDecorator.h"
36
37namespace trax{
38
39// struct DepotCollection;
40// struct Materials;
41 struct Train;
42
43
46 struct Fleet : Collection<Fleet,Train>,
48 {
50 static dclspc std::unique_ptr<Fleet> Make() noexcept;
51
52
58 //virtual void Couple( const Bogie::Coupling& coupling ) const = 0;
59
60
67 //virtual Train* GetTrain( const RailRunner* pRailRunner ) const = 0;
68
69
74 //virtual std::shared_ptr<RailRunner> GetAny( const std::string& name ) const = 0;
75
76
79 virtual void EnableTrainGeneration( bool bEnable = true ) noexcept = 0;
80
81
83 virtual bool IsTrainGenerationEnabled() const noexcept = 0;
84
85
86
87
88
92 //virtual std::shared_ptr<DepotCollection> Attach( std::shared_ptr<DepotCollection> pDepotCollection ) = 0;
93
94
96 //virtual DepotCollection* GetDepotCollection() const noexcept = 0;
97
98
109 //virtual void Hit( const Bogie* pBogie, const spat::VectorBundle<Real>& hitData, int filterCombination, const Materials& materialCombination ) = 0;
110 };
111
112
118 //void AddRecursive( Fleet& fleet, std::shared_ptr<RailRunner> pRailRunner );
119
120
125 //void RemoveRecursiveFrom( Fleet& fleet, RailRunner& railRunner );
126
127
134/* class FleetDecorator : public CollectionDecorator<Decorator<Fleet>>{
135 public:
137 typedef Fleet ComponentType;
138
139
142 FleetDecorator( std::shared_ptr<Fleet> pFleet )
143 : CollectionDecorator<Decorator<Fleet>>{ pFleet }
144 {}
145
148
149 const Module* GetModule() const override{
150 return m_pComponent->GetModule();
151 }
152
153 void Update() override{
154 return m_pComponent->Update();
155 }
156
157 void Couple( const Bogie::Coupling& coupling ) const override{
158 return m_pComponent->Couple( coupling );
159 }
160
161 Train* GetTrain( const RailRunner* pRailRunner ) const override{
162 return m_pComponent->GetTrain( pRailRunner );
163 }
164
165 std::shared_ptr<RailRunner> GetAny( const std::string& name ) const override{
166 return m_pComponent->GetAny( name );
167 }
168
169 void EnableDerailing( bool bEnable ) override{
170 return m_pComponent->EnableDerailing( bEnable );
171 }
172
173 bool IsDerailingEnabled() const override{
174 return m_pComponent->IsDerailingEnabled();
175 }
176
177 void EnableCouplingForceLimits( bool bEnable ) override{
178 return m_pComponent->EnableCouplingForceLimits( bEnable );
179 }
180
181 bool IsCouplingForceLimitsEnabled() const override{
182 return m_pComponent->IsCouplingForceLimitsEnabled();
183 }
184
185 std::shared_ptr<DepotCollection> Attach( std::shared_ptr<DepotCollection> pDepotCollection ) override{
186 return m_pComponent->Attach( pDepotCollection );
187 }
188
189 DepotCollection* GetDepotCollection() const noexcept override{
190 return m_pComponent->GetDepotCollection();
191 }
192
193 void Hit( const Bogie* pBogie, const spat::VectorBundle<Real>& hitData, int filterCombination, const Materials& materialCombination ) override{
194 return m_pComponent->Hit(pBogie,hitData,filterCombination,materialCombination);
195 }
197 };*/
198}
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
A Fleet holds Trains and (topmost) Bogies via their common interface RailRunner.
Definition Fleet.h:48
virtual bool IsTrainGenerationEnabled() const noexcept=0
static dclspc std::unique_ptr< Fleet > Make() noexcept
Makes a standard TrackCollection object.
virtual void EnableTrainGeneration(bool bEnable=true) noexcept=0
Enables or disables generation of trains due to decoupling.
A simulated object. Register the object with a scene to get called back for Update,...
Definition Simulated.h:39
A Train is a collection of TrainComponents that are coupled in a row.
Definition Train.h:43