Dawn Framework 1.0
Universal data acquisition framework for embedded systems
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dawn::CProgHandler Class Reference

Manages Programs object lifecycle and dispatch. More...

#include <handler.hxx>

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

Public Member Functions

 CProgHandler ()
 Construct the Programs handler.
 
 ~CProgHandler ()=default
 Destruct the Programs handler.
 
int configureAll ()
 Configure all objects managed by this handler.
 
int deinitAll ()
 Deinitialize all Programs objects.
 
CObjectgetObject (const SObjectId::ObjectId id)
 Get a Programs object by object ID.
 
CProgCommongetObjectAt (size_t index) const
 Get object at index.
 
CProgCommongetObjectById (const SObjectId::UObjectId &id) const
 Get object by ObjectID.
 
size_t getObjectCount () const
 Get total number of registered objects.
 
const std::vector< CProgCommon * > & getObjects () const
 Get read-only access to all objects.
 
CProgCommongetProg (SObjectId::UObjectId &id) const
 Get a Programs object by object ID (type-safe).
 
bool hasThread () const
 Check if any Programs are running.
 
int init (CDescriptor &desc, CIOHandler *io, IProgFactory *f)
 Initialize the Programs handler.
 
int initAll ()
 Configure, bind, and initialize all Program objects.
 
bool isObjectValid (SObjectId::UObjectId &obj) const
 Validate object ID in handler collection.
 
int objalloc (CDescriptor &desc, CDescriptor::allocobj_func_t func)
 Allocate objects from descriptor.
 
int startAll ()
 Start all Programs objects.
 
int stopAll ()
 Stop all Programs objects.
 

Protected Member Functions

const char * getObjectTypeName () const
 Get object type name for logging.
 
virtual void onInitObject (CProgCommon *obj)
 Hook for subclass-specific post-object-init handling.
 
virtual void onStartObject (CProgCommon *obj)
 Hook for subclass-specific pre-start operations.
 
int registerObject (CProgCommon *obj)
 Register object.
 

Protected Attributes

std::vector< CProgCommon * > objects
 Vector of registered objects.
 

Detailed Description

Manages Programs object lifecycle and dispatch.

Creates, initializes, starts, stops, and provides lookup for all Programs objects in the system.

Definition at line 27 of file handler.hxx.

Constructor & Destructor Documentation

◆ CProgHandler()

dawn::CProgHandler::CProgHandler ( )
inline

Construct the Programs handler.

Creates an empty handler with no Programs objects.

Definition at line 36 of file handler.hxx.

◆ ~CProgHandler()

dawn::CProgHandler::~CProgHandler ( )
default

Destruct the Programs handler.

Destroys all managed Programs objects.

Member Function Documentation

◆ configureAll()

int dawn::CGenericHandler< CProgCommon >::configureAll ( )
inlineinherited

Configure all objects managed by this handler.

Returns
OK on success, negative error code on failure.

Definition at line 114 of file generic_handler.hxx.

◆ deinitAll()

int dawn::CProgHandler::deinitAll ( )
inlinevirtual

Deinitialize all Programs objects.

Called during shutdown to clean up all Programs objects.

Returns
OK if all deinitialized successfully.

Reimplemented from dawn::CGenericHandler< CProgCommon >.

Definition at line 82 of file handler.hxx.

References dawn::CGenericHandler< T >::deinitAll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObject()

CObject * CProgHandler::getObject ( const SObjectId::ObjectId  id)
virtual

Get a Programs object by object ID.

Generic lookup method returning any CObject pointer.

Parameters
[in]idObject ID to look up.
Returns
CObject pointer (Programs object), or nullptr if not found.

Implements dawn::IHandler.

Definition at line 134 of file handler.cxx.

References getProg(), and dawn::SObjectId::UObjectId::v.

Here is the call graph for this function:

◆ getObjectAt()

CProgCommon * dawn::CGenericHandler< CProgCommon >::getObjectAt ( size_t  index) const
inlineinherited

Get object at index.

Parameters
indexZero-based index.
Returns
Pointer to object, nullptr if out of bounds.

Definition at line 311 of file generic_handler.hxx.

◆ getObjectById()

CProgCommon * dawn::CGenericHandler< CProgCommon >::getObjectById ( const SObjectId::UObjectId id) const
inlineinherited

Get object by ObjectID.

Parameters
idObjectID to retrieve.
Returns
Pointer to object, nullptr if not found.

Definition at line 323 of file generic_handler.hxx.

◆ getObjects()

const std::vector< CProgCommon * > & dawn::CGenericHandler< CProgCommon >::getObjects ( ) const
inlineinherited

Get read-only access to all objects.

Returns
Const reference to object vector.

Definition at line 298 of file generic_handler.hxx.

◆ getObjectTypeName()

const char * dawn::CProgHandler::getObjectTypeName ( ) const
inlineprotectedvirtual

Get object type name for logging.

Used in debug output and error messages.

Returns
String "Programs" identifying this handler type.

Reimplemented from dawn::CGenericHandler< CProgCommon >.

Definition at line 171 of file handler.hxx.

◆ getProg()

CProgCommon * CProgHandler::getProg ( SObjectId::UObjectId id) const

Get a Programs object by object ID (type-safe).

Retrieves a Programs object from the handler's collection.

Parameters
[in]idObject ID to look up.
Returns
CProgCommon pointer, or nullptr if not found.

Definition at line 141 of file handler.cxx.

References dawn::CGenericHandler< T >::getObjectById().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasThread()

bool dawn::CProgHandler::hasThread ( ) const
inlinevirtual

Check if any Programs are running.

Returns current operational state.

Returns
true if any Programs is currently running.

Reimplemented from dawn::CGenericHandler< CProgCommon >.

Definition at line 123 of file handler.hxx.

References dawn::CGenericHandler< T >::hasThread().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

int CProgHandler::init ( CDescriptor desc,
CIOHandler io,
IProgFactory f 
)

Initialize the Programs handler.

Performs full Programs handler initialization.

Parameters
[in]descDevice descriptor.
[in]ioI/O handler for I/O object lookup.
[in]fOptional user factory, or nullptr for built-in only.
Returns
OK on success, or negative error code on failure.

Definition at line 72 of file handler.cxx.

References dawn::CDevInspector::getInst(), and dawn::CDevInspector::registerProgHandler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initAll()

int CProgHandler::initAll ( )
virtual

Configure, bind, and initialize all Program objects.

Performs the Program lifecycle setup sequence: configure() for each object, bind IO dependencies, then object init().

Returns
OK if all initialized, or first error code encountered.

Reimplemented from dawn::CGenericHandler< CProgCommon >.

Definition at line 99 of file handler.cxx.

References dawn::CGenericHandler< T >::configureAll(), dawn::CBindableObject::getIOMap(), dawn::CGenericHandler< CProgCommon >::getObjectAt(), dawn::CGenericHandler< CProgCommon >::getObjectCount(), dawn::CGenericHandler< T >::initAll(), and dawn::CBindableObject::setObjectMapItem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isObjectValid()

bool CProgHandler::isObjectValid ( SObjectId::UObjectId obj) const
virtual

Validate object ID in handler collection.

Checks if the given object ID corresponds to a valid Program in the handler's collection.

Parameters
[in]objObject ID to validate.
Returns
true if object exists in handler, false otherwise.

Implements dawn::IHandler.

Definition at line 129 of file handler.cxx.

References dawn::SObjectId::objectIsProg().

Here is the call graph for this function:

◆ objalloc()

int dawn::CGenericHandler< CProgCommon >::objalloc ( CDescriptor desc,
CDescriptor::allocobj_func_t  func 
)
inlineinherited

Allocate objects from descriptor.

Generic descriptor allocation using callback pattern.

Parameters
descDevice descriptor containing object definitions.
funcStatic callback: void func(CHandler& handler, CDescObject&).

Definition at line 339 of file generic_handler.hxx.

◆ onInitObject()

virtual void dawn::CGenericHandler< CProgCommon >::onInitObject ( CProgCommon obj)
inlineprotectedvirtualinherited

Hook for subclass-specific post-object-init handling.

Parameters
objPointer to object that was just initialized.

Definition at line 60 of file generic_handler.hxx.

◆ onStartObject()

virtual void dawn::CGenericHandler< CProgCommon >::onStartObject ( CProgCommon obj)
inlineprotectedvirtualinherited

Hook for subclass-specific pre-start operations.

Parameters
objPointer to object about to start.

Definition at line 70 of file generic_handler.hxx.

◆ registerObject()

int dawn::CGenericHandler< CProgCommon >::registerObject ( CProgCommon obj)
inlineprotectedinherited

Register object.

Parameters
objPointer to object to register.

Definition at line 37 of file generic_handler.hxx.

◆ startAll()

int dawn::CProgHandler::startAll ( )
inlinevirtual

Start all Programs objects.

Activates all Programs for operation (e.g., start sampling thread, enable event processing).

Returns
OK if all started, or first error code encountered.

Reimplemented from dawn::CGenericHandler< CProgCommon >.

Definition at line 96 of file handler.hxx.

References dawn::CGenericHandler< T >::startAll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopAll()

int dawn::CProgHandler::stopAll ( )
inlinevirtual

Stop all Programs objects.

Deactivates all Programs (e.g., stop sampling thread, disable event processing).

Returns
OK if all stopped successfully.

Reimplemented from dawn::CGenericHandler< CProgCommon >.

Definition at line 110 of file handler.hxx.

References dawn::CGenericHandler< T >::stopAll().

Here is the call graph for this function:
Here is the caller graph for this function:

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