Dawn Framework 1.0
Universal data acquisition framework for embedded systems
statscount.hxx
1// dawn/include/dawn/prog/statscount.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 (void)ioData;
28 outputData->get<T>(idx) += 1;
29 update = true;
30 }
31};
32
39class CProgStatsCount : public CProgProcessTemplate<StatsOpCount>
40{
41public:
42 explicit CProgStatsCount(CDescObject &desc)
44 {
45 }
46
47#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
48 const char *getClassNameStr() const override
49 {
50 return "count";
51 }
52#endif
53
54 constexpr static SObjectId::ObjectId objectId(uint16_t inst)
55 {
58 }
59
60 constexpr static SObjectCfg::ObjectCfgId cfgId(bool rw, uint8_t size, uint8_t id)
61 {
65 rw,
66 size,
67 id);
68 }
69
70 constexpr static SObjectCfg::ObjectCfgId cfgIdIOBind(uint16_t size = 2)
71 {
72 return CProgStatsCount::cfgId(false, size, PROG_STATS_CFG_IOBIND);
73 }
74};
75} // Namespace dawn
Descriptor wrapper for individual object configuration.
@ PROG_CLASS_STATS_COUNT
Sample counter.
Definition common.hxx:55
Policy-based template for sample processing implementations.
@ PROG_STATS_CFG_IOBIND
I/O binding configuration.
Definition process.hxx:35
Sample counting statistics Program.
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 sample counting.
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