reSIProcate/rutil  9694
Lock.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_LOCK_HXX)
00002 #define RESIP_LOCK_HXX  
00003 
00004 #include "rutil/Lockable.hxx"
00005 
00006 namespace resip
00007 {
00008 
00009 enum LockType
00010 {
00011    VOCAL_LOCK = 0,
00012    VOCAL_READLOCK,
00013    VOCAL_WRITELOCK
00014 };
00015 
00022 class Lock
00023 {
00024    public:
00029       Lock(Lockable &, LockType = VOCAL_LOCK);
00030       virtual ~Lock();
00031 
00032    private:
00033       Lockable&   myLockable;
00034 };
00035 
00036 class ReadLock : public Lock
00037 {
00038    public:
00039       ReadLock(Lockable &);
00040 };
00041 
00042 class WriteLock : public Lock
00043 {
00044    public:
00045       WriteLock(Lockable &);
00046 };
00047 
00048 
00049 
00055 class PtrLock
00056 {
00057    public:
00058       PtrLock(Lockable*, LockType = VOCAL_LOCK);
00059       virtual ~PtrLock();
00060 
00061    private:
00062       Lockable*   myLockable;
00063 };
00064 
00065 }       // namespace resip
00066 
00067 #endif
00068 
00069 /* ====================================================================
00070  * The Vovida Software License, Version 1.0 
00071  * 
00072  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00073  * 
00074  * Redistribution and use in source and binary forms, with or without
00075  * modification, are permitted provided that the following conditions
00076  * are met:
00077  * 
00078  * 1. Redistributions of source code must retain the above copyright
00079  *    notice, this list of conditions and the following disclaimer.
00080  * 
00081  * 2. Redistributions in binary form must reproduce the above copyright
00082  *    notice, this list of conditions and the following disclaimer in
00083  *    the documentation and/or other materials provided with the
00084  *    distribution.
00085  * 
00086  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00087  *    and "Vovida Open Communication Application Library (VOCAL)" must
00088  *    not be used to endorse or promote products derived from this
00089  *    software without prior written permission. For written
00090  *    permission, please contact vocal@vovida.org.
00091  *
00092  * 4. Products derived from this software may not be called "VOCAL", nor
00093  *    may "VOCAL" appear in their name, without prior written
00094  *    permission of Vovida Networks, Inc.
00095  * 
00096  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00097  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00098  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00099  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00100  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00101  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00102  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00103  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00104  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00105  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00106  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00107  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00108  * DAMAGE.
00109  * 
00110  * ====================================================================
00111  * 
00112  * This software consists of voluntary contributions made by Vovida
00113  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00114  * Inc.  For more information on Vovida Networks, Inc., please see
00115  * <http://www.vovida.org/>.
00116  *
00117  */