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 26 : GDALWMSMiniDriver::GDALWMSMiniDriver() {
37 26 : m_parent_dataset = 0;
38 26 : }
39 :
40 26 : GDALWMSMiniDriver::~GDALWMSMiniDriver() {
41 26 : }
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 6558 : GDALWMSMiniDriverFactory::GDALWMSMiniDriverFactory() {
69 6558 : }
70 :
71 6342 : GDALWMSMiniDriverFactory::~GDALWMSMiniDriverFactory() {
72 6342 : }
73 :
74 1119 : GDALWMSMiniDriverManager *GetGDALWMSMiniDriverManager() {
75 1119 : if (g_mini_driver_manager == NULL) {
76 1093 : CPLMutexHolderD(&g_mini_driver_manager_mutex);
77 1093 : if (g_mini_driver_manager == NULL) {
78 1093 : g_mini_driver_manager = new GDALWMSMiniDriverManager();
79 : }
80 1093 : CPLAssert(g_mini_driver_manager != NULL);
81 : }
82 1119 : return const_cast<GDALWMSMiniDriverManager *>(g_mini_driver_manager);
83 : }
84 :
85 1057 : void DestroyWMSMiniDriverManager()
86 :
87 : {
88 1057 : CPLMutexHolderD(&g_mini_driver_manager_mutex);
89 :
90 1057 : if( g_mini_driver_manager != 0 )
91 : {
92 1057 : delete g_mini_driver_manager;
93 1057 : g_mini_driver_manager = NULL;
94 1057 : }
95 1057 : }
96 :
97 1093 : GDALWMSMiniDriverManager::GDALWMSMiniDriverManager() {
98 1093 : }
99 :
100 1057 : GDALWMSMiniDriverManager::~GDALWMSMiniDriverManager() {
101 7399 : for (std::list<GDALWMSMiniDriverFactory *>::iterator it = m_mdfs.begin();
102 : it != m_mdfs.end(); ++it) {
103 6342 : GDALWMSMiniDriverFactory *mdf = *it;
104 6342 : delete mdf;
105 : }
106 1057 : }
107 :
108 6558 : void GDALWMSMiniDriverManager::Register(GDALWMSMiniDriverFactory *mdf) {
109 6558 : CPLMutexHolderD(&g_mini_driver_manager_mutex);
110 :
111 6558 : m_mdfs.push_back(mdf);
112 6558 : }
113 :
114 26 : GDALWMSMiniDriverFactory *GDALWMSMiniDriverManager::Find(const CPLString &name) {
115 26 : CPLMutexHolderD(&g_mini_driver_manager_mutex);
116 :
117 98 : for (std::list<GDALWMSMiniDriverFactory *>::iterator it = m_mdfs.begin(); it != m_mdfs.end(); ++it) {
118 98 : GDALWMSMiniDriverFactory *const mdf = *it;
119 98 : if (EQUAL(mdf->GetName().c_str(), name.c_str())) return mdf;
120 : }
121 0 : return NULL;
122 : }
|