RKH
rkhfwk_cast.h File Reference

Defines casting operations which are internally used by RKH. More...

#include "rkhtype.h"
#include "rkhcfg.h"
Include dependency graph for rkhfwk_cast.h:

Go to the source code of this file.

Macros

#define RKH_UPCAST(BaseType_, me_)   ((BaseType_ *)me_)
 Convert a pointer to a base-class. More...
 
#define RKH_DOWNCAST(DerivedType_, me_)   ((DerivedType_ *)me_)
 Converts a base-class pointer to a derived-class pointer.
 
#define RKH_CAST(_type, _obj)   ((_type *)(_obj))
 Perform downcast of a reference of a base class to one of its derived classes. More...
 

Detailed Description

Defines casting operations which are internally used by RKH.

Definition in file rkhfwk_cast.h.

Macro Definition Documentation

◆ RKH_CAST

#define RKH_CAST (   _type,
  _obj 
)    ((_type *)(_obj))

Perform downcast of a reference of a base class to one of its derived classes.

See also
single inheritance in C , and another example .
Usage
void
svr_start( const struct RKH_SMA_T *me, RKH_EVT_T *pe )
{
START_EVT_T *e_start;
e_start = RKH_ALLOC_EVT( START_EVT_T, START, me );
e_start->clino = RKH_CAST(REQ_EVT_T, pe)->clino;
RKH_SMA_POST_FIFO( RKH_GET_SMA( RKH_CAST(REQ_EVT_T, pe)->clino ),
RKH_EVT_CAST(e_start), me );
}
#define RKH_SMA_POST_FIFO(me_, e_, sender_)
Invoke the direct event posting facility rkh_sma_post_fifo(). If RKH_CFG_SMA_VFUNCT_EN is set RKH_ENA...
Definition: rkhsma.h:450
#define RKH_EVT_CAST(_e)
Perform cast to pointer to RKH event structure (RKH_EVT_T*).
Definition: rkhevt.h:77
#define RKH_ALLOC_EVT(et, e, sender_)
This macro dynamically creates a new event of type et with its signal.
#define RKH_CAST(_type, _obj)
Perform downcast of a reference of a base class to one of its derived classes.
Definition: rkhfwk_cast.h:107
#define RKH_GET_SMA(_prio)
Retrieves the address of an registered active object (SMA) according to its priority.
Definition: rkhsma.h:704
Represents events without parameters.
Definition: rkhevt.h:170
Describes the SMA (active object in UML).
Definition: rkhsma.h:772

Definition at line 107 of file rkhfwk_cast.h.