home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tlx501.zip / RTTI.H < prev    next >
C/C++ Source or Header  |  1996-01-05  |  2KB  |  52 lines

  1. /****************************************************************************
  2.     $Id: rtti.h 501.0 1995/03/07 12:26:46 RON Exp $
  3.  
  4.     Copyright (c) 1991-95 Tarma Software Research. All rights reserved.
  5.  
  6.     Project:    Tarma Library for C++ V5.0
  7.     Author:    Ron van der Wal
  8.  
  9.     Declarations for RTTI-related matters. Basically, this file contains
  10.     macros that allow use of RTTI-like expressions even if the compiler
  11.     does not yet support it. In those cases, the expressions are turned
  12.     into simple (static) casts etc.
  13.  
  14.     $Log: rtti.h $
  15.     Revision 501.0  1995/03/07 12:26:46  RON
  16.     Updated for TLX 5.01
  17.     Revision 1.3  1995/01/31 16:29:24  RON
  18.     Update for release 012
  19.     Added partial support for SunPro C++ compiler
  20.     Revision 1.2  1994/09/06  13:58:34  ron
  21.     Added macros for all of the new-style C++ casts
  22.  
  23.     Revision 1.1  1994/08/16  18:06:51  ron
  24.     Initial revision
  25.  
  26. ****************************************************************************/
  27.  
  28. #ifndef _TLX_RTTI_H
  29. #define _TLX_RTTI_H
  30.  
  31. #ifdef _NORTTI        //-----    Compiler does not support RTTI
  32.  
  33. #define TYPEID(T)       # T
  34.  
  35. #define DYNACAST(T, v)    ((T)(v))
  36. #define CONSTCAST(T, v)    ((T)(v))
  37. #define STATCAST(T, v)    ((T)(v))
  38. #define RECAST(T, v)    ((T)(v))
  39.  
  40. #else            //-----    Compiler supports RTTI
  41.  
  42. #define TYPEID(T)       typeid(T)
  43.  
  44. #define DYNACAST(T, v)    dynamic_cast<T>(v)
  45. #define CONSTCAST(T, v)    const_cast<T>(v)
  46. #define STATCAST(T, v)    static_cast<T>(v)
  47. #define RECAST(T, v)    reinterpret_cast<T>(v)
  48.  
  49. #endif    // _NORTTI
  50.  
  51. #endif    // _TLX_RTTI_H
  52.