Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Module.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 "trax/Configuration.h"
31#include "trax/Identified.h"
32#include "trax/Units.h"
33#include "trax/SocketRegistry.h"
34#include "trax/collections/ObjectIDDecorator.h"
35
36#include "spat/Box.h"
37#include "spat/Frame.h"
38
39
40namespace trax{
41
42 struct CameraCollection;
43 struct CargoCollection;
44 struct Fleet;
47 struct SignalCollection;
48 struct TimerCollection;
49 struct TrackSystem;
50
51
58 struct Module : Identified<Module>,
59 virtual SocketRegistry
60 {
62 static dclspc std::unique_ptr<Module> Make( bool bCreateCollections = true ) noexcept;
63
64
66 virtual const char* TypeName() const noexcept = 0;
67
68
71 virtual bool IsValid() const noexcept = 0;
72
73
79 virtual void SetFrame( const spat::Frame<Length,One>& frame ) noexcept = 0;
80
81
87 virtual const spat::Frame<Length,One>& GetFrame() const noexcept = 0;
88
89
91 virtual void SetVolume( const spat::Box<Length>& volume ) noexcept = 0;
92
93
95 virtual const spat::Box<Length>& GetVolume() const noexcept = 0;
96
97
100 virtual void Attach( std::shared_ptr<TrackSystem> pTrackSystem ) noexcept = 0;
101
102
104 virtual std::shared_ptr<TrackSystem> GetTrackSystem() const noexcept = 0;
105
106
109 virtual void Attach( std::shared_ptr<Fleet> pFleet ) noexcept = 0;
110
111
113 virtual std::shared_ptr<Fleet> GetFleet() const noexcept = 0;
114
115
118 virtual void Attach( std::shared_ptr<SignalCollection> pSignalCollection ) noexcept = 0;
119
120
122 virtual std::shared_ptr<SignalCollection> GetSignalCollection() const noexcept = 0;
123
124
127 virtual void Attach( std::shared_ptr<IndicatorCollection> pIndicatorCollection ) noexcept = 0;
128
129
131 virtual std::shared_ptr<IndicatorCollection> GetIndicatorCollection() const noexcept = 0;
132
133
136 virtual void Attach( std::shared_ptr<CargoCollection> pCargoCollection ) noexcept = 0;
137
138
140 virtual std::shared_ptr<CargoCollection> GetCargoCollection() const noexcept = 0;
141
142
145 virtual void Attach( std::shared_ptr<TimerCollection> pTimerCollection ) noexcept = 0;
146
147
149 virtual std::shared_ptr<TimerCollection> GetTimerCollection() const noexcept = 0;
150
151
154 virtual void Attach( std::shared_ptr<PulseCounterCollection> pPulseCounterCollection ) noexcept = 0;
155
156
158 virtual std::shared_ptr<PulseCounterCollection> GetPulseCounterCollection() const noexcept = 0;
159
160
163 virtual void Attach( std::shared_ptr<CameraCollection> pCameraCollection ) noexcept = 0;
164
165
167 virtual std::shared_ptr<CameraCollection> GetCameraCollection() const noexcept = 0;
168
169
175 virtual void Take( Module& fromModule ) = 0;
176
177
179 virtual void Clear() = 0;
180
181
183 virtual void ClearCollections() = 0;
184 };
185
186}
Value< Dimension< 0, 0, 0 > > One
Dimensionless value.
Definition DimensionedValues.h:319
Value< Dimension< 1, 0, 0 > > Length
Length.
Definition DimensionedValues.h:324
The namespace provides classes and methods for spatial computations.
Definition Box.h:32
STL namespace.
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
Axis aligned box.
Definition Box.h:41
A Frame ("TNBFrame") describes a location in 3d space and an orientation using a right handed coordin...
Definition Frame.h:52
Collection to store cameras.
Definition Camera.h:324
Definition CargoCollection.h:39
A Fleet holds Trains and (topmost) Bogies via their common interface RailRunner.
Definition Fleet.h:48
Collection to hold a set of Indicator objects.
Definition IndicatorCollection.h:39
A module is a chunck of railroad stuff that is all located in one rectangular volume.
Definition Module.h:60
virtual std::shared_ptr< PulseCounterCollection > GetPulseCounterCollection() const noexcept=0
virtual std::shared_ptr< TrackSystem > GetTrackSystem() const noexcept=0
virtual void Attach(std::shared_ptr< TrackSystem > pTrackSystem) noexcept=0
Attaches a TrackSystem to this Module.
virtual const char * TypeName() const noexcept=0
virtual std::shared_ptr< SignalCollection > GetSignalCollection() const noexcept=0
virtual void SetVolume(const spat::Box< Length > &volume) noexcept=0
Gets the volume this module occupies.
virtual const spat::Box< Length > & GetVolume() const noexcept=0
Sets the volume this module occupies.
virtual std::shared_ptr< IndicatorCollection > GetIndicatorCollection() const noexcept=0
virtual std::shared_ptr< CameraCollection > GetCameraCollection() const noexcept=0
virtual bool IsValid() const noexcept=0
Checks whether the elements in this module are valid.
virtual const spat::Frame< Length, One > & GetFrame() const noexcept=0
Get frame of reference.
static dclspc std::unique_ptr< Module > Make(bool bCreateCollections=true) noexcept
Makes a standard Module object.
virtual void ClearCollections()=0
Clears all the attached collections.
virtual void Clear()=0
Clear the Module from all attached objects.
virtual std::shared_ptr< CargoCollection > GetCargoCollection() const noexcept=0
virtual void Take(Module &fromModule)=0
Moves all objects from all the collections to this module.
virtual std::shared_ptr< Fleet > GetFleet() const noexcept=0
virtual std::shared_ptr< TimerCollection > GetTimerCollection() const noexcept=0
virtual void SetFrame(const spat::Frame< Length, One > &frame) noexcept=0
Set frame of reference.
Definition PulseCounterCollection.h:36
Collection to hold a set of Signal objects.
Definition SignalCollection.h:36
Definition TimerCollection.h:35
A track system is the container for tracks.
Definition TrackSystem.h:56