#ifndef _RWEXCEPT_H_ //-*-c++-*-
#define _RWEXCEPT_H_

//----------------------------------------------------------------------
//  rwexcept.h
//   Header file containing definitions for a very basic class to 
//   intercept and handle RogueWave exceptions (for compilers that
//   do not support C++ exceptions).
//
//      Unpublished Confidential Information of Hewlett-Packard
//      Company. Do not disclose.  Copyright (c) Hewlett-Packard
//      Company 1995. All rights reserved
// 
// The contents of this software are proprietary and confidential to
// the Hewlett- Packard Company, and are limited in distribution to
// those with a direct need to know.  Individuals having access to
// this software are responsible for maintaining the confidentiality
// of the content and for keeping the software secure when not in use.
// Transfer to any party is strictly forbidden other than as expressly
// permitted in writing by Hewlett-Packard Company.  Unauthorized
// transfer to or possession by any unauthorized party may be a
// criminal offense.
//
//                  RESTRICTED RIGHTS LEGEND
//
//      Use,  duplication,  or disclosure by the U. S. Government is
//      subject to restrictions as set forth in subparagraph (c) (1)
//      (ii) in the Rights in Technical Data and Computer Software
//      clause in DFARS 252.227-7013 or any other successor clause.
//
//                      HEWLETT-PACKARD COMPANY
//                      3000 Hanover St.
//                      Palo Alto, CA  94304 U.S.A.
//
//      Rights for non-DOD U.S. Government Departments and Agencies
//      are as set forth in FAR 52.227-19 (c) (1,2) or any other
//      successor clause.
//
//  CLASSES:
//   rwExceptionHandler
//  
//----------------------------------------------------------------------
// $Source: /projects/HMS/nsr/udfCore/sys/rwexcept.h,v $
// $Revision: 1.3 $     $Author: hmgr $
// $State: Exp $        $Locker:  $
// $Date: 96/06/13 16:47:34 $
//

#include <rw/rwerr.h>
#include <rw/cstring.h>
    
typedef void    (*oldRWHandler)(const RWxmsg&);

class rwExceptionHandler
{
    //-------------------------------------------------------------------------
    // Public methods
    //-------------------------------------------------------------------------

    public:

                        rwExceptionHandler();
                        ~rwExceptionHandler();
    int                 operator()(void) const 
                        { 
                            return caughtException_; 
                        }
    const char *        errMessage(void) const 
                        { 
                            return (const char *) theMessage_; 
                        }

    //-------------------------------------------------------------------------
    // Private methods
    //-------------------------------------------------------------------------

    private:

    static void         handler(const RWxmsg& msg);

    //-------------------------------------------------------------------------
    // Private data members
    //-------------------------------------------------------------------------

    private:

    static oldRWHandler oldHandler_;
    static int          caughtException_;
    static int          references_;
    static RWCString    theMessage_;
};

#endif  // _RWEXCEPT_H_
