LTP GCOV extension - code coverage report
Current view: directory - frmts/pcidsk/sdk/core - mutexholder.h
Test: gdal_filtered.info
Date: 2010-07-12 Instrumented lines: 9
Code covered: 100.0 % Executed lines: 9

       1                 : /******************************************************************************
       2                 :  *
       3                 :  * Purpose:  MutexHolder class. Helper class for controlling the acquisition
       4                 :  *           and release of a Mutex based on current context.
       5                 :  * 
       6                 :  ******************************************************************************
       7                 :  * Copyright (c) 2009
       8                 :  * PCI Geomatics, 50 West Wilmot Street, Richmond Hill, Ont, Canada
       9                 :  *
      10                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      11                 :  * copy of this software and associated documentation files (the "Software"),
      12                 :  * to deal in the Software without restriction, including without limitation
      13                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      14                 :  * and/or sell copies of the Software, and to permit persons to whom the
      15                 :  * Software is furnished to do so, subject to the following conditions:
      16                 :  *
      17                 :  * The above copyright notice and this permission notice shall be included
      18                 :  * in all copies or substantial portions of the Software.
      19                 :  *
      20                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      21                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      22                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      23                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      24                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      25                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      26                 :  * DEALINGS IN THE SOFTWARE.
      27                 :  ****************************************************************************/
      28                 : #ifndef __INCLUDE_CORE_MUTEXHOLDER_H
      29                 : #define __INCLUDE_CORE_MUTEXHOLDER_H
      30                 : 
      31                 : #include "pcidsk_mutex.h"
      32                 : 
      33                 : namespace PCIDSK
      34                 : {
      35                 :     /************************************************************************/
      36                 :     /*                             MutexHolder                              */
      37                 :     /************************************************************************/
      38                 :     class PCIDSK_DLL MutexHolder
      39                 :     {
      40                 :     public:
      41            2207 :         MutexHolder( Mutex *mutex ) 
      42                 :         { 
      43            2207 :             this->mutex = mutex; 
      44            2207 :             if( mutex != NULL )
      45            2207 :                 mutex->Acquire(); 
      46            2207 :         }
      47            2207 :         ~MutexHolder() 
      48                 :         { 
      49            2207 :             if( mutex )
      50            2207 :                 mutex->Release(); 
      51            2207 :         }
      52                 :     
      53                 :     private:
      54                 :         Mutex     *mutex;
      55                 : 
      56                 :     };
      57                 : 
      58                 : } //end namespace PCIDSK
      59                 : 
      60                 : #endif // __INCLUDE_CORE_MUTEXHOLDER_H

Generated by: LTP GCOV extension version 1.5