WSL/SLF GitLab Repository

Commit 64fe9e0c authored by Mathias Bavay's avatar Mathias Bavay
Browse files

some code cleanup in GSNIO, the warnings generated by soap are now turned off...

some code cleanup in GSNIO, the warnings generated by soap are now turned off (with a hack to make old versions of gcc able to do it) and the plugins directory and component are now removed from the packaging
parent 31cf5fbb
......@@ -173,16 +173,14 @@ IF(WIN32) #handle the special case of WIN32 needing import libraries
FILE(GLOB_RECURSE importlibs "lib/libmeteo*.lib")
ENDIF(WIN32)
FILE(GLOB_RECURSE solibs "lib/libmeteo*.${DLL_EXT}")
FILE(GLOB_RECURSE plugins "lib/plugins/lib*.${DLL_EXT}")
FILE(GLOB_RECURSE alibs "lib/*.${STAT_EXT}")
INSTALL(FILES ${solibs} ${importlibs} ${alibs} DESTINATION lib COMPONENT libraries)
INSTALL(FILES ${plugins} DESTINATION lib/meteoio/plugins COMPONENT plugins)
# This is at the end of the file, so that every variables
ADD_CUSTOM_TARGET(distclean make clean
COMMAND cmake -E remove CMakeCache.txt CPackSourceConfig.cmake CPackConfig.cmake CTestTestfile.cmake DartConfiguration.tcl cmake_install.cmake cmake_uninstall.cmake install_manifest.txt Makefile
COMMAND cmake -E remove "lib/plugins/lib*.${DLL_EXT}" "lib/libmeteo*.${DLL_EXT}"
COMMAND cmake -E remove "lib/libmeteo*.${DLL_EXT}"
COMMAND cmake -E remove */CMakeCache.txt */CTestTestfile.cmake */cmake_install.cmake
COMMAND cmake -E remove */*/CMakeCache.txt */*/CTestTestfile.cmake */*/cmake_install.cmake
COMMAND cmake -E remove_directory CMakeFiles
......@@ -286,10 +284,6 @@ SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Header files")
SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "Necessary C++ header files for developing applications using MeteoIO")
SET(CPACK_COMPONENT_HEADERS_GROUP Development)
SET(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
SET(CPACK_COMPONENT_PLUGINS_DISPLAY_NAME "Input/Output Plugins")
SET(CPACK_COMPONENT_PLUGINS_DESCRIPTION "Various plugins for supporting various data formats/protocols")
SET(CPACK_COMPONENT_PLUGINS_GROUP Runtime)
SET(CPACK_COMPONENT_PLUGINS_DEPENDS libraries)
IF(INSTALL_DOC)
SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Documentation of the MeteoIO usage and API both for the end user and the developer using MeteoIO in his/her application")
......
......@@ -170,14 +170,26 @@ void IOUtils::trim(std::string& str)
}
}
void IOUtils::toUpper(std::string& str){
void IOUtils::toUpper(std::string& str) {
std::transform(str.begin(), str.end(),str.begin(), ::toupper);
}
void IOUtils::toLower(std::string& str){
void IOUtils::toLower(std::string& str) {
std::transform(str.begin(), str.end(),str.begin(), ::tolower);
}
std::string IOUtils::strToUpper(const std::string &str) {
std::string strcopy(str.size(), 0);
std::transform(str.begin(), str.end(), strcopy.begin(), ::toupper);
return strcopy;
}
std::string IOUtils::strToLower(const std::string &str) {
std::string strcopy(str.size(), 0);
std::transform(str.begin(), str.end(), strcopy.begin(), ::tolower);
return strcopy;
}
bool IOUtils::isNumeric(std::string str, const unsigned int& nBase)
{
trim(str); //delete trailing and leading whitespaces and tabs
......
......@@ -190,7 +190,9 @@ namespace IOUtils {
const std::string& keyprefix="", const bool& setToUpperCase=false);
void toUpper(std::string& str);
std::string strToUpper(const std::string &str);
void toLower(std::string& str);
std::string strToLower(const std::string &str);
bool isNumeric(std::string input, const unsigned int& nBase=10);
size_t readLineToVec(const std::string& line_in, std::vector<double>& vec_data);
size_t readLineToVec(const std::string& line_in, std::vector<std::string>& vecString);
......
......@@ -47,10 +47,13 @@ IF(PLUGIN_GSNIO)
IF(NOT MSVC)
SET_SOURCE_FILES_PROPERTIES(plugins/gsn/soapC.cpp PROPERTIES COMPILE_FLAGS "-w")
SET_SOURCE_FILES_PROPERTIES(plugins/gsn/stdsoap2.cpp PROPERTIES COMPILE_FLAGS "-w")
SET_SOURCE_FILES_PROPERTIES(plugins/gsn/soapGSNWebServiceSoap12BindingProxy.cpp PROPERTIES COMPILE_FLAGS "-w")
SET_SOURCE_FILES_PROPERTIES(plugins/GSNIO.cc PROPERTIES COMPILE_FLAGS "-Wno-long-long")
ENDIF(NOT MSVC)
IF(MSVC)
SET_SOURCE_FILES_PROPERTIES(plugins/gsn/soapC.cpp PROPERTIES COMPILE_FLAGS "/W0")
SET_SOURCE_FILES_PROPERTIES(plugins/gsn/stdsoap2.cpp PROPERTIES COMPILE_FLAGS "/W0")
SET_SOURCE_FILES_PROPERTIES(plugins/gsn/soapGSNWebServiceSoap12BindingProxy.cpp PROPERTIES COMPILE_FLAGS "/W0")
ENDIF(MSVC)
IF(WIN32)
......@@ -91,34 +94,3 @@ ENDIF(PLUGIN_SNIO)
CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/meteoio/IOHandler.cmake.cc ${PROJECT_SOURCE_DIR}/meteoio/IOHandler.cc )
# IF(PLUGIN_GSNIO)
# INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} "/usr/include")
# #gsoap generates files that do lots of warnings, there is nothing we can do about it -> off
# IF(NOT MSVC)
# SET_SOURCE_FILES_PROPERTIES(gsn/soapC.cpp PROPERTIES COMPILE_FLAGS "-w")
# SET_SOURCE_FILES_PROPERTIES(gsn/stdsoap2.cpp PROPERTIES COMPILE_FLAGS "-w")
# ENDIF(NOT MSVC)
# IF(MSVC)
# SET_SOURCE_FILES_PROPERTIES(gsn/soapC.cpp PROPERTIES COMPILE_FLAGS "/W0")
# SET_SOURCE_FILES_PROPERTIES(gsn/stdsoap2.cpp PROPERTIES COMPILE_FLAGS "/W0")
# ENDIF(MSVC)
# ADD_LIBRARY(${GSNIONAME} GSNIO.cc gsn/soapGSNWebServiceSoap12BindingProxy.cpp gsn/soapC.cpp gsn/stdsoap2.cpp)
# IF(WIN32)
# IF(MINGW)
# ADD_DEFINITIONS(-D_isnan=isnan)
# ENDIF(MINGW)
# SET(EXTRA_LINK_LIBS "ws2_32")
# ENDIF(WIN32)
# TARGET_LINK_LIBRARIES(${GSNIONAME} ${SHAREDNAME} ${EXTRA_LINK_LIBS})
# SET_TARGET_PROPERTIES(${GSNIONAME} PROPERTIES
# PREFIX "${LIBPREFIX}"
# LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_DIR}
# RUNTIME_OUTPUT_DIRECTORY ${PLUGIN_DIR}
# VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
# SOVERSION ${VERSION_MAJOR})
# #necessary because gsoap uses long long
# IF(NOT MSVC)
# SET_TARGET_PROPERTIES(${GSNIONAME} PROPERTIES COMPILE_FLAGS "-Wno-long-long")
# ENDIF(NOT MSVC)
# SET(MYPLUGINS ${MYPLUGINS} ${GSNIONAME})
# ENDIF(PLUGIN_GSNIO)
......@@ -244,18 +244,16 @@ void GSNIO::readMetaData()
metadata_req.fieldSelector.push_back(&tmp);
if (gsn.getVirtualSensorsDetails(&metadata_req, &metadata) == SOAP_OK){
size_t details = metadata.virtualSensorDetails.size();
const size_t details = metadata.virtualSensorDetails.size();
if (details == 0)
throw IOException("No meta data for sensor " + vecStationName[ii] + ". Is it a valid sensor?", AT);
for (size_t jj=0; jj<details; jj++){
size_t predicates = metadata.virtualSensorDetails[jj]->addressing->predicates.size();
const size_t predicates = metadata.virtualSensorDetails[jj]->addressing->predicates.size();
for (size_t kk=0; kk<predicates; kk++){
string field_name = metadata.virtualSensorDetails[jj]->addressing->predicates[kk]->name;
string field_val = metadata.virtualSensorDetails[jj]->addressing->predicates[kk]->__item;
IOUtils::toUpper(field_name);
IOUtils::toUpper(field_val);
const string field_name = IOUtils::strToUpper( metadata.virtualSensorDetails[jj]->addressing->predicates[kk]->name );
const string field_val = IOUtils::strToUpper( metadata.virtualSensorDetails[jj]->addressing->predicates[kk]->__item );
if (field_val != "NULL") {
if (field_name == "NAME") {
......@@ -312,8 +310,7 @@ void GSNIO::map_parameters(const std::vector<ns2__GSNWebService_USCOREDataField*
MeteoData& md, std::vector<size_t>& index)
{
for (size_t ii=0; ii<field.size(); ii++) {
string field_name = *field.at(ii)->name;
IOUtils::toUpper(field_name);
const string field_name = IOUtils::strToUpper( *field.at(ii)->name );
if (field_name == "RELATIVE_HUMIDITY"){
index.push_back(MeteoData::RH);
......@@ -393,7 +390,7 @@ void GSNIO::readData(const Date& dateStart, const Date& dateEnd, std::vector<Met
}
if (multipage) {
string sid = data.queryResult.at(0)->sid;
const string sid = data.queryResult.at(0)->sid;
_ns1__getNextData requestNext;
_ns1__getNextDataResponse responseNext;
......@@ -427,8 +424,7 @@ void GSNIO::parse_streamElement(const std::vector<size_t>& index, const bool& ol
tmpmeteo.date.setTimeZone(default_timezone);
for (size_t jj=0; jj < streamElement->field.size(); jj++){
string value = streamElement->field.at(jj)->__item;
IOUtils::toUpper(value);
const string value = IOUtils::strToUpper( streamElement->field.at(jj)->__item );
if (index[jj] != IOUtils::npos){
if (value != "NULL"){
IOUtils::convertString(tmpmeteo(index[jj]), value);
......
......@@ -21,8 +21,25 @@
#include <math.h>
#define _isnan isnan
#include "gsn/soapGSNWebServiceSoap12BindingProxy.h"
//#include "gsn/GSNWebServiceSoap12Binding.nsmap"
//This is big hack to allow older versions of gcc to turn warnings off in soap files
//hopefully we would soon get better soap files and would scrap the whole mess...
#if defined(__GNUC__) && defined(__DEBUG)
//#pragma GCC diagnostic push_options
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wlong-long"
#pragma GCC diagnostic ignored "-Wshadow"
#include "gsn/soapGSNWebServiceSoap12BindingProxy.h"
//#include "gsn/GSNWebServiceSoap12Binding.nsmap"
//#pragma GCC diagnostic pop_options
#pragma GCC diagnostic warning "-Wall"
#pragma GCC diagnostic warning "-Weffc++"
#pragma GCC diagnostic warning "-Wlong-long"
#pragma GCC diagnostic warning "-Wshadow"
#else
#include "gsn/soapGSNWebServiceSoap12BindingProxy.h"
//#include "gsn/GSNWebServiceSoap12Binding.nsmap"
#endif
#ifdef _WIN32 //because we collected c**p from windows.h
#undef max
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment