Dawn Framework 1.0
Universal data acquisition framework for embedded systems
handler.hxx
1// dawn/include/dawn/prog/handler.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include <vector>
9
10#include "dawn/common/descriptor.hxx"
11#include "dawn/common/generic_handler.hxx"
12#include "dawn/common/handler.hxx"
13#include "dawn/io/handler.hxx"
14#include "dawn/porting/config.hxx"
15#include "dawn/prog/common.hxx"
16#include "dawn/prog/factory.hxx"
17
18namespace dawn
19{
27class CProgHandler : public CGenericHandler<CProgCommon>
28{
29public:
37 : userFactory(nullptr)
38 , ioHandler(nullptr)
39 {
40 }
41
48 ~CProgHandler() = default;
49
61 int init(CDescriptor &desc, CIOHandler *io, IProgFactory *f);
62
72 int initAll() override;
73
82 int deinitAll() override
83 {
85 }
86
96 int startAll() override
97 {
99 }
100
110 int stopAll() override
111 {
113 }
114
123 bool hasThread() const override
124 {
126 }
127
138 bool isObjectValid(SObjectId::UObjectId &obj) const override;
139
149 CObject *getObject(const SObjectId::ObjectId id) override;
150
161
162protected:
171 const char *getObjectTypeName() const override
172 {
173 return "PROG";
174 }
175
176private:
183 CProgFactory factory;
184
191 IProgFactory *userFactory;
192
199 CIOHandler *ioHandler;
200
210 CProgCommon *create(CDescObject &desc);
211
222
233 static void objallocPriv(CHandler &obj, CDescObject &desc);
234
243 int objalloc(CDescriptor &desc);
244};
245} // Namespace dawn
Descriptor wrapper for individual object configuration.
Binary device descriptor manager.
Template handler for object lifecycle management.
bool hasThread() const
Check if any thread is currently running.
int stopAll()
Stop all objects managed by this handler.
int deinitAll()
De-initialize all objects managed by this handler.
int startAll()
Start all objects managed by this handler.
Base implementation of IHandler interface.
Definition handler.hxx:110
Base class for all I/O objects.
Definition common.hxx:27
Manages I/O object lifecycle and dispatch.
Definition handler.hxx:37
Base class for all Dawn objects (IOs, Programs, Protocols).
Definition object.hxx:28
Base class for all PROG (processing) objects.
Definition common.hxx:27
Built-in PROG factory implementation.
Definition factory.hxx:37
Manages Programs object lifecycle and dispatch.
Definition handler.hxx:28
CProgHandler()
Construct the Programs handler.
Definition handler.hxx:36
bool isObjectValid(SObjectId::UObjectId &obj) const
Validate object ID in handler collection.
Definition handler.cxx:129
const char * getObjectTypeName() const
Get object type name for logging.
Definition handler.hxx:171
int stopAll()
Stop all Programs objects.
Definition handler.hxx:110
int startAll()
Start all Programs objects.
Definition handler.hxx:96
CObject * getObject(const SObjectId::ObjectId id)
Get a Programs object by object ID.
Definition handler.cxx:134
int initAll()
Configure, bind, and initialize all Program objects.
Definition handler.cxx:99
bool hasThread() const
Check if any Programs are running.
Definition handler.hxx:123
int init(CDescriptor &desc, CIOHandler *io, IProgFactory *f)
Initialize the Programs handler.
Definition handler.cxx:72
~CProgHandler()=default
Destruct the Programs handler.
CProgCommon * getProg(SObjectId::UObjectId &id) const
Get a Programs object by object ID (type-safe).
Definition handler.cxx:141
int deinitAll()
Deinitialize all Programs objects.
Definition handler.hxx:82
Abstract factory interface for PROG object creation.
Definition factory.hxx:20
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44
32-bit encoded object identifier (union with bit field).
Definition objectid.hxx:218