-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server refactoring: Added sample native service module; fixed typo
- Loading branch information
Showing
14 changed files
with
172 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
IF (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
SET(CMAKE_CXX_FLAGS_OLD "${CMAKE_CXX_FLAGS}") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") | ||
ENDIF() | ||
# override default path where built files are put to allow running qgis without installing | ||
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_SERVER_MODULE_SUBDIR}) | ||
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_SERVER_MODULE_SUBDIR}) | ||
|
||
ADD_SUBDIRECTORY(DummyService) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
######################################################## | ||
# Files | ||
|
||
SET (dummy_SRCS | ||
dummy.cpp | ||
) | ||
|
||
######################################################## | ||
# Build | ||
|
||
ADD_LIBRARY (dummy MODULE ${dummy_SRCS}) | ||
|
||
|
||
INCLUDE_DIRECTORIES( | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
../../../core ../../../core/geometry ../../../core/raster | ||
../.. | ||
.. | ||
. | ||
) | ||
|
||
TARGET_LINK_LIBRARIES(dummy | ||
qgis_core | ||
qgis_server | ||
) | ||
|
||
|
||
######################################################## | ||
# Install | ||
|
||
INSTALL(TARGETS dummy | ||
RUNTIME DESTINATION ${QGIS_SERVER_MODULE_DIR} | ||
LIBRARY DESTINATION ${QGIS_SERVER_MODULE_DIR} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/*************************************************************************** | ||
dummy.cpp | ||
Sample service implementation | ||
----------------------------- | ||
begin : 2016-12-13 | ||
copyright : (C) 2016 by David Marteau | ||
email : david dot marteau at 3liz dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsmodule.h" | ||
|
||
// Service | ||
class SampleService: public QgsService | ||
{ | ||
public: | ||
QString name() const { return "SampleService"; } | ||
QString version() const { return "1.0"; } | ||
|
||
bool allowMethod( QgsServerRequest::Method method ) const | ||
{ | ||
return method == QgsServerRequest::GetMethod; | ||
} | ||
|
||
void executeRequest( const QgsServerRequest& request, QgsServerResponse& response ) | ||
{ | ||
QgsDebugMsg( "SampleService::executeRequest called" ); | ||
response.write( QString("Hello world from myService") ); | ||
} | ||
}; | ||
|
||
// Module | ||
class QgsSampleModule: public QgsServiceModule | ||
{ | ||
public: | ||
void registerSelf( QgsServiceRegistry& registry ) | ||
{ | ||
QgsDebugMsg( "SampleModule::registerSelf called" ); | ||
registry.registerService( new SampleService() ); | ||
} | ||
}; | ||
|
||
// Entry points | ||
QGISEXTERN QgsServiceModule* QGS_ServiceModule_Init() | ||
{ | ||
static QgsSampleModule module; | ||
return &module; | ||
} | ||
QGISEXTERN void QGS_ServiceModule_Exit( QgsServiceModule* ) | ||
{ | ||
// Nothing to do | ||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/*************************************************************************** | ||
qgsmodule.h | ||
Define some boilerplate code for implementing modules | ||
----------------------------- | ||
begin : 2016-12-13 | ||
copyright : (C) 2016 by David Marteau | ||
email : david dot marteau at 3liz dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgis.h" | ||
#include "qgsservicemodule.h" | ||
#include "qgsserviceregistry.h" | ||
#include "qgsservice.h" | ||
#include "qgslogger.h" | ||
#include "qgsmessagelog.h" | ||
|
||
|