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

Manages PROTO object lifecycle and dispatch. More...

#include <handler.hxx>

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

Public Member Functions

 CProtoHandler ()
 Constructor.
 
 ~CProtoHandler ()=default
 Destructor.
 
int configureAll ()
 Configure all objects managed by this handler.
 
int deinitAll ()
 Deinitialize all protocol objects.
 
CObjectgetObject (const SObjectId::ObjectId id)
 Get protocol object by ID.
 
CProtoCommongetObjectAt (size_t index) const
 Get object at index.
 
CProtoCommongetObjectById (const SObjectId::UObjectId &id) const
 Get object by ObjectID.
 
size_t getObjectCount () const
 Get total number of registered objects.
 
const std::vector< CProtoCommon * > & getObjects () const
 Get read-only access to all objects.
 
CProtoCommongetProto (SObjectId::UObjectId &id) const
 Get protocol object interface.
 
bool hasThread () const
 Check if any protocol is running.
 
int init (CDescriptor &desc, CIOHandler *io, IProtoFactory *f)
 Initialize protocol handler and instances.
 
int initAll ()
 Configure, bind, and initialize all protocol objects.
 
bool isObjectValid (SObjectId::UObjectId &obj) const
 Validate protocol object ID.
 
int objalloc (CDescriptor &desc, CDescriptor::allocobj_func_t func)
 Allocate objects from descriptor.
 
int startAll ()
 Start all protocol objects.
 
int stopAll ()
 Stop all protocol objects.
 

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Manages PROTO object lifecycle and dispatch.

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

Definition at line 27 of file handler.hxx.

Constructor & Destructor Documentation

◆ CProtoHandler()

dawn::CProtoHandler::CProtoHandler ( )
inline

Constructor.

Initializes the protocol handler with default state.

Definition at line 36 of file handler.hxx.

◆ ~CProtoHandler()

dawn::CProtoHandler::~CProtoHandler ( )
default

Destructor.

Cleans up all protocol objects and handler state.

Member Function Documentation

◆ configureAll()

int dawn::CGenericHandler< CProtoCommon >::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::CProtoHandler::deinitAll ( )
inlinevirtual

Deinitialize all protocol objects.

Calls deinit() on each protocol object.

Returns
int 0 on success, negative error code on failure.

Reimplemented from dawn::CGenericHandler< CProtoCommon >.

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 * CProtoHandler::getObject ( const SObjectId::ObjectId  id)
virtual

Get protocol object by ID.

Retrieves a protocol instance by its object ID.

Parameters
[in]idProtocol object ID.
Returns
CObject* Pointer to protocol object, nullptr if not found.

Implements dawn::IHandler.

Definition at line 135 of file handler.cxx.

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

Here is the call graph for this function:

◆ getObjectAt()

CProtoCommon * dawn::CGenericHandler< CProtoCommon >::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()

CProtoCommon * dawn::CGenericHandler< CProtoCommon >::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< CProtoCommon * > & dawn::CGenericHandler< CProtoCommon >::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::CProtoHandler::getObjectTypeName ( ) const
inlineprotectedvirtual

Get object type name for logging.

Returns
const char* "PROTO" for log messages.

Reimplemented from dawn::CGenericHandler< CProtoCommon >.

Definition at line 164 of file handler.hxx.

◆ getProto()

CProtoCommon * CProtoHandler::getProto ( SObjectId::UObjectId id) const

Get protocol object interface.

Retrieves a protocol instance for external use.

Parameters
[in]idProtocol object ID.
Returns
CProtoCommon* Protocol object pointer, nullptr if not found.

Definition at line 142 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::CProtoHandler::hasThread ( ) const
inlinevirtual

Check if any protocol is running.

Returns
bool true if at least one protocol is active, false otherwise.

Reimplemented from dawn::CGenericHandler< CProtoCommon >.

Definition at line 119 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 CProtoHandler::init ( CDescriptor desc,
CIOHandler io,
IProtoFactory f 
)

Initialize protocol handler and instances.

Creates protocol objects from the descriptor and binds them to I/O.

Parameters
[in]descDevice descriptor with protocol configurations.
[in]ioI/O handler reference for protocol I/O access.
[in]fUser-provided factory (nullptr = use built-in factory).
Returns
int 0 on success, negative error code on failure.

Definition at line 73 of file handler.cxx.

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

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

◆ initAll()

int CProtoHandler::initAll ( )
virtual

Configure, bind, and initialize all protocol objects.

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

Returns
int 0 on success, negative error code on failure.

Reimplemented from dawn::CGenericHandler< CProtoCommon >.

Definition at line 100 of file handler.cxx.

References dawn::CGenericHandler< T >::configureAll(), dawn::CBindableObject::getIOMap(), dawn::CGenericHandler< CProtoCommon >::getObjectAt(), dawn::CGenericHandler< CProtoCommon >::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 CProtoHandler::isObjectValid ( SObjectId::UObjectId obj) const
virtual

Validate protocol object ID.

Checks if a protocol object ID is valid and registered.

Parameters
[in]objProtocol object ID.
Returns
bool true if object exists and is valid.

Implements dawn::IHandler.

Definition at line 130 of file handler.cxx.

References dawn::SObjectId::objectIsProto().

Here is the call graph for this function:

◆ objalloc()

int dawn::CGenericHandler< CProtoCommon >::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< CProtoCommon >::onInitObject ( CProtoCommon 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< CProtoCommon >::onStartObject ( CProtoCommon 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< CProtoCommon >::registerObject ( CProtoCommon obj)
inlineprotectedinherited

Register object.

Parameters
objPointer to object to register.

Definition at line 37 of file generic_handler.hxx.

◆ startAll()

int dawn::CProtoHandler::startAll ( )
inlinevirtual

Start all protocol objects.

Calls start() on each protocol object.

Returns
int 0 on success, negative error code on failure.

Reimplemented from dawn::CGenericHandler< CProtoCommon >.

Definition at line 95 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::CProtoHandler::stopAll ( )
inlinevirtual

Stop all protocol objects.

Calls stop() on each protocol object.

Returns
int 0 on success, negative error code on failure.

Reimplemented from dawn::CGenericHandler< CProtoCommon >.

Definition at line 108 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: