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

#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
1 void
2 svr_start( const struct RKH_SMA_T *me, RKH_EVT_T *pe )
3 {
4  START_EVT_T *e_start;
5 
6  e_start = RKH_ALLOC_EVT( START_EVT_T, START, me );
7  e_start->clino = RKH_CAST(REQ_EVT_T, pe)->clino;
8  RKH_SMA_POST_FIFO( RKH_GET_SMA( RKH_CAST(REQ_EVT_T, pe)->clino ),
9  RKH_EVT_CAST(e_start), me );
10 }

Definition at line 105 of file rkhfwk_cast.h.