Dawn Framework 1.0
Universal data acquisition framework for embedded systems
statsmax.hxx
1// dawn/include/dawn/prog/statsmax.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{
23{
24 template<typename T>
25 static inline void apply(size_t idx, io_ddata_t *ioData, io_ddata_t *outputData, bool &update)
26 {
27 if (ioData->get<T>(idx) > outputData->get<T>(idx))
28 {
29 outputData->get<T>(idx) = ioData->get<T>(idx);
30 update = true;
31 }
32 }
33};
34
41class CProgStatsMax : public CProgProcessTemplate<StatsOpMax>
42{
43public:
44 explicit CProgStatsMax(CDescObject &desc)
46 {
47 }
48
49#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
50 const char *getClassNameStr() const override
51 {
52 return "max";
53 }
54#endif
55
56 constexpr static SObjectId::ObjectId objectId(uint16_t inst)
57 {
60 }
61
62 constexpr static SObjectCfg::ObjectCfgId cfgId(bool rw, uint8_t size, uint8_t id)
63 {
67 rw,
68 size,
69 id);
70 }
71
72 constexpr static SObjectCfg::ObjectCfgId cfgIdIOBind(uint16_t size = 2)
73 {
74 return CProgStatsMax::cfgId(false, size, PROG_STATS_CFG_IOBIND);
75 }
76};
77} // Namespace dawn
Descriptor wrapper for individual object configuration.
@ PROG_CLASS_STATS_MAX
Maximum value tracker.
Definition common.hxx:43
Policy-based template for sample processing implementations.
@ PROG_STATS_CFG_IOBIND
I/O binding configuration.
Definition process.hxx:35
Maximum value tracking statistics Program.
Definition statsmax.hxx:42
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 maximum value tracking.
Definition statsmax.hxx:23
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