Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
TrainFileReader.h
1// trax track library
2// AD 2024
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 "RollingStockFileReader.h"
31
32#include "TrainCreator.h"
33
34namespace trax{
35
36
37 class TrainFileReader : public FileReader{
38 public:
39 TrainFileReader( TrainParser& parser, std::filesystem::path basePath = std::filesystem::path{} ) noexcept;
40
41 bool Read( std::filesystem::path filePath ) override;
42 protected:
43 private:
44 TrainParser& m_Parser;
45 };
46
47
48 class TrainFileReferenceReader : public TrainFileReader,
49 protected TrainCreator {
50 public:
51 TrainFileReferenceReader( Scene& scene, std::filesystem::path basePath = std::filesystem::path{} ) noexcept;
52
53 std::shared_ptr<Train> GetTrain() const noexcept;
54 protected:
55 bool TrainStart(
56 IDType id,
57 const std::string& name,
58 const std::string& reference,
59 Velocity travel_velocity,
60 Velocity velocity,
61 One trainThrust,
62 One trainBrake,
63 int32_t credit ) noexcept(false) override;
64
65 RollingStockParser* AxisArrangementStart(
66 const std::string& name,
67 const std::string& reference ) noexcept(false) override;
68
69 RollingStockParser* RollingStockStart(
70 const std::string& name,
71 const std::string& reference ) noexcept(false) override;
72 private:
73 RollingStockFileReader m_RollingStockReader;
74 };
75
76} //namespace trax
Definition RollingStockFileReader.h:73
Definition RailRunnerParser.h:50
bool Read(std::filesystem::path filePath) override
Reads an object from a file.
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
A physical simulation scene for running a simulation and creating physical objects in the scene.
Definition Scene.h:72