Dawn Framework 1.0
Universal data acquisition framework for embedded systems
statsmin.hxx
1// dawn/include/dawn/prog/statsmin.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include "dawn/io/ddata.hxx"
9#include "dawn/io/common.hxx"
10#include "dawn/porting/config.hxx"
11#include "dawn/prog/common.hxx"
12#include "dawn/prog/process_template.hxx"
13
14namespace dawn
15{
26{
27 template<typename T>
28 static inline void apply(size_t idx, io_ddata_t *ioData, io_ddata_t *outputData, bool &update)
29 {
30 if (ioData->get<T>(idx) < outputData->get<T>(idx))
31 {
32 outputData->get<T>(idx) = ioData->get<T>(idx);
33 update = true;
34 }
35 }
36};
37
44class CProgStatsMin : public CProgProcessTemplate<StatsOpMin>
45{
46public:
47 explicit CProgStatsMin(CDescObject &desc)
49 {
50 }
51
52#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
53 const char *getClassNameStr() const override
54 {
55 return "min";
56 }
57#endif
58
59 constexpr static SObjectId::ObjectId objectId(uint16_t inst)
60 {
63 }
64
65 constexpr static SObjectCfg::ObjectCfgId cfgId(bool rw, uint8_t size, uint8_t id)
66 {
70 rw,
71 size,
72 id);
73 }
74
75 constexpr static SObjectCfg::ObjectCfgId cfgIdIOBind(uint16_t size = 2)
76 {
77 return CProgStatsMin::cfgId(false, size, PROG_STATS_CFG_IOBIND);
78 }
79};
80} // Namespace dawn
Descriptor wrapper for individual object configuration.
@ PROG_CLASS_STATS_MIN
Minimum value tracker.
Definition common.hxx:39
Policy-based template for sample processing implementations.
@ PROG_STATS_CFG_IOBIND
I/O binding configuration.
Definition process.hxx:35
Minimum value tracking statistics Program.
Definition statsmin.hxx:45
static ObjectCfgId objectCfg(uint8_t type, uint16_t cls, uint8_t dtype, bool rw, uint16_t size, uint8_t id)
Construct 32-bit ConfigID from component fields.
uint32_t ObjectCfgId
ConfigID type - single 32-bit value.
Definition objectcfg.hxx:60
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
@ OBJTYPE_PROG
Program/algorithm object type.
Definition objectid.hxx:202
@ DTYPE_ANY
Wildcard data type (matches any actual type).
Definition objectid.hxx:68
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44
static ObjectId objectId(uint8_t type, uint16_t cls, uint8_t dtype, uint8_t flags, uint16_t priv)
Construct 32-bit ObjectID from component fields.
Definition objectid.hxx:290
Policy for minimum value tracking.
Definition statsmin.hxx:26
Heap-allocated dynamic I/O data buffer.
Definition ddata.hxx:21
T & get(size_t index, size_t batch=0)
Get data element by index and batch (type-safe).
Definition ddata.hxx:93