_msoDerive

Macro group for simple installation of an object succession

#include <mso/Derive.h>

Macro
* _msoDeriveFrom( basetype )
  Defines the base member.  The name of the base member is, e.g.,  
  _baseMxxObject for the MxxObject format.  This is used in the
  structure. 

* _msoBaseOffset( basetype, drvtype )
  Returns the offset of the base member in u8 units

* _msoDownCast( drvtype, basetype, ptr )
  Casts the base type pointer "ptr" to the pointer for the derivative 
  type "drvtype"

* _msoUpCast( basetype, ptr )
  Casts the derivative type pointer "ptr" to the base type pointer

Usage Example
* Derive MxxResource from MxxObject as follows.
  typedef struct _MxxResource
  {
    _msoDeriveFrom( MxxObject );
    ....
  } MxxResource;

* Obtain the pointer for the derivative type MxxResource from the base 
  type MxxObject as follows.
  res_ptr = _msoDownCast( MxxResource, MxxObject, obj_ptr );

* Conversely, obtain the pointer for the base type MxxObject from the 
  derivative type MxxResource as follows. 
  obj_ptr = _msoUpCast( MxxObject, res_ptr );