Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Anl4TrackSystemReader.h
1// trax track library
2// AD 2014
3//
4// "If you belive it,
5// don't keep it all inside"
6//
7// Stiltskin
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 "CollectionSupportXML.h"
31
32#include "trax/collections/Interfaces.h"
33#include "trax/Track.h"
34
35namespace trax{
36
37 namespace ptreesupport{
38
39 class Anl4TrackSystemReader : public PTreeReader
40 {
41 public:
42 Anl4TrackSystemReader( const char* pLocale = nullptr );
43 Anl4TrackSystemReader( SocketRegistry& socketRegistry, const char* pLocale = nullptr );
44
45 std::shared_ptr<TrackSystem> ReadTrackSystem( const boost::property_tree::ptree& pt ) const override;
46
47 protected:
48 std::shared_ptr<TrackSystem> CreateTrackSystem( const boost::property_tree::ptree& pt ) const;
49
50 std::shared_ptr<TrackCollection> CreateTrackCollection( const boost::property_tree::ptree& pts,
51 std::vector<Track::Coupling>& couplings ) const;
52
53 std::shared_ptr<TrackBuilder> CreateTrack( const boost::property_tree::ptree& pt,
54 std::vector<Track::Coupling>& couplings ) const;
55
56 std::unique_ptr<ConnectorCollection> CreateConnectorCollection( const boost::property_tree::ptree& pt,
57 const TrackSystem& trackSystem ) const;
58
59 std::unique_ptr<Switch> CreateSwitch( const boost::property_tree::ptree& pt,
60 const TrackSystem& trackSystem ) const;
61
62 std::unique_ptr<ThreeWaySwitch> CreateThreeWaySwitch( const boost::property_tree::ptree& pt,
63 const TrackSystem& trackSystem ) const;
64
65 std::unique_ptr<SingleSlipSwitch> CreateSingleSlipSwitch( const boost::property_tree::ptree& pt,
66 const TrackSystem& trackSystem ) const;
67
68 std::unique_ptr<DoubleSlipSwitch> CreateDoubleSlipSwitch( const boost::property_tree::ptree& pt,
69 const TrackSystem& trackSystem ) const;
70
71 std::unique_ptr<Location> CreateLocation( const boost::property_tree::ptree& pt,
72 const TrackSystem& trackSystem ) const;
73
74 std::unique_ptr<IndicatorCollection> CreateIndicatorCollection( const boost::property_tree::ptree& pt,
75 const ConnectorCollection& connectorCollection, const SignalCollection& signalCollection ) const;
76
77 std::unique_ptr<BinaryIndicator> CreateSwitchSemaphore( const boost::property_tree::ptree& pt,
78 const ConnectorCollection& connectorCollection ) const;
79
80 std::unique_ptr<Indicator> CreateSwitchMultiSemaphore( const boost::property_tree::ptree& pt,
81 const ConnectorCollection& connectorCollection ) const;
82
83 std::unique_ptr<Indicator> CreateVelocityControlSemaphore( const boost::property_tree::ptree& pt,
84 const SignalCollection& signalCollection ) const;
85
86 std::unique_ptr<Sensor> CreateSensor( const boost::property_tree::ptree& pt,
87 TrackLocation& trackLocation ) const;
88
89 std::unique_ptr<VelocitySensor> CreateVelocitySensor( const boost::property_tree::ptree& pt,
90 TrackLocation& trackLocation ) const;
91
92 std::unique_ptr<WeighSensor> CreateWeighSensor( const boost::property_tree::ptree& pt,
93 TrackLocation& trackLocation ) const;
94
95 std::unique_ptr<IntervalSensor> CreateTractionSensor( const boost::property_tree::ptree& pt,
96 TrackLocation& trackLocation ) const;
97
98 std::unique_ptr<SignalCollection> CreateSignalCollection( const boost::property_tree::ptree& pt,
99 const TrackSystem& trackSystem/*, const Fleet& fleet*/ ) const;
100
101 std::shared_ptr<VelocityControl> CreateVelocityControl( const boost::property_tree::ptree& pt,
102 const TrackSystem& trackSystem ) const;
103
104 std::shared_ptr<JumpSite> CreateJumpSignal( const boost::property_tree::ptree& pt,
105 const TrackSystem& trackSystem/*, const Fleet& fleet*/ ) const;
106
107 std::unique_ptr<Section> CreateSection( const boost::property_tree::ptree& pt ) const;
108
109 std::unique_ptr<PulseCounterCollection> CreatePulseCounterCollection( const boost::property_tree::ptree& pt ) const;
110
111 std::unique_ptr<PulseCounter> CreatePulseCounter( const boost::property_tree::ptree& pt ) const;
112
113 std::unique_ptr<TimerCollection> CreateTimerCollection( const boost::property_tree::ptree& pt ) const;
114
115 std::unique_ptr<Timer> CreateTimer( const boost::property_tree::ptree& pt ) const;
116
119 void ReadJumpSignalTarget( const boost::property_tree::ptree& pt, std::shared_ptr<JumpSite> pSignal, const TrackSystem& trackSystem/*, const Fleet& fleet*/ ) const;
120 void ReadSensor( const boost::property_tree::ptree& pt, Sensor& sensor, TrackLocation& trackLocation ) const;
121 void ReadSignal( const boost::property_tree::ptree& pt, std::shared_ptr<Signal> pSignal, const TrackSystem& trackSystem ) const;
122 void ReadIndicator( const boost::property_tree::ptree& pt, Indicator& indicator, const ConnectorCollection& connectorCollection ) const;
123 void ReadJack( const boost::property_tree::ptree& pt, Jack& jack ) const;
124 void ReadPlug( const boost::property_tree::ptree& pt, Plug& plug ) const;
125 void ReadPlug( const boost::property_tree::ptree& pt, MultiPlug& plug ) const;
126 void ReadSection( const boost::property_tree::ptree& pt, trax::TrackBuilder& track ) const noexcept;
128 private:
129 };
130
131
134 dclspc void ReadEnd( const boost::property_tree::ptree& pt, TrackBuilder& track, Track::EndType endtype, std::vector<trax::Track::Coupling>& couplings );
136
142 std::shared_ptr<trax::TrackSystem> dclspc ReadTrackSystemFromANL4( const ptreesupport::PTreeReader& reader, const boost::property_tree::ptree& pt, int atIdx );
143 } // namespace ptreesupport
144} // namespace trax
Home of the Track and TrackBuilder interfaces.
Base class for XML readers based on ptree.
Definition CollectionSupportXML.h:97
ptree operator support
Definition CommonSupportXML.h:42
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
Collection to hold a set of Connector objects.
Definition ConnectorCollection.h:36
Interface for objects that indicates system states somehow.
Definition Indicator.h:45
A jack a plug can get connected with.
Definition Jack.h:83
A MultiPlug provides a variable number of actual Plugs to one input slot.
Definition Plug.h:307
A Plug of some object can get plugged into a jack of some object, specific to a certain event.
Definition Plug.h:57
A Sensor can get attached to a track and be triggerd when a Location runs over it.
Definition Sensor.h:71
Collection to hold a set of Signal objects.
Definition SignalCollection.h:36
Interface for a registry that reconnects Plugs and Jacks according to their IDs.
Definition SocketRegistry.h:40
Interface for making and shaping tracks.
Definition Track.h:831
EndType
Designates one of the two ends of a track.
Definition Track.h:292
A TrackLocation ist a location on a single track.
Definition TrackLocation.h:43
A track system is the container for tracks.
Definition TrackSystem.h:56