Dawn Framework 1.0
Universal data acquisition framework for embedded systems
dawn::CProgStatsMax Class Reference

Maximum value tracking statistics Program. More...

#include <statsmax.hxx>

Inheritance diagram for dawn::CProgStatsMax:
[legend]
Collaboration diagram for dawn::CProgStatsMax:
[legend]

Public Types

enum  
 Control command identifiers for control().
enum  
 Configuration IDs.
enum  
 Default descriptor validation failure codes. More...
enum  
 Common configuration IDs.
enum  EObjectState
 Object operational state returned by getState().
enum  EProgClass
 Program object class types.

Public Member Functions

int configure ()
 Configure Program from descriptor.
int deinit ()
 Deinitialize Program.
int doStart ()
 Start the Program.
int doStop ()
 Stop the Program.
bool getCfgFlag () const
 Check if configuration flag is set.
uint16_t getCls () const
 Get object class field.
CDescObject & getDesc ()
 Get descriptor object for this object.
uint8_t getDtype () const
 Get data type field.
size_t getDtypeSize () const
 Get size of this object's data type.
uint8_t getFlags () const
 Get type-specific flags field.
SObjectId::UObjectId getId () const
 Get object identifier as union structure.
SObjectId::ObjectId getIdV () const
 Get object identifier as raw 32-bit value.
CIOCommon * getIO (SObjectId::ObjectId id)
 Get an I/O object by ID.
const std::map< SObjectId::ObjectId, CIOCommon * > & getIOMap () const
 Get the I/O map for this object.
int getObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
 Get object configuration item.
CObject * getObject (SObjectId::ObjectId id)
 Get an object by ID.
uint16_t getPriv () const
 Get instance/private data field.
virtual EObjectState getState () const
 Get current operational state.
uint8_t getType () const
 Get object type field.
bool hasThread () const
 Check if a background thread is active.
int init ()
 One-time initialize Program after bindings are resolved.
int setObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
 Set object configuration item.
void setObjectMapItem (SObjectId::ObjectId id, CObject *obj)
 Set an item in the object map.
int start ()
 Start object.
int stop ()
 Stop object.
int trigger (uint8_t cmd)
 Execute a trigger command.

Static Public Member Functions

static int descValidDefault (const uint32_t *data, size_t len)
 Default descriptor validation method.
static int validateDesc (const uint32_t *desc, size_t len)
 Validate entire descriptor.

Protected Member Functions

virtual int bindStateAlloc (CIOCommon *src, CIOCommon *output, io_ddata_t *ioData, io_ddata_t *outputData, SBindState **state)
 Allocate optional per-binding derived state.
virtual int configureExtraCfgItem (const CDescObject &desc, const SObjectCfg::SObjectCfgItem *item, size_t &offset)
 Parse program-specific config item (optional extension hook).
CIOCommon * getOutputIO () const
 Get the output IO for the first bind.
CIOCommon * getSourceIO () const
 Get the source IO for the first bind.
void handle (CIOCommon *output, io_ddata_t *data, io_ddata_t *ioData, io_ddata_t *outputData, bool &initsample)
 Process incoming sample.
void handleCmn (SProcessBind *bind, io_ddata_t *data)
 Common callback wrapper.
virtual void handleWithState (CIOCommon *output, io_ddata_t *data, io_ddata_t *ioData, io_ddata_t *outputData, bool &initsample, void *state)
 Process incoming sample with optional per-binding state.
virtual bool isBatchAware () const
 Whether handle() consumes every batch of a batched source.
virtual int onSetObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
 Pre-update hook for runtime configuration writes.
int prepareWritableTarget (CIOCommon *io, size_t dim, bool notify, size_t batch=1)
 Check a writable output; shape a deferred virt output or check an already shaped one.

Static Protected Member Functions

static size_t contiguousCount (io_ddata_t *d, size_t nbatch, size_t nitems)
 Count elements of the first nbatch batches stored back to back.

Detailed Description

Maximum value tracking statistics Program.

Tracks the maximum value from a source I/O over time.

Definition at line 41 of file statsmax.hxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited

Default descriptor validation failure codes.

Negative values identify which length check failed in descValidDefault().

Definition at line 314 of file object.hxx.

Member Function Documentation

◆ bindStateAlloc()

int CProgProcess::bindStateAlloc ( CIOCommon * src,
CIOCommon * output,
io_ddata_t * ioData,
io_ddata_t * outputData,
SBindState ** state )
protectedvirtualinherited

Allocate optional per-binding derived state.

Called once during init() after source/output buffers are allocated. Derived classes that do not need extra state can use the default null state.

Definition at line 238 of file process.cxx.

◆ configure()

int CProgProcess::configure ( )
inherited

Configure Program from descriptor.

Returns
OK on success, or error code on failure.

Definition at line 72 of file process.cxx.

◆ configureExtraCfgItem()

int CProgProcess::configureExtraCfgItem ( const CDescObject & desc,
const SObjectCfg::SObjectCfgItem * item,
size_t & offset )
protectedvirtualinherited

Parse program-specific config item (optional extension hook).

Returns
OK when item was handled, negative error otherwise.

Definition at line 198 of file process.cxx.

◆ contiguousCount()

size_t CProgCommon::contiguousCount ( io_ddata_t * d,
size_t nbatch,
size_t nitems )
staticprotectedinherited

Count elements of the first nbatch batches stored back to back.

Lets a caller walk the batches as one plain array instead of one batch at a time.

Parameters
[in]dData buffer.
[in]nbatchNumber of batches.
[in]nitemsElements per batch.
Returns
nbatch * nitems when contiguous (nitems for one batch), 0 when nitems differs from the buffer or batches are padded by timestamps or alignment.

Definition at line 182 of file common.cxx.

◆ deinit()

int CProgProcess::deinit ( )
inherited

Deinitialize Program.

Returns
OK on success, or error code on failure.

Definition at line 88 of file process.cxx.

◆ descValidDefault()

int CObject::descValidDefault ( const uint32_t * data,
size_t len )
staticinherited

Default descriptor validation method.

Provides basic validation that only checks if descriptor lengths are correct.

Parameters
dataDescriptor data pointer.
lenLength of descriptor data in 32-bit words.
Returns
OK on success, negative error code indicating validation stage.

Definition at line 334 of file object.cxx.

◆ doStart()

int CProgProcess::doStart ( )
inherited

Start the Program.

Returns
OK on success, or error code on failure.

Definition at line 96 of file process.cxx.

◆ doStop()

int CProgProcess::doStop ( )
inherited

Stop the Program.

Returns
OK on success, or error code on failure.

Definition at line 104 of file process.cxx.

◆ getCfgFlag()

bool CObject::getCfgFlag ( ) const
inherited

Check if configuration flag is set.

Returns
True if this object has configuration data.

Definition at line 223 of file object.cxx.

◆ getCls()

uint16_t CObject::getCls ( ) const
inherited

Get object class field.

Returns
Object class identifier (0-511).

Definition at line 239 of file object.cxx.

◆ getDesc()

CDescObject & CObject::getDesc ( )
inherited

Get descriptor object for this object.

Returns
Reference to associated CDescObject.

Definition at line 271 of file object.cxx.

◆ getDtype()

uint8_t CObject::getDtype ( ) const
inherited

Get data type field.

Returns
Data type (DTYPE_UINT32, DTYPE_FLOAT, etc.).

Definition at line 247 of file object.cxx.

◆ getDtypeSize()

size_t CObject::getDtypeSize ( ) const
inherited

Get size of this object's data type.

Returns
Size in bytes for the configured data type.

Definition at line 279 of file object.cxx.

◆ getFlags()

uint8_t CObject::getFlags ( ) const
inherited

Get type-specific flags field.

Returns
Flags value (0-3).

Definition at line 255 of file object.cxx.

◆ getId()

SObjectId::UObjectId CObject::getId ( ) const
inherited

Get object identifier as union structure.

Returns
Reference to UObjectId structure.

Definition at line 207 of file object.cxx.

◆ getIdV()

SObjectId::ObjectId CObject::getIdV ( ) const
inherited

Get object identifier as raw 32-bit value.

Returns
ObjectID as uint32_t.

Definition at line 215 of file object.cxx.

◆ getIO()

Get an I/O object by ID.

Parameters
idObject ID to retrieve.
Returns
Pointer to the I/O object, or nullptr if not found.

Definition at line 62 of file bindable.cxx.

◆ getIOMap()

const std::map< SObjectId::ObjectId, CIOCommon * > & CBindableObject::getIOMap ( ) const
inherited

Get the I/O map for this object.

Returns
Pointer to a map of object IDs to I/O objects.

Definition at line 44 of file bindable.cxx.

◆ getObjConfig()

int CObject::getObjConfig ( SObjectCfg::ObjectCfgId objcfg,
uint32_t * data,
size_t len )
inherited

Get object configuration item.

Retrieves configuration data for this object.

Parameters
objcfgConfiguration ID specifying which config item to retrieve.
dataPointer to buffer for configuration data.
lenLength of buffer in 32-bit words.
Returns
OK on success, negative error code on failure.

Definition at line 305 of file object.cxx.

◆ getObject()

Get an object by ID.

Parameters
idObject ID to retrieve.
Returns
Pointer to the object, or nullptr if not found.

Definition at line 71 of file bindable.cxx.

◆ getOutputIO()

CIOCommon * dawn::CProgProcess::getOutputIO ( ) const
inlineprotectedinherited

Get the output IO for the first bind.

Convenience for sub-classes that need to emit an initial value during doStart() without iterating the internal bind vector.

Returns
Pointer to the first bind's output IO, or nullptr.

Definition at line 265 of file process.hxx.

◆ getPriv()

uint16_t CObject::getPriv ( ) const
inherited

Get instance/private data field.

Returns
Instance ID (0-16383).

Definition at line 263 of file object.cxx.

◆ getSourceIO()

CIOCommon * dawn::CProgProcess::getSourceIO ( ) const
inlineprotectedinherited

Get the source IO for the first bind.

Convenience for sub-classes that need to read the current source value during doStart().

Returns
Pointer to the first bind's source IO, or nullptr.

Definition at line 282 of file process.hxx.

◆ getState()

virtual EObjectState dawn::CObject::getState ( ) const
inlinevirtualinherited

Get current operational state.

Default returns STATE_RUNNING after successful start(), STATE_STOPPED otherwise. Objects with richer states (e.g. paused) should override.

Returns
Current EObjectState value.

Definition at line 183 of file object.hxx.

◆ getType()

uint8_t CObject::getType ( ) const
inherited

Get object type field.

Returns
Object type (OBJTYPE_IO, OBJTYPE_PROTO, OBJTYPE_PROG).

Definition at line 231 of file object.cxx.

◆ handle()

void dawn::CProgProcessTemplate< StatsOpMax >::handle ( CIOCommon * output,
io_ddata_t * data,
io_ddata_t * ioData,
io_ddata_t * outputData,
bool & initsample )
inlineprotectedvirtualinherited

Process incoming sample.

Parameters
[in]outputResult output I/O object.
[in]dataSample data from source I/O.
[in]ioDataPer-binding input data buffer.
[in]outputDataPer-binding output data buffer.
[in,out]initsamplePer-binding initial sample flag.

Implements dawn::CProgProcess.

Definition at line 81 of file process_template.hxx.

◆ handleCmn()

void dawn::CProgProcess::handleCmn ( SProcessBind * bind,
io_ddata_t * data )
inlineprotectedinherited

Common callback wrapper.

Parameters
[in]bindPer-binding state.
[in]dataSample data.

Definition at line 298 of file process.hxx.

◆ handleWithState()

void CProgProcess::handleWithState ( CIOCommon * output,
io_ddata_t * data,
io_ddata_t * ioData,
io_ddata_t * outputData,
bool & initsample,
void * state )
protectedvirtualinherited

Process incoming sample with optional per-binding state.

The default implementation preserves the original handle() contract.

Definition at line 250 of file process.cxx.

◆ hasThread()

bool CProgProcess::hasThread ( ) const
inherited

Check if a background thread is active.

Returns
Always false.

Definition at line 112 of file process.cxx.

◆ init()

int CProgProcess::init ( )
inherited

One-time initialize Program after bindings are resolved.

Returns
OK on success, or error code on failure.

Definition at line 80 of file process.cxx.

◆ isBatchAware()

virtual bool dawn::CProgProcess::isBatchAware ( ) const
inlineprotectedvirtualinherited

Whether handle() consumes every batch of a batched source.

When true the input buffer takes the source notify batch and so does a virt output; other outputs hold one sample. Otherwise batch 0 only.

Definition at line 209 of file process.hxx.

◆ onSetObjConfig()

virtual int dawn::CObject::onSetObjConfig ( SObjectCfg::ObjectCfgId objcfg,
uint32_t * data,
size_t len )
inlineprotectedvirtualinherited

Pre-update hook for runtime configuration writes.

Called by setObjConfig() before descriptor-backed storage is updated. Derived classes may validate incoming data and prepare/apply runtime side effects. Returning a negative error rejects the update.

Parameters
objcfgConfiguration ID that will be updated.
dataPointer to new config words.
lenNumber of config words.
Returns
OK on success, or negative error code to reject update.

Definition at line 386 of file object.hxx.

◆ prepareWritableTarget()

int CProgCommon::prepareWritableTarget ( CIOCommon * io,
size_t dim,
bool notify,
size_t batch = 1 )
protectedinherited

Check a writable output; shape a deferred virt output or check an already shaped one.

Parameters
[in]ioOutput IO.
[in]dimVirt output data dimension.
[in]notifyWhether the virt output notifies.
[in]batchVirt output batch count.
Returns
OK on success, -EINVAL for a missing, read-only or mismatched IO.

Definition at line 166 of file common.cxx.

◆ setObjConfig()

int CObject::setObjConfig ( SObjectCfg::ObjectCfgId objcfg,
uint32_t * data,
size_t len )
inherited

Set object configuration item.

Updates a configuration item for this object.

Parameters
objcfgConfiguration ID specifying which config item to update.
dataPointer to configuration data.
lenLength of configuration data in 32-bit words.
Returns
OK on success, negative error code on failure.

Definition at line 292 of file object.cxx.

◆ setObjectMapItem()

Set an item in the object map.

Parameters
idObject ID to set.
objObject pointer to associate with the ID.

Definition at line 53 of file bindable.cxx.

◆ start()

int dawn::CObject::start ( )
inlineinherited

Start object.

Tracks operational state and calls doStart(). This phase may run many times during an object's lifetime and should not perform one-time allocation. Sets started on successful doStart() return.

Returns
OK on success, negative error code on failure.

Definition at line 116 of file object.hxx.

◆ stop()

int dawn::CObject::stop ( )
inlineinherited

Stop object.

Tracks operational state and calls doStop(). This phase may run many times during an object's lifetime and should not perform one-time deallocation. Always clears started regardless of doStop() return value.

Returns
OK on success, negative error code on failure.

Definition at line 145 of file object.hxx.

◆ trigger()

int CProgProcess::trigger ( uint8_t cmd)
inherited

Execute a trigger command.

Parameters
[in]cmdCommand identifier (EObjectCmd value).
Returns
OK on success, -ENOTSUP if not supported.

Definition at line 121 of file process.cxx.

◆ validateDesc()

int CObject::validateDesc ( const uint32_t * desc,
size_t len )
staticinherited

Validate entire descriptor.

Validates a descriptor binary object-by-object using default checks.

Parameters
descDescriptor binary pointer.
lenDescriptor length in 32-bit words.
Returns
OK on success, negative error code indicating validation stage.

Definition at line 346 of file object.cxx.


The documentation for this class was generated from the following file: