#ifndef _TYPEINFO_
#define _TYPEINFO_

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(level, E)
#endif
#pragma info(restore)

#if __IBMCPP__ < 400
#error This file to be used only with IBM VisualAge C++ v4 and later compilers.
#endif /* __IBMCPP__ */

#pragma namemangling(ansi)

   /********************************************************************/
   /*  <typeinfo> header file                                          */
   /*                                                                  */
   /*  VisualAge C++, Version 4.0                                      */
   /*    Licensed Material - Property of IBM                           */
   /*                                                                  */
   /*  5801-AAR and Other Materials                                    */
   /*                                                                  */
   /*  (c) Copyright IBM Corp 1991, 1998. All rights reserved.         */
   /*                                                                  */
   /*                                                                  */
   /*  Licensed Materials.                                             */
   /*                                                                  */
   /*  Dinkum C++ Library                                              */
   /*  Copyright (c) 1998.  Licensed to IBM Corp. and its suppliers.   */
   /*                                                                  */
   /********************************************************************/

#include <exception>
#include <string.h>
_STD_BEGIN

class type_info {
  public:
    virtual             ~type_info();
    bool                operator==(const type_info&) const;
    bool                operator!=(const type_info&) const;
    bool                before(const type_info&) const;
    const char*         name() const;

  private:
                        type_info(const type_info&);
    type_info&          operator=(const type_info&);

  protected:
    char *              typeName;
    char *              mangledName;
};

inline const char * type_info::name() const {
  return typeName;
}

inline bool type_info::operator==(const type_info&x) const {
  return (&x==this) || (strcmp(x.mangledName,this->mangledName)==0);
}

inline bool type_info::operator!=(const type_info&x) const {
  return (&x!=this) && (strcmp(x.mangledName,this->mangledName)!=0);
}

inline bool type_info::before(const type_info&x) const {
  return (&x!=this) && (strcmp(x.mangledName,this->mangledName)>=0);
}

                // CLASS bad_cast
class bad_cast : public exception {
public:
        bad_cast(const char *_S = "bad cast") _THROW0()
                : exception(_S) {}
        virtual ~bad_cast() _THROW0()
                {}
protected:
        virtual void _Doraise() const
                {_RAISE(*this); }
        };
                // CLASS bad_typeid
class bad_typeid : public exception {
public:
        bad_typeid(const char *_S = "bad typeid") _THROW0()
                : exception(_S) {}
        virtual ~bad_typeid() _THROW0()
                {}
protected:
        virtual void _Doraise() const
                {_RAISE(*this); }
        };
                //Class __non_rtti_object
class __non_rtti_object : public bad_typeid{
public:
        __non_rtti_object( const char *_S = "non rtti object") _THROW0()
                : bad_typeid( _S ) {}
        };

_STD_END

#pragma namemangling()

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(pop)
#endif
#pragma info(restore)

#endif /* _TYPE_INFO_ */

/*
 * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
 * Consult your license regarding permissions and restrictions.
 */
