LCOV - code coverage report
Current view: directory - frmts/wms - minidriver.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 50 39 78.0 %
Date: 2011-12-18 Functions: 23 10 43.5 %

       1                 : /******************************************************************************
       2                 :  * $Id: minidriver.cpp 21702 2011-02-13 01:30:30Z warmerdam $
       3                 :  *
       4                 :  * Project:  WMS Client Driver
       5                 :  * Purpose:  Implementation of Dataset and RasterBand classes for WMS
       6                 :  *           and other similar services.
       7                 :  * Author:   Adam Nowacki, nowak@xpam.de
       8                 :  *
       9                 :  ******************************************************************************
      10                 :  * Copyright (c) 2007, Adam Nowacki
      11                 :  *
      12                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      13                 :  * copy of this software and associated documentation files (the "Software"),
      14                 :  * to deal in the Software without restriction, including without limitation
      15                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      16                 :  * and/or sell copies of the Software, and to permit persons to whom the
      17                 :  * Software is furnished to do so, subject to the following conditions:
      18                 :  *
      19                 :  * The above copyright notice and this permission notice shall be included
      20                 :  * in all copies or substantial portions of the Software.
      21                 :  *
      22                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      23                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      24                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      25                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      26                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      27                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      28                 :  * DEALINGS IN THE SOFTWARE.
      29                 :  ****************************************************************************/
      30                 : 
      31                 : #include "stdinc.h"
      32                 : 
      33                 : static volatile GDALWMSMiniDriverManager *g_mini_driver_manager = NULL;
      34                 : static void *g_mini_driver_manager_mutex = NULL;
      35                 : 
      36               9 : GDALWMSMiniDriver::GDALWMSMiniDriver() {
      37               9 :     m_parent_dataset = 0;
      38               9 : }
      39                 : 
      40               9 : GDALWMSMiniDriver::~GDALWMSMiniDriver() {
      41               9 : }
      42                 : 
      43               0 : CPLErr GDALWMSMiniDriver::Initialize(CPLXMLNode *config) {
      44               0 :     return CE_None;
      45                 : }
      46                 : 
      47               0 : void GDALWMSMiniDriver::GetCapabilities(GDALWMSMiniDriverCapabilities *caps) {
      48               0 : }
      49                 : 
      50               0 : void GDALWMSMiniDriver::ImageRequest(CPLString *url, const GDALWMSImageRequestInfo &iri) {
      51               0 : }
      52                 : 
      53               0 : void GDALWMSMiniDriver::TiledImageRequest(CPLString *url, const GDALWMSImageRequestInfo &iri, const GDALWMSTiledImageRequestInfo &tiri) {
      54               0 : }
      55                 : 
      56               0 : const char *GDALWMSMiniDriver::GetProjectionInWKT() {
      57               0 :     return NULL;
      58                 : }
      59                 : 
      60            3222 : GDALWMSMiniDriverFactory::GDALWMSMiniDriverFactory() {
      61            3222 : }
      62                 : 
      63            3132 : GDALWMSMiniDriverFactory::~GDALWMSMiniDriverFactory() {
      64            3132 : }
      65                 : 
      66             546 : GDALWMSMiniDriverManager *GetGDALWMSMiniDriverManager() {
      67             546 :     if (g_mini_driver_manager == NULL) {
      68             537 :         CPLMutexHolderD(&g_mini_driver_manager_mutex);
      69             537 :         if (g_mini_driver_manager == NULL) {
      70             537 :             g_mini_driver_manager = new GDALWMSMiniDriverManager();
      71                 :         }
      72             537 :         CPLAssert(g_mini_driver_manager != NULL);
      73                 :     }
      74             546 :     return const_cast<GDALWMSMiniDriverManager *>(g_mini_driver_manager);
      75                 : }
      76                 : 
      77             522 : void DestroyWMSMiniDriverManager()
      78                 : 
      79                 : {
      80             522 :     CPLMutexHolderD(&g_mini_driver_manager_mutex);
      81                 : 
      82             522 :     if( g_mini_driver_manager != 0 )
      83                 :     {
      84             522 :         delete g_mini_driver_manager;
      85             522 :         g_mini_driver_manager = NULL;
      86             522 :     }
      87             522 : }
      88                 : 
      89             537 : GDALWMSMiniDriverManager::GDALWMSMiniDriverManager() {
      90             537 : }
      91                 : 
      92             522 : GDALWMSMiniDriverManager::~GDALWMSMiniDriverManager() {
      93            3654 :     for (std::list<GDALWMSMiniDriverFactory *>::iterator it = m_mdfs.begin(); 
      94                 :          it != m_mdfs.end(); ++it) {
      95            3132 :         GDALWMSMiniDriverFactory *mdf = *it;
      96            3132 :         delete mdf;
      97                 :     }
      98             522 : }
      99                 : 
     100            3222 : void GDALWMSMiniDriverManager::Register(GDALWMSMiniDriverFactory *mdf) {
     101            3222 :     CPLMutexHolderD(&g_mini_driver_manager_mutex);
     102                 : 
     103            3222 :     m_mdfs.push_back(mdf);
     104            3222 : }
     105                 : 
     106               9 : GDALWMSMiniDriverFactory *GDALWMSMiniDriverManager::Find(const CPLString &name) {
     107               9 :     CPLMutexHolderD(&g_mini_driver_manager_mutex);
     108                 : 
     109              29 :     for (std::list<GDALWMSMiniDriverFactory *>::iterator it = m_mdfs.begin(); it != m_mdfs.end(); ++it) {
     110              29 :         GDALWMSMiniDriverFactory *const mdf = *it;
     111              29 :         if (EQUAL(mdf->GetName().c_str(), name.c_str())) return mdf;
     112                 :     }
     113               0 :     return NULL;
     114                 : }

Generated by: LCOV version 1.7