Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

plocktraits.h

Go to the documentation of this file.
00001 /*
00002  *   P::Classes - Portable C++ Application Framework
00003  *   Copyright (C) 2000-2004  Christian Prochnow <cproch@seculogix.de>
00004  *
00005  *   This library is free software; you can redistribute it and/or
00006  *   modify it under the terms of the GNU Lesser General Public
00007  *   License as published by the Free Software Foundation; either
00008  *   version 2 of the License, or (at your option) any later version.
00009  *
00010  *   This library is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *   Lesser General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU Lesser General Public
00016  *   License along with this library; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  */
00020 
00021 #ifndef _plocktraits_h_
00022 #define _plocktraits_h_
00023 
00024 #include <pclasses/pcriticalsection.h>
00025 #include <pclasses/pmutex.h>
00026 #include <pclasses/prwlock.h>
00027 
00028 namespace P {
00029 
00031 
00035 class VoidMutex {
00036   public:
00037     VoidMutex() { }
00038     ~VoidMutex() { }
00039 
00041 
00045     class Lock {
00046       public:
00047         Lock(VoidMutex&) { }
00048         ~Lock() { }
00049     };
00050 };
00051 
00053 
00057 template <class _T>
00058 struct LockTraits {
00059   typedef VoidMutex MutexType;
00060   typedef VoidMutex::Lock ReadLock;
00061   typedef VoidMutex::Lock WriteLock;
00062 };
00063 
00065 
00069 template <>
00070 struct LockTraits<CriticalSection> {
00071   typedef CriticalSection MutexType;
00072   typedef CriticalSection::Lock ReadLock;
00073   typedef CriticalSection::Lock WriteLock;
00074 };
00075 
00077 
00081 template <>
00082 struct LockTraits<Mutex> {
00083   typedef Mutex MutexType;
00084   typedef Mutex::Lock ReadLock;
00085   typedef Mutex::Lock WriteLock;
00086 };
00087 
00089 
00093 template <>
00094 struct LockTraits<RWLock> {
00095   typedef RWLock MutexType;
00096   typedef RWLock::ReadLock ReadLock;
00097   typedef RWLock::WriteLock WriteLock;
00098 };
00099 
00100 }
00101 
00102 #endif

Generated on Fri Mar 12 21:08:31 2004 for P::Classes by doxygen 1.3.3