RKH
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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

#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 );
}

Definition at line 105 of file rkhfwk_cast.h.