oaMutex.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // *****************************************************************************
00003 // oaMutex.h
00004 //
00005 // This file contains the definitions for the oaMutexBase, oaMutex and 
00006 // derived classes.
00007 //
00008 // oaMutex:
00009 //  This is an abstract base class for the oaMutex lock object which defines
00010 //  the common interfaces for the lock object.
00011 //
00012 // oaSpinMutex:
00013 //  This is an abstract base class for the oaSpinMutex object which defines
00014 //  the common interfaces for a spin lock object.
00015 //  
00016 // oaRWLock:
00017 //  This is an abstract base class for the oaRWLock object which defines
00018 //  the common interfaces for a read/write lock object.
00019 //
00020 // *****************************************************************************
00021 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00022 // Integration Initiative, this material may not be copied, modified,
00023 // re-published, uploaded, executed, or distributed in any way, in any medium,
00024 // in whole or in part, without prior written permission from Cadence.
00025 //
00026 //                Copyright 2003-2008 Cadence Design Systems, Inc.
00027 //                           All Rights Reserved.
00028 //
00029 //  $Author: icftcm $
00030 //  $Revision: #1 $
00031 //  $Date: 2010/08/09 $
00032 //  $State: $
00033 // *****************************************************************************
00034 // *****************************************************************************
00035 
00036 
00037 
00038 #if !defined(oaMutexPvt_P)
00039 #define oaMutexPvt_P
00040 
00041 
00042 
00043 // *****************************************************************************
00044 // Nested includes
00045 // *****************************************************************************
00046 #include "oaBaseTypes.h"
00047 
00048 
00049 
00050 // *****************************************************************************
00051 // Declare and define types in the OpenAccess namespace.
00052 // *****************************************************************************
00053 BEGIN_OA_NAMESPACE
00054 
00055 
00056 
00057 // *****************************************************************************
00058 // oaMutexBase
00059 // *****************************************************************************
00060 class OA_BASE_DLL_PVT oaMutexBase {
00061 public:
00062     virtual oaBoolean       isLockEnabled() const = 0;
00063     virtual void            setLockEnabled(oaBoolean onOrOff) = 0;
00064 
00065     virtual oaUInt8         calcVMSize() const = 0;
00066 
00067 protected:
00068     virtual                 ~oaMutexBase();
00069 };
00070 
00071 
00072 
00073 // *****************************************************************************
00074 // oaMutex
00075 // *****************************************************************************
00076 class OA_BASE_DLL_PVT oaMutex : virtual public oaMutexBase {
00077 public:
00078     virtual void            lock() = 0;
00079     virtual void            unlock() = 0;
00080 
00081 protected:
00082                             oaMutex();
00083     virtual                 ~oaMutex();
00084 
00085                             oaMutex(const oaMutex &src);
00086     oaMutex                 &operator=(const oaMutex &src);
00087 };
00088 
00089 
00090 
00091 // *****************************************************************************
00092 // oaSpinMutex
00093 // *****************************************************************************
00094 class OA_BASE_DLL_PVT oaSpinMutex : virtual public oaMutexBase {
00095 public:
00096     virtual void            lock() = 0;
00097     virtual void            unlock() = 0;
00098 
00099 protected:
00100                             oaSpinMutex();
00101     virtual                 ~oaSpinMutex();
00102 
00103                             oaSpinMutex(const oaSpinMutex &src);
00104     oaSpinMutex             &operator=(const oaSpinMutex &src);
00105 };
00106 
00107 
00108 
00109 // *****************************************************************************
00110 // oaRWLock
00111 // *****************************************************************************
00112 class OA_BASE_DLL_PVT oaRWLock : virtual public oaMutexBase {
00113 public:
00114     enum oaRWLockTypeEnum {
00115         oacWriteLockTypeEnum    = 0,
00116         oacReadLockTypeEnum     = 1
00117     };
00118 
00119     virtual void            lock(oaRWLockTypeEnum type) = 0;
00120     virtual void            unlock(oaRWLockTypeEnum type) = 0;
00121 
00122 protected:
00123                             oaRWLock();
00124     virtual                 ~oaRWLock();
00125 
00126                             oaRWLock(const oaRWLock &src);
00127     oaRWLock                &operator=(const oaRWLock &src);
00128 };
00129 
00130 
00131 
00132 END_OA_NAMESPACE
00133 
00134 #endif
00135 
00136 

Return to top of page