Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
RollingStock.h
1// trax track library
2// AD 2023
3//
4// "the resolution of all the fruitless searches"
5//
6// Peter Gabriel
7//
8//
9// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
10// Copyright (c) 2019 Marc-Michael Horstmann
11//
12// Permission is hereby granted to any person obtaining a copy of this software
13// and associated source code (the "Software"), to use, view, and study the
14// Software for personal or internal business purposes, subject to the following
15// conditions:
16//
17// 1. Redistribution, modification, sublicensing, or commercial use of the
18// Software is NOT permitted without prior written consent from the copyright
19// holder.
20//
21// 2. The Software is provided "AS IS", without warranty of any kind, express
22// or implied.
23//
24// 3. All copies of the Software must retain this license notice.
25//
26// For further information, please contact: horstmann.marc@trendverlag.de
27
28#pragma once
29
30#include "TrainComponent.h"
31
32#include <memory>
33
34namespace trax{
35
36 struct Bogie;
37 struct Simulator;
38 struct Train;
39 struct WheelFrame;
40 struct SimulatorTrain;
41
42
46
48 static dclspc std::shared_ptr<RollingStock> Make() noexcept;
49
50
52 virtual std::shared_ptr<RollingStock> ThisRollingStock() const noexcept = 0;
53
54
66 virtual bool Attach( Bogie& bogie ) noexcept = 0;
67
68
70 virtual int GetNumberOfBogies() const noexcept = 0;
71
72
80 virtual Bogie& GetBogie( int idx ) const = 0;
81
82
84 virtual int GetNumberOfTopmostParents() const noexcept = 0;
85
86
95 virtual Bogie& GetTopmostParent( int idx = 0 ) const = 0;
96
97
99 virtual int GetNumberOfWheelFrames() const noexcept = 0;
100
101
107 virtual WheelFrame& GetWheelFrame( int idx ) const = 0;
108
109
110 //Coupling:
111
112
117 virtual std::pair<std::shared_ptr<RollingStock>,EndType> GetCoupledRollingStock( EndType end ) const noexcept = 0;
118
119
120 // Jacks 'N Plugs:
121
122
125 virtual Jack& JackOnHoot() noexcept = 0;
126
127
130 virtual Jack& JackOnSteam() noexcept = 0;
131 };
132
133};
134
STL namespace.
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
A Bogie is a RailRunner that can be attached to another Bogie by a swivel and can be coupled to anoth...
Definition Bogie.h:67
A jack a plug can get connected with.
Definition Jack.h:83
EndType
Types of the RailRunner's end's.
Definition RailRunner.h:351
A RollingStock is a RailRunner that manages one or more connected Bogies.
Definition RollingStock.h:45
virtual std::pair< std::shared_ptr< RollingStock >, EndType > GetCoupledRollingStock(EndType end) const noexcept=0
Get the coupled RollingStock.
virtual bool Attach(Bogie &bogie) noexcept=0
Attaches a configured Bogie arrangement to the RollingStock.
static dclspc std::shared_ptr< RollingStock > Make() noexcept
Makes a RollingStock object.
virtual int GetNumberOfTopmostParents() const noexcept=0
virtual Bogie & GetBogie(int idx) const =0
Gets the Bogie with index number idx.
virtual Bogie & GetTopmostParent(int idx=0) const =0
Gets the topmost parent Bogie.
virtual int GetNumberOfBogies() const noexcept=0
virtual WheelFrame & GetWheelFrame(int idx) const =0
Gets the WheelFrame at index, counting from north to south.
virtual int GetNumberOfWheelFrames() const noexcept=0
virtual Jack & JackOnHoot() noexcept=0
Gets a Jack that pulses its Plug if the RailRunner's Hoot() member is called.
virtual std::shared_ptr< RollingStock > ThisRollingStock() const noexcept=0
Gets a shared pointer to this.
virtual Jack & JackOnSteam() noexcept=0
Gets a Jack that pulses its Plug if the RailRunner's Steam() member is called.
Interface for the physics simulator.
Definition Simulator.h:59
A TrainComponent is a part of a Train.
Definition TrainComponent.h:40
A Train is a collection of TrainComponents that are coupled in a row.
Definition Train.h:43
A WheelFrame is a Bogie that hosts Wheelsets and a TrackJoint and therefore can directly get attached...
Definition WheelFrame.h:45