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-2004 by 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  *****************************************************************************/
00028 #ifndef _RTXCPPCONTEXT_H_
00029 #define _RTXCPPCONTEXT_H_
00030 
00031 #include "rtxsrc/rtxCommon.h"
00032 
00038 class EXTERNRTX OSContext {
00039  private:
00040    OSContext (OSCTXT*);
00041  protected:
00046    OSCTXT mCtxt;
00047 
00051    OSUINT32 mCount;
00052 
00053  public:
00058    OSContext ();
00059 
00063    ~OSContext ();
00064 
00070    inline OSCTXT* getPtr () { return &mCtxt; }
00071 
00075    OSUINT32 getRefCount();
00076 
00080    void _ref();
00081 
00085    void _unref();
00086 
00087 };
00088 
00095 class EXTERNRTX OSCtxtPtr {
00096  protected:
00101    OSContext* mPointer;
00102 
00103  public:
00110    OSCtxtPtr (OSContext* rf = 0) : mPointer(rf) { 
00111       if (mPointer != 0) mPointer->_ref(); 
00112    }
00113 
00120    OSCtxtPtr (const OSCtxtPtr& o) : mPointer(o.mPointer) {
00121       if (mPointer != 0) mPointer->_ref();
00122    }
00123 
00129    ~OSCtxtPtr() { if (mPointer != 0) mPointer->_unref(); }
00130 
00139    OSCtxtPtr& operator= (const OSCtxtPtr& rf) {
00140       if (mPointer != 0) mPointer->_unref(); 
00141       mPointer = rf.mPointer;
00142       if (mPointer != 0) mPointer->_ref();
00143       return *this;
00144    }
00145 
00150    OSCtxtPtr& operator= (OSContext* rf) {
00151       if (mPointer != 0) mPointer->_unref(); 
00152       mPointer = rf;
00153       if (mPointer != 0) mPointer->_ref();
00154       return *this;
00155    }
00156 
00160    operator OSContext* () { return mPointer; }
00161    operator const OSContext* () const { return mPointer; }
00162 
00166    OSContext* operator -> () { return mPointer; }
00167    const OSContext* operator -> () const { return mPointer; }
00168 
00172    OSBOOL operator == (const OSContext* o) const { 
00173       return (mPointer == o); 
00174    }
00175 
00179    inline OSBOOL isNull() const { return (mPointer == 0); }
00180 
00185    inline OSCTXT* getCtxtPtr() { return mPointer->getPtr(); }
00186 
00187 };
00188 
00189 #endif

This file was last modified on 1 Jun 2004.
XBinder, Version 1.0.0