Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
TrainCreator.h
1// trax track library
2// AD 2025
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 "RailRunnerParser.h"
31#include "RollingStockCreator.h"
32
33#include <stack>
34
35namespace trax
36{
37 struct Scene;
38
39 class TrainCreator : public TrainParser,
40 protected RollingStockCreator
41 {
42 public:
43 TrainCreator( Scene& scene ) noexcept;
44
45 std::shared_ptr<Train> GetTrain() const noexcept;
46 protected:
47 // TrainParser:
48 bool ParsingStart() noexcept(false) override;
49
50 bool TrainStart(
51 IDType id,
52 const std::string& name,
53 const std::string& reference,
54 Velocity travel_velocity,
55 Velocity velocity,
56 One trainThrust,
57 One trainBrake,
58 int32_t credit ) noexcept(false) override;
59
60 RollingStockParser* AxisArrangementStart(
61 const std::string& name,
62 const std::string& reference ) noexcept(false) override;
63
64 void AxisArrangementEnd( Orientation orientation ) noexcept(false) override;
65
66 RollingStockParser* RollingStockStart(
67 const std::string& name,
68 const std::string& reference ) noexcept(false) override;
69
70 void RollingStockEnd( Orientation orientation ) noexcept(false) override;
71
72 void TrainEnd(
73 trax::Orientation orientation,
74 bool automatic,
75 bool couplingNorthActivated,
76 bool couplingSouthActivated ) noexcept(false) override;
77
78 void ParsingEnd() noexcept override;
79 private:
80 std::stack<std::vector<std::pair<std::shared_ptr<struct TrainComponent>,struct Orientation>>> m_TrainStack;
81 std::shared_ptr<Train> m_pTrain;
82 };
83
84}
Definition RailRunnerParser.h:50
Definition RailRunnerParser.h:127
Value< Dimension< 1, 0, -1 > > Velocity
Velocity.
Definition DimensionedValues.h:331
Value< Dimension< 0, 0, 0 > > One
Dimensionless value.
Definition DimensionedValues.h:319
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
Type used for IDs in the trax library.
Definition IDType.h:43
Provides two values for orientation.
Definition Orientation.h:37
A physical simulation scene for running a simulation and creating physical objects in the scene.
Definition Scene.h:72