Skip to content

Commit 90b2e10

Browse files
Give independent allowed sample type set for each handler
1 parent 31041b0 commit 90b2e10

4 files changed

Lines changed: 39 additions & 12 deletions

File tree

modules/mqtt_streaming_module/include/mqtt_streaming_module/atomic_signal_atomic_sample_handler.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <opendaq/function_block_ptr.h>
2020
#include <mqtt_streaming_module/handler_base.h>
21+
#include <set>
2122

2223
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
2324

@@ -41,6 +42,18 @@ class AtomicSignalAtomicSampleHandler : public HandlerBase
4142
MqttDataSample processDataPacket(SignalContext& signalContext, const DataPacketPtr& dataPacket, size_t offset);
4243
std::string toString(const std::string valueFieldName, daq::DataPacketPtr packet, size_t offset);
4344
std::string buildTopicName(const SignalContext& signalContext);
45+
46+
47+
inline static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
48+
SampleType::Float32,
49+
SampleType::UInt8,
50+
SampleType::Int8,
51+
SampleType::UInt16,
52+
SampleType::Int16,
53+
SampleType::UInt32,
54+
SampleType::Int32,
55+
SampleType::UInt64,
56+
SampleType::Int64};
4457
};
4558

4659
END_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE

modules/mqtt_streaming_module/include/mqtt_streaming_module/group_signal_shared_ts_handler.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <opendaq/function_block_ptr.h>
2020
#include <mqtt_streaming_module/handler_base.h>
2121
#include <opendaq/multi_reader_ptr.h>
22+
#include <set>
2223

2324
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
2425

@@ -70,6 +71,18 @@ class GroupSignalSharedTsHandler : public HandlerBase
7071
static std::string messageFromFields(const std::vector<std::string>& fields);
7172
static TimestampTickStruct domainToTs(const MultiReaderStatusPtr status);
7273
bool processEvents(const daq::MultiReaderStatusPtr& status); // true if descriptor changed or invalid reader
74+
75+
76+
inline static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
77+
SampleType::Float32,
78+
SampleType::UInt8,
79+
SampleType::Int8,
80+
SampleType::UInt16,
81+
SampleType::Int16,
82+
SampleType::UInt32,
83+
SampleType::Int32,
84+
SampleType::UInt64,
85+
SampleType::Int64};
7386
};
7487

7588
END_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE

modules/mqtt_streaming_module/include/mqtt_streaming_module/handler_base.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <mqtt_streaming_module/types.h>
2222
#include <opendaq/sample_type_traits.h>
2323
#include <vector>
24-
#include <set>
2524

2625
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
2726

@@ -174,17 +173,6 @@ class HandlerBase
174173
}
175174
return valueFieldName;
176175
}
177-
178-
inline static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
179-
SampleType::Float32,
180-
SampleType::UInt8,
181-
SampleType::Int8,
182-
SampleType::UInt16,
183-
SampleType::Int16,
184-
SampleType::UInt32,
185-
SampleType::Int32,
186-
SampleType::UInt64,
187-
SampleType::Int64};
188176
};
189177

190178
END_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE

modules/mqtt_streaming_module/include/mqtt_streaming_module/signal_arr_atomic_sample_handler.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <opendaq/function_block_ptr.h>
2020
#include <mqtt_streaming_module/handler_base.h>
2121
#include <opendaq/multi_reader_ptr.h>
22+
#include <set>
2223

2324
BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE
2425

@@ -39,6 +40,18 @@ class SignalArrayAtomicSampleHandler : public HandlerBase
3940
std::string toString(const std::string valueFieldName, daq::DataPacketPtr packet);
4041
std::string buildTopicName();
4142
static std::string messageFromArray(const std::vector<std::string>& array);
43+
44+
45+
inline static const std::set<SampleType> allowedSampleTypes{SampleType::Float64,
46+
SampleType::Float32,
47+
SampleType::UInt8,
48+
SampleType::Int8,
49+
SampleType::UInt16,
50+
SampleType::Int16,
51+
SampleType::UInt32,
52+
SampleType::Int32,
53+
SampleType::UInt64,
54+
SampleType::Int64};
4255
};
4356

4457
END_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE

0 commit comments

Comments
 (0)