QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsserviceregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsserviceregistry.h
3 
4  Class defining the service manager for QGIS server services.
5  -------------------
6  begin : 2016-12-05
7  copyright : (C) 2016 by David Marteau
8  email : david dot marteau at 3liz dot com
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 #ifndef QGSSERVICEREGISTRY_H
20 #define QGSSERVICEREGISTRY_H
21 
22 #include "qgsconfig.h"
23 #include "qgis.h"
24 
25 #include <QHash>
26 #include <QString>
27 
28 #include "qgsservicenativeloader.h"
29 #include <memory>
30 
31 class QgsService;
32 class QgsServerInterface;
33 
47 class SERVER_EXPORT QgsServiceRegistry
48 {
49 
50  public:
51 
53  QgsServiceRegistry() = default;
54 
57 
66  QgsService *getService( const QString &name, const QString &version = QString() );
67 
78  void registerService( QgsService *service SIP_TRANSFER );
79 
90  int unregisterService( const QString &name, const QString &version = QString() );
91 
97  void init( const QString &nativeModulepath, QgsServerInterface *serverIface = nullptr );
98 
102  void cleanUp();
103 
104  private:
105  // XXX consider using QMap because of the few numbers of
106  // elements to handle
107  typedef QHash<QString, std::shared_ptr<QgsService> > ServiceTable;
108  typedef QHash<QString, QPair<QString, QString> > VersionTable;
109 
110  QgsServiceNativeLoader mNativeLoader;
111 
112  ServiceTable mServices;
113  VersionTable mVersions;
114 };
115 
116 #endif
117 
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsService Class defining interfaces for QGIS server services.
Definition: qgsservice.h:39
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins...
QgsServiceRegistry Class defining the registry manager for QGIS server services.
Class defining the native service module loader for QGIS server services.