Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Sensor_Imp.h
1// trax track library
2// AD 2014
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#include "trax/Sensor.h"
29#include "trax/ObjectID.h"
30#include "source/Plug_Imp.h"
31
32#include "common/Interval.h"
33
34#if defined(_MSC_VER)
35# pragma warning(disable: 4250) // virtual inheritance of methods via dominance
36#endif
37
38namespace trax{
39
40 using namespace spat;
41
42 class Sensor_Imp : public ObjectID_Imp<Sensor>,
43 public JackEnumerator
44 {
45 public:
46 Sensor_Imp();
47 Sensor_Imp( const Sensor_Imp& sensor );
48 Sensor_Imp( Sensor_Imp&& ) = default;
49 ~Sensor_Imp() = default;
50
51 Sensor_Imp& operator=( const Sensor_Imp& sensor ) = delete;
52 Sensor_Imp& operator=( Sensor_Imp&& ) = delete;
53
54 const char* TypeName() const noexcept override;
55
56 const std::string& Reference( const std::string& name ) const override{
57 return ObjectID_Imp<Sensor>::Reference( name );
58 }
59
60 void Reference( const std::string& name, const std::string& reference ) override{
61 return ObjectID_Imp<Sensor>::Reference( name, reference );
62 }
63
64 IDType ID() const noexcept override{
65 return ObjectID_Imp<Sensor>::ID();
66 }
67
68 void ID( IDType id ) noexcept override{
69 return ObjectID_Imp<Sensor>::ID( id );
70 }
71
72 void Trigger( const Event& _event ) override;
73
74 Jack& JackOnTrigger() noexcept override;
75
76 void RegisterSockets( SocketRegistry& module ) override;
77
78 void UnregisterSockets( SocketRegistry& module ) override;
79
80 void Attach( TrackBuilder* pTrackBuilder ) noexcept override;
81
82 TrackBuilder* TrackAttached() const noexcept override;
83
84 int CountJacks() const noexcept override;
85 protected:
86 const Jack& _GetJack( int idx ) const override;
87
88 private:
89 TrackBuilder* m_pTrackBuilder;
90 Jack_Imp m_JackOnTrigger{ "JackOnTrigger" };
91 };
92
93
94
95 //class SensorFilterJack_Imp : public ObjectID_Imp<SensorFilterJack>,
96 // public JackEnumerator
97 //{
98 //public:
99 // SensorFilterJack_Imp( int flags );
100 // SensorFilterJack_Imp( const SensorFilterJack_Imp& sensor );
101 // SensorFilterJack_Imp( SensorFilterJack_Imp&& ) = default;
102 // ~SensorFilterJack_Imp() = default;
103
104 // SensorFilterJack_Imp& operator=( const SensorFilterJack_Imp& sensor ) = delete;
105 // SensorFilterJack_Imp& operator=( SensorFilterJack_Imp&& ) = delete;
106
107 // const char* TypeName() const noexcept override;
108
109 // const std::string& Reference( const std::string& name ) const override{
110 // return ObjectID_Imp<SensorFilterJack>::Reference( name );
111 // }
112
113 // void Reference( const std::string& name, const std::string& reference ) override{
114 // return ObjectID_Imp<SensorFilterJack>::Reference( name, reference );
115 // }
116
117 // IDType ID() const noexcept override{
118 // return ObjectID_Imp<SensorFilterJack>::ID();
119 // }
120
121 // void ID( IDType id ) noexcept override{
122 // return ObjectID_Imp<SensorFilterJack>::ID( id );
123 // }
124
125 // void Trigger( const Event& _event ) override;
126
127 // int GetEffect() const noexcept override;
128
129 // void SetEffect( int effect ) noexcept override;
130
131 // Jack& JackOnTrigger() noexcept override;
132
133 // void RegisterSockets( SocketRegistry& module ) override;
134
135 // void UnregisterSockets( SocketRegistry& module ) override;
136
137 // void Attach( TrackBuilder* pTrackBuilder ) noexcept override;
138
139 // TrackBuilder* TrackAttached() const noexcept override;
140
141 // int CountJacks() const noexcept override;
142 //protected:
143 // const Jack& _GetJack( int idx ) const override;
144
145 //private:
146 // TrackBuilder* m_pTrackBuilder;
147 // int m_FilterFlags = 0;
148
149 // Jack_Imp m_JackOnTrigger{ "JackOnTrigger" };
150 //};
151}
Definition Jack.h:132
Definition ObjectID.h:38
void RegisterSockets(SocketRegistry &module) override
Registers all the Plugs with the module and supplies the Jacks with plug ids for connecting.
IDType ID() const noexcept override
Definition Sensor_Imp.h:64
int CountJacks() const noexcept override
void Trigger(const Event &_event) override
Triggers this Sensor.
const std::string & Reference(const std::string &name) const override
Gets a reference that was set for this object by name.
Definition Sensor_Imp.h:56
TrackBuilder * TrackAttached() const noexcept override
Jack & JackOnTrigger() noexcept override
Gets a Jack that pulses its Plug if the sensor is triggering.
void UnregisterSockets(SocketRegistry &module) override
Removes all references to Plugs and Jacks from the module.
const char * TypeName() const noexcept override
void Attach(TrackBuilder *pTrackBuilder) noexcept override
Attach the pointer to the track to the sensor.
STL namespace.
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
Definition Event.h:40
Type used for IDs in the trax library.
Definition IDType.h:43
A jack a plug can get connected with.
Definition Jack.h:83
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