1 : /******************************************************************************
2 : * $Id: minidriver.cpp 23722 2012-01-07 22:15:29Z rouault $
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 14 : GDALWMSMiniDriver::GDALWMSMiniDriver() {
37 14 : m_parent_dataset = 0;
38 14 : }
39 :
40 14 : GDALWMSMiniDriver::~GDALWMSMiniDriver() {
41 14 : }
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 : void GDALWMSMiniDriver::GetTiledImageInfo(CPLString *url,
57 : const GDALWMSImageRequestInfo &iri,
58 : const GDALWMSTiledImageRequestInfo &tiri,
59 : int nXInBlock,
60 : int nYInBlock)
61 : {
62 0 : }
63 :
64 0 : const char *GDALWMSMiniDriver::GetProjectionInWKT() {
65 0 : return NULL;
66 : }
67 :
68 3366 : GDALWMSMiniDriverFactory::GDALWMSMiniDriverFactory() {
69 3366 : }
70 :
71 3252 : GDALWMSMiniDriverFactory::~GDALWMSMiniDriverFactory() {
72 3252 : }
73 :
74 575 : GDALWMSMiniDriverManager *GetGDALWMSMiniDriverManager() {
75 575 : if (g_mini_driver_manager == NULL) {
76 561 : CPLMutexHolderD(&g_mini_driver_manager_mutex);
77 561 : if (g_mini_driver_manager == NULL) {
78 561 : g_mini_driver_manager = new GDALWMSMiniDriverManager();
79 : }
80 561 : CPLAssert(g_mini_driver_manager != NULL);
81 : }
82 575 : return const_cast<GDALWMSMiniDriverManager *>(g_mini_driver_manager);
83 : }
84 :
85 542 : void DestroyWMSMiniDriverManager()
86 :
87 : {
88 542 : CPLMutexHolderD(&g_mini_driver_manager_mutex);
89 :
90 542 : if( g_mini_driver_manager != 0 )
91 : {
92 542 : delete g_mini_driver_manager;
93 542 : g_mini_driver_manager = NULL;
94 542 : }
95 542 : }
96 :
97 561 : GDALWMSMiniDriverManager::GDALWMSMiniDriverManager() {
98 561 : }
99 :
100 542 : GDALWMSMiniDriverManager::~GDALWMSMiniDriverManager() {
101 3794 : for (std::list<GDALWMSMiniDriverFactory *>::iterator it = m_mdfs.begin();
102 : it != m_mdfs.end(); ++it) {
103 3252 : GDALWMSMiniDriverFactory *mdf = *it;
104 3252 : delete mdf;
105 : }
106 542 : }
107 :
108 3366 : void GDALWMSMiniDriverManager::Register(GDALWMSMiniDriverFactory *mdf) {
109 3366 : CPLMutexHolderD(&g_mini_driver_manager_mutex);
110 :
111 3366 : m_mdfs.push_back(mdf);
112 3366 : }
113 :
114 14 : GDALWMSMiniDriverFactory *GDALWMSMiniDriverManager::Find(const CPLString &name) {
115 14 : CPLMutexHolderD(&g_mini_driver_manager_mutex);
116 :
117 50 : for (std::list<GDALWMSMiniDriverFactory *>::iterator it = m_mdfs.begin(); it != m_mdfs.end(); ++it) {
118 50 : GDALWMSMiniDriverFactory *const mdf = *it;
119 50 : if (EQUAL(mdf->GetName().c_str(), name.c_str())) return mdf;
120 : }
121 0 : return NULL;
122 : }
|