Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

rtxCppContext.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2006 Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00024 /*The following is the text for the main C++ Runtime index page.*/
00047 #ifndef _RTXCPPCONTEXT_H_
00048 #define _RTXCPPCONTEXT_H_
00049 
00050 #include "rtxsrc/rtxCommon.h"
00051 
00057 class EXTERNRTX OSContext {
00058  private:
00059    OSContext (OSCTXT*);
00060  protected:
00065    OSCTXT mCtxt;
00066 
00070    OSUINT32 mCount;
00071 
00075    OSBOOL mbInitialized;
00076 
00077  public:
00082    OSContext ();
00083 
00087    ~OSContext ();
00088 
00094    inline OSCTXT* getPtr () { return &mCtxt; }
00095 
00099    OSUINT32 getRefCount();
00100 
00107    inline int getStatus () const { 
00108       return rtxErrGetFirstError (&mCtxt); 
00109    }
00110 
00115    inline OSBOOL isInitialized () { return mbInitialized; }
00116 
00120    void _ref();
00121 
00125    void _unref();
00126 
00134    char* getErrorInfo ();
00135 
00145    char* getErrorInfo (size_t* pBufSize);
00146 
00163    char* getErrorInfo (char* pBuf, size_t& bufSize);
00164 
00174    inline void* memAlloc (size_t numocts) {
00175       return rtxMemAlloc (&mCtxt, numocts);
00176    }
00177 
00188    inline void* memRealloc (void* ptr, size_t oldnumocts, size_t numocts) {
00189       return rtxMemRealloc (&mCtxt, ptr, oldnumocts, numocts);
00190    }
00191 
00200    inline void memFreePtr (void* ptr) {
00201       rtxMemFreePtr (&mCtxt, ptr);
00202    }
00203 
00208    inline void printErrorInfo () {
00209       rtxErrPrint (&mCtxt);
00210    }
00211 
00216    inline void resetErrorInfo () {
00217       rtxErrReset (&mCtxt);
00218    }
00219 
00225    inline void setDiag (OSBOOL value=TRUE) {
00226       rtxSetDiag (&mCtxt, value);
00227    }
00228 
00229 };
00230 
00237 class EXTERNRTX OSCtxtPtr {
00238  protected:
00243    OSContext* mPointer;
00244 
00245  public:
00252    OSCtxtPtr (OSContext* rf = 0) : mPointer(rf) { 
00253       if (mPointer != 0) mPointer->_ref(); 
00254    }
00255 
00262    OSCtxtPtr (const OSCtxtPtr& o) : mPointer(o.mPointer) {
00263       if (mPointer != 0) mPointer->_ref();
00264    }
00265 
00271    ~OSCtxtPtr() { if (mPointer != 0) mPointer->_unref(); }
00272 
00281    OSCtxtPtr& operator= (const OSCtxtPtr& rf) {
00282       if (mPointer != 0) mPointer->_unref(); 
00283       mPointer = rf.mPointer;
00284       if (mPointer != 0) mPointer->_ref();
00285       return *this;
00286    }
00287 
00292    OSCtxtPtr& operator= (OSContext* rf) {
00293       if (mPointer != 0) mPointer->_unref(); 
00294       mPointer = rf;
00295       if (mPointer != 0) mPointer->_ref();
00296       return *this;
00297    }
00298 
00302    operator OSContext* () { return mPointer; }
00303    operator const OSContext* () const { return mPointer; }
00304 
00308    OSContext* operator -> () { return mPointer; }
00309    const OSContext* operator -> () const { return mPointer; }
00310 
00314    OSBOOL operator == (const OSContext* o) const { 
00315       return (mPointer == o); 
00316    }
00317 
00321    inline OSBOOL isNull() const { return (mPointer == 0); }
00322 
00327    inline OSCTXT* getCtxtPtr() { return mPointer->getPtr(); }
00328 
00329 };
00330 
00331 #endif

This file was last modified on 8 Jan 2007.
XBinder, Version 1.1.9