home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 February
/
PCWorld_2000-02_cd.bin
/
Software
/
TemaCD
/
tcvpa
/
data1.cab
/
MyFileGroup
/
INCLUDE
/
ProcCtrl.hpp
< prev
next >
Wrap
C/C++ Source or Header
|
1999-06-03
|
4KB
|
118 lines
#ifndef _INC_PROCCTRL_HPP
#define _INC_PROCCTRL_HPP
class TC_CPsCurrentThread;
class TC_CPsException;
#define TC_PS_EXCEPTION_ID "TC_CPsException"
#define TC_PS_ASSERT assert
#define TC_PS_CURR_THREAD TC_CPsCurrentThread::GetCurrent()
#define TC_PS_SET_THR_EX TC_PS_CURR_THREAD->SetPsException
#define TC_PS_CLEAR_THR_EX TC_PS_CURR_THREAD->ClearException
#define TC_PS_TRACE_OBJ 0x00000001
#define TC_PS_TRACE_DRV 0x00000002
#define TC_PS_TRACE_GRAPH 0x00000004
#define TC_PS_TRACE_QUERY 0x00000008
#define TC_PS_TRACE_THREAD 0x00000010
#define TC_PS_TRACE_TX 0x00000020
extern long tcPsTraceFlags ;
TC_PS_EXPORT void tcPsEnableException (BOOL set) ;
TC_PS_EXPORT BOOL tcPsIsExceptionEnabled () ;
// **********************************************************************
class TC_CPsProcControl
{
public: static void OnProcBegin () ;
public: static void OnProcEnd () ;
public: static void OnThreadBegin () ;
public: static void OnThreadEnd () ;
}; // end of class TC_CPsProcControl
// **********************************************************************
// **********************************************************************
class TC_PS_EXPORT TC_CPsCurrentThread
{
friend class TC_CPsProcControl;
friend class TC_CPsWorkContext;
friend TC_PS_EXPORT void tcPsTrace (const char*, ...);
private: static TC_TKeyList <TC_CPsCurrentThread> m_Chain ;
private: static TC_CLock m_Lock ;
private: TC_TKeyNode <TC_CPsCurrentThread> m_Node ;
private: void * m_ThreadData ;
public: BOOL m_IsExEnabled ;
public: TC_CExHolder m_ExHolder ;
private: TC_CPsCurrentThread () ;
private: ~TC_CPsCurrentThread () ;
private: static void Register (BOOL is_main=FALSE) ;
private: static void UnRegister (BOOL is_main=FALSE) ;
public: static TC_CPsCurrentThread * GetCurrent () ;
public: static TC_CPsCurrentThread * _GetCurrent () ;
public: void SetException (TC_CException * ex) ;
public: void SetPsException (TCPsRetCode error, long drv_error = 0, const char * drv_msg = 0) ;
public: void GetPsException (TC_CPsException & ex) ;
public: void ClearException () ;
public: void * GetThreadData () ;
public: static void Trace () ;
}; // end of class TC_CPsCurrentThread
// **********************************************************************
// **********************************************************************
class TC_PS_EXPORT TC_CPsException
: public TC_CException
{
public: TCPsRetCode m_Error ;
public: long m_DrvError ;
public: TC_CString m_DrvMsg ;
public: TC_CPsException (TC_CPsException &ex) ;
public: TC_CPsException (TCPsRetCode error, long drv_error = 0, const char * drv_msg = 0) ;
public: virtual ~TC_CPsException () ;
public: TC_CPsException& operator = (TC_CPsException &ex) ;
}; // end of class TC_CPsException
// **********************************************************************
// **********************************************************************
class TC_CPsTmpExDisable
{
public: BOOL m_IsEnabled ;
public: TC_CPsTmpExDisable () ;
public: ~TC_CPsTmpExDisable () ;
public: void Regain () ;
}; // end of class TC_CPsTmpExDisable
// **********************************************************************
// **********************************************************************
class TC_CFile
{
private: FILE * m_File ;
public: TC_CFile () ;
public: ~TC_CFile () ;
public: BOOL Open ( const char * fname, const char * mode) ;
public: BOOL IsOpen () ;
public: void Close () ;
public: BOOL WStr (const char * str) ;
}; // end of class TC_CFile
// **********************************************************************
#define TC_PS_TRACEOUT_FILE 0
#define TC_PS_TRACEOUT_SCREEN 1
TC_PS_EXPORT void tcPsTrace (const char * fmt, ... ) ;
TC_PS_EXPORT void tcPsSetTrace (long set, int output = 0) ;
TC_PS_EXPORT long tcPsGetTrace () ;
TC_PS_EXPORT TCPsRetCode tcPsThrow (TC_CPsException& ex) ;
#ifdef TC_PS_THROW
#undef TC_PS_THROW
#endif
#define TC_PS_THROW(ps_retcode) { return tcPsThrow(TC_CPsException( (ps_retcode),0,0) ); }
#define TC_PS_THROW_NULL(ps_retcode,type) { return (type*)tcPsThrow(TC_CPsException((ps_retcode),0,0)); }
#define TC_PS_THROW_FALSE(ps_retcode) { tcPsThrow(TC_CPsException((ps_retcode),0,0)); return FALSE; }
#endif // _INC_PROCCTRL_HPP