|
Dawn Framework 1.0
Universal data acquisition framework for embedded systems
|
Manages I/O object lifecycle and dispatch. More...
#include <handler.hxx>
Public Member Functions | |
| CIOHandler () | |
| Construct I/O handler. | |
| ~CIOHandler ()=default | |
| Destructor. | |
| int | bindObjects (IHandler &io, IHandler &prog, IHandler &prot) |
| Bind special I/O objects (Config, Control, Trigger) to targets. | |
| int | configureAll () |
| Configure all objects managed by this handler. | |
| int | deinitAll () |
| De-initialize all I/O objects. | |
| CIOCommon * | getIO (SObjectId::UObjectId &id) const |
| Get I/O object by ObjectID as CIOCommon*. | |
| CObject * | getObject (const SObjectId::ObjectId id) |
| Get object by ObjectID as CObject*. | |
| CIOCommon * | getObjectAt (size_t index) const |
| Get object at index. | |
| CIOCommon * | getObjectById (const SObjectId::UObjectId &id) const |
| Get object by ObjectID. | |
| size_t | getObjectCount () const |
| Get total number of registered objects. | |
| const std::vector< CIOCommon * > & | getObjects () const |
| Get read-only access to all objects. | |
| bool | hasThread () const |
| Check if handler is currently running. | |
| int | init (CDescriptor &desc, IIOFactory *f) |
| Initialize virtual I/O. | |
| int | initAll () |
| Configure and initialize all I/O objects. | |
| bool | isObjectValid (SObjectId::UObjectId &obj) const |
| Validate object ID. | |
| int | objalloc (CDescriptor &desc, CDescriptor::allocobj_func_t func) |
| Allocate objects from descriptor. | |
| int | startAll () |
| Start all I/O objects. | |
| int | stopAll () |
| Stop all I/O objects. | |
Protected Member Functions | |
| const char * | getObjectTypeName () const |
| Get human-readable object type name for logging. | |
| void | onInitObject (CIOCommon *io) |
| Hook called for each I/O object during initAll(). | |
| virtual void | onStartObject (CIOCommon *obj) |
| Hook for subclass-specific pre-start operations. | |
| int | registerObject (CIOCommon *obj) |
| Register object. | |
Protected Attributes | |
| std::vector< CIOCommon * > | objects |
| Vector of registered objects. | |
Manages I/O object lifecycle and dispatch.
Creates, initializes, starts, stops, and provides lookup for all I/O objects in the system.
Definition at line 36 of file handler.hxx.
|
inlineexplicit |
Construct I/O handler.
Creates empty handler with no objects.
Definition at line 45 of file handler.hxx.
|
default |
Destructor.
All I/O objects are destroyed here if deinitAll() was not called.
Bind special I/O objects (Config, Control, Trigger) to targets.
Iterates all IOs and resolves bound target object IDs for special IO types against all three handlers. Called after all initAll() phases.
| io | I/O handler for resolving IO targets. |
| prog | PROG handler for resolving program targets. |
| prot | PROTO handler for resolving protocol targets. |
Definition at line 265 of file handler.cxx.
References dawn::CObject::getCls(), dawn::CIOControl::ids, dawn::CIOTrigger::ids, dawn::CIOCommon::IO_CLASS_CONFIG, dawn::CIOCommon::IO_CLASS_CONTROL, dawn::CIOCommon::IO_CLASS_TRIGGER, dawn::CIOConfig::map, and dawn::CGenericHandler< CIOCommon >::objects.
|
inlineinherited |
Configure all objects managed by this handler.
Definition at line 114 of file generic_handler.hxx.
|
inlinevirtual |
De-initialize all I/O objects.
Calls deinit() method on each I/O object in reverse order.
Reimplemented from dawn::CGenericHandler< CIOCommon >.
Definition at line 88 of file handler.hxx.
References dawn::CGenericHandler< T >::deinitAll().
| CIOCommon * CIOHandler::getIO | ( | SObjectId::UObjectId & | id | ) | const |
Get I/O object by ObjectID as CIOCommon*.
Implements IIOHandler interface.
| id | Reference to ObjectID to retrieve. |
Definition at line 181 of file handler.cxx.
References dawn::CGenericHandler< T >::getObjectById().
|
virtual |
Get object by ObjectID as CObject*.
Returns object as CObject pointer for generic handler operations.
| id | ObjectID to retrieve. |
Implements dawn::IHandler.
Definition at line 174 of file handler.cxx.
References getIO(), and dawn::SObjectId::UObjectId::v.
|
inlineinherited |
Get object at index.
| index | Zero-based index. |
Definition at line 311 of file generic_handler.hxx.
|
inlineinherited |
Get object by ObjectID.
| id | ObjectID to retrieve. |
Definition at line 323 of file generic_handler.hxx.
|
inlineinherited |
Get read-only access to all objects.
Definition at line 298 of file generic_handler.hxx.
|
inlineprotectedvirtual |
Get human-readable object type name for logging.
Reimplemented from dawn::CGenericHandler< CIOCommon >.
Definition at line 190 of file handler.hxx.
|
inlinevirtual |
Check if handler is currently running.
Reimplemented from dawn::CGenericHandler< CIOCommon >.
Definition at line 121 of file handler.hxx.
References dawn::CGenericHandler< T >::hasThread().
| int CIOHandler::init | ( | CDescriptor & | desc, |
| IIOFactory * | f | ||
| ) |
Initialize virtual I/O.
Allocates internal data structures.
| desc | Device descriptor containing I/O definitions. |
| f | Optional user factory for custom I/O types (can be null). |
Definition at line 91 of file handler.cxx.
References dawn::CDevInspector::getInst(), and dawn::CDevInspector::registerIOHandler().
|
virtual |
Configure and initialize all I/O objects.
Runs configure/init lifecycle passes for each I/O object in order.
Reimplemented from dawn::CGenericHandler< CIOCommon >.
Definition at line 135 of file handler.cxx.
References dawn::CGenericHandler< T >::configureAll(), and dawn::CGenericHandler< T >::initAll().
|
virtual |
Validate object ID.
Checks if an ObjectID refers to a valid I/O object in this handler.
| obj | Reference to ObjectID to validate. |
Implements dawn::IHandler.
Definition at line 169 of file handler.cxx.
References dawn::SObjectId::objectIsIO().
|
inlineinherited |
Allocate objects from descriptor.
Generic descriptor allocation using callback pattern.
| desc | Device descriptor containing object definitions. |
| func | Static callback: void func(CHandler& handler, CDescObject&). |
Definition at line 339 of file generic_handler.hxx.
|
protectedvirtual |
Hook called for each I/O object during initAll().
Called by CGenericHandler::initAll() after init() on each object.
| io | Pointer to I/O object just initialized. |
Reimplemented from dawn::CGenericHandler< CIOCommon >.
Definition at line 117 of file handler.cxx.
|
inlineprotectedvirtualinherited |
Hook for subclass-specific pre-start operations.
| obj | Pointer to object about to start. |
Definition at line 70 of file generic_handler.hxx.
|
inlineprotectedinherited |
Register object.
| obj | Pointer to object to register. |
Definition at line 37 of file generic_handler.hxx.
|
virtual |
Start all I/O objects.
Calls start() method on each I/O object and starts the notifier thread (if CONFIG_DAWN_IO_NOTIFY enabled).
Reimplemented from dawn::CGenericHandler< CIOCommon >.
Definition at line 124 of file handler.cxx.
References dawn::CGenericHandler< T >::startAll().
|
virtual |
Stop all I/O objects.
Stops the notifier thread (if CONFIG_DAWN_IO_NOTIFY enabled) and calls stop() method on each I/O object in reverse order.
Reimplemented from dawn::CGenericHandler< CIOCommon >.
Definition at line 156 of file handler.cxx.
References dawn::CGenericHandler< T >::stopAll().