Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Event.h
1// trax track library
2// AD 2018
3//
4// "the resolution of all the fruitless searches"
5//
6// Peter Gabriel
7//
8// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
9// Copyright (c) 2019 Marc-Michael Horstmann
10//
11// Permission is hereby granted to any person obtaining a copy of this software
12// and associated source code (the "Software"), to use, view, and study the
13// Software for personal or internal business purposes, subject to the following
14// conditions:
15//
16// 1. Redistribution, modification, sublicensing, or commercial use of the
17// Software is NOT permitted without prior written consent from the copyright
18// holder.
19//
20// 2. The Software is provided "AS IS", without warranty of any kind, express
21// or implied.
22//
23// 3. All copies of the Software must retain this license notice.
24//
25// For further information, please contact: horstmann.marc@trendverlag.de
26
27#pragma once
28
29#include "Track.h"
30
31namespace common{
33 template<typename> struct Interval;
34}
35
36namespace trax{
37
38 class Location;
39
40 struct Event{
41
43 static dclspc std::unique_ptr<Event> Make() noexcept;
44
45
46 virtual ~Event() = default;
47
48 Event( Event&& ) = delete;
49 Event& operator=( const Event& ) = delete;
50 Event& operator=( Event&& ) = delete;
51 protected:
52 Event() = default;
53 Event( const Event& ) = default;
54 };
55
57 struct EventFilter : Event{
58
59 enum class Type{
60 none = -1,
61 wheelframe = 0,
62 wheelset,
63 traintip_north,
64 traintip_south,
65 traintip_both,
66 any
67 };
68
70 static dclspc std::unique_ptr<EventFilter> Make( EventFilter::Type type = EventFilter::Type::any ) noexcept;
71
72
73 static std::string From( Type type );
74
75 static Type From( const std::string& type );
76
77
78 virtual std::string Name() const = 0;
79
80 virtual void Name( const std::string& name ) = 0;
81
82 virtual Type GetType() const noexcept = 0;
83
84 virtual void SetType( Type type ) noexcept = 0;
85
86 virtual void TrainTip( bool bTrainTip ) noexcept = 0;
87
88 virtual bool TrainTip() const noexcept = 0;
89
90 virtual void TrainEnd( bool bTrainEnd ) noexcept = 0;
91
92 virtual bool TrainEnd() const noexcept = 0;
93 };
94}
95
Home of the Track and TrackBuilder interfaces.
A Location specifies a position on a track system by referencing a track and a TrackLocation on it.
Definition Location.h:110
Namespace of common utility classes and methods.
Definition Helpers.h:43
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
An interval describes the area between two numbers. It is understood to contain the near one and exlu...
Definition Interval.h:42
An event is sent to a sensor if it gets triggered.
Definition Event.h:57
static dclspc std::unique_ptr< EventFilter > Make(EventFilter::Type type=EventFilter::Type::any) noexcept
Makes a EventFilter object.
static dclspc std::unique_ptr< Event > Make() noexcept
Makes a simple unqualified Event object.