diff --git a/doc/conf/conf.py b/doc/conf/conf.py index 9ddc034d552ed0d85a7f74aa500d22ed415ecd68..78949cd7a85e80047bb397debf755fd8385827ee 100644 --- a/doc/conf/conf.py +++ b/doc/conf/conf.py @@ -42,7 +42,7 @@ master_doc = 'index' # General information about the project. project = u'OpenStructure' -copyright = u'2011, OpenStructure authors' +copyright = u'2018, OpenStructure authors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/modules/base/src/test_utils/compare_files.cc b/modules/base/src/test_utils/compare_files.cc index 904b14a7fa75dde9bf4edcf3cab176966f312dc1..13dac63adcd4a2f8244303f66d187cadade08ba3 100644 --- a/modules/base/src/test_utils/compare_files.cc +++ b/modules/base/src/test_utils/compare_files.cc @@ -37,17 +37,18 @@ bool compare_files(const String& test, const String& gold_standard) } String test_line, gold_line; while (true) { - bool test_end=std::getline(test_stream, test_line) != 0; - bool gold_end=std::getline(gold_stream, gold_line) != 0; - if (!(test_end || gold_end)) { + bool test_read = static_cast<bool>(std::getline(test_stream, test_line)); + bool gold_read = static_cast<bool>(std::getline(gold_stream, gold_line)); + if (!test_read && !gold_read) { + // nothing to read anymore in any of the files return true; } - if (!test_end) { + if (gold_read && !test_read) { std::cerr << gold_standard << " contains additional line(s):" << std::endl << gold_line << std::endl; return false; } - if (!gold_end) { + if (test_read && !gold_read) { std::cerr << test << " contains additional line(s):" << std::endl << test_line << std::endl; return false; diff --git a/modules/config/base.hh b/modules/config/base.hh index 2019437b5b47828492ec8de2422a77287d650092..b10638e7ede8f4a6f301aad7db6dd8d05b243bc0 100644 --- a/modules/config/base.hh +++ b/modules/config/base.hh @@ -51,28 +51,15 @@ typedef unsigned int uint; typedef std::complex<Real> Complex; typedef unsigned short Word; +typedef std::string String; +// NOTE: Before OST 1.8, we used to have round and rint functions defined here +// -> round and rint are available for any compiler since many years now +// -> Tested for GCC 4.1.2 - 9.0.0, clang 3.3.0 - 8.0.0, MSVC 2015 - 2017 using +// godbolt.org. In all cases: call with float is not casted to double, but +// kept as float which is desired behaviour for good performance. -#ifndef round_function -#define round_function -#ifndef round -inline Real round( Real d ) -{ - return floor(d+Real(0.5)); -} -#endif -#endif - -#ifndef rint_function -#define rint_function -#ifndef rint -inline Real rint(Real d) -{ - return floor(d+Real(0.5)); -} -#endif -#endif - +// NOTE: OST has not been tested in MSVC for a very long time! #if _MSC_VER #pragma warning(disable:4251) #pragma warning(disable:4275) @@ -104,7 +91,4 @@ inline double log2( double n ) #endif -typedef std::string String; - - #endif diff --git a/modules/doc/install.rst b/modules/doc/install.rst index 585dafe3cfd87a45afcd88c6cccec4213a83a125..36e74440821905a303fd7a501268cfc422c17767 100644 --- a/modules/doc/install.rst +++ b/modules/doc/install.rst @@ -299,16 +299,8 @@ from source. On some Linux distributions, there are issues with Qt4 and hence it may not be possible to build OpenStructure with GUI support at all. This is for instance -known to be an issue with boost versions >= 1.62. - -An additional problem arises for gcc versions >= 6. There an extra flag is -required to use the C++98 standard: - -.. code-block:: bash - - cmake . -DOPTIMIZE=ON -DENABLE_INFO=OFF -DCMAKE_CXX_FLAGS='-std=c++98' - -We hope to support Qt5 and C++11 in the next OpenStructure release. +known to be an issue with boost versions >= 1.62. We hope to support Qt5 in the +next OpenStructure release. **Ubuntu 16.04 with GUI** @@ -342,12 +334,11 @@ All the dependencies can be installed from the package manager as follows: sudo dnf install cmake eigen3-devel boost-devel libpng-devel python2-devel \ fftw-devel libtiff-devel -Fedora 26 has gcc 7 and boost 1.63 by default. Hence, we will need to disable -Qt4, the GUI and add the extra flag described above: +Here, we compile a version without GUI as follows: .. code-block:: bash - cmake . -DOPTIMIZE=ON -DENABLE_INFO=OFF -DCMAKE_CXX_FLAGS='-std=c++98' + cmake . -DOPTIMIZE=ON -DENABLE_INFO=OFF **macOS with Homebrew without GUI** diff --git a/modules/gfx/src/scene.cc b/modules/gfx/src/scene.cc index 5c1e9cbb7149115b219ceccc8e88698fa5e70e97..98b47c9cbb16ed2477cb5fb0fd001bcaee8f0c57 100644 --- a/modules/gfx/src/scene.cc +++ b/modules/gfx/src/scene.cc @@ -1097,7 +1097,7 @@ bool Scene::HasNode(const String& name) const { FindNode fn(name); this->Apply(fn); - return fn.node; + return static_cast<bool>(fn.node); } void Scene::Apply(const InputEvent& e, bool request_redraw) diff --git a/modules/gfx/src/texture.hh b/modules/gfx/src/texture.hh index aa3fec45f8f0a5d288d977dd290e40210a9c5253..cf25b9d4f83a8c86d442d4b82db0ac0346d8b433 100644 --- a/modules/gfx/src/texture.hh +++ b/modules/gfx/src/texture.hh @@ -51,7 +51,7 @@ public: Texture(const Bitmap& b); - bool IsValid() const {return d_;} + bool IsValid() const {return static_cast<bool>(d_);} float* data() {return &d_[0];} diff --git a/modules/gui/src/data_viewer/data_viewer.hh b/modules/gui/src/data_viewer/data_viewer.hh index ca6893edc34895fde6df19e2b1344ea11affcb98..c1f18847ec36c270de0d93183342c8427dd604a1 100644 --- a/modules/gui/src/data_viewer/data_viewer.hh +++ b/modules/gui/src/data_viewer/data_viewer.hh @@ -25,6 +25,8 @@ #ifndef IMG_GUI_DATA_VIEWER_H #define IMG_GUI_DATA_VIEWER_H +#ifndef Q_MOC_RUN + #include <map> #include <ost/base.hh> @@ -42,6 +44,9 @@ #include "fft_panel.hh" #include <ost/gui/module_config.hh> +#endif + + //fw decl class QLabel; diff --git a/modules/gui/src/data_viewer/data_viewer_panel_base.hh b/modules/gui/src/data_viewer/data_viewer_panel_base.hh index 699efd372cad4dc5b0a9f26a205b4487f5b33168..be3ac007ec7550c4242e8cbc607654c5eca12fea 100644 --- a/modules/gui/src/data_viewer/data_viewer_panel_base.hh +++ b/modules/gui/src/data_viewer/data_viewer_panel_base.hh @@ -26,10 +26,10 @@ #define DATA_VIEWER_PANEL_BASE_HH_ #include <map> -#include <boost/shared_ptr.hpp> - +#ifndef Q_MOC_RUN +#include <boost/shared_ptr.hpp> #include <ost/base.hh> #include <ost/img/extent.hh> #include <ost/img/data_observer.hh> @@ -41,6 +41,8 @@ #include <ost/img/normalizer_impl.hh> +#endif + #include <QWidget> #include <QCursor> #include <QMenu> diff --git a/modules/gui/src/data_viewer/fft_panel.hh b/modules/gui/src/data_viewer/fft_panel.hh index 75a30fed87e8a1018887d10a56fd7e0465674ce0..ac0df0f56e39d148ab16735fe6e7fe3ce082244e 100644 --- a/modules/gui/src/data_viewer/fft_panel.hh +++ b/modules/gui/src/data_viewer/fft_panel.hh @@ -24,10 +24,14 @@ Author: Andreas Schenk */ +#ifndef Q_MOC_RUN + #include <ost/gui/module_config.hh> #include <ost/img/data_observer.hh> #include "data_viewer_panel_base.hh" +#endif + namespace ost { namespace img { namespace gui { class ParentDataObserver: public DataObserver diff --git a/modules/gui/src/file_type_dialog.hh b/modules/gui/src/file_type_dialog.hh index f1fe6ce5e5fc6e856b15c091b65d03e41309bda2..270d35131d96f77ebfee4de64420abe4f933590d 100644 --- a/modules/gui/src/file_type_dialog.hh +++ b/modules/gui/src/file_type_dialog.hh @@ -25,7 +25,7 @@ #include <ost/gui/module_config.hh> - +#ifndef Q_MOC_RUN #include <ost/io/mol/entity_io_handler.hh> #include <ost/io/seq/sequence_io_handler.hh> @@ -34,6 +34,8 @@ #include <ost/io/img/map_io_handler.hh> #endif +#endif + #include <QDialog> #include <QMetaType> diff --git a/modules/img/base/src/base.hh b/modules/img/base/src/base.hh index 0122a07371705cdc89808f6f3966ab67cb9e2e6a..f5d73f5f4f1aa18f897d6e4710d5108ae7380bbc 100644 --- a/modules/img/base/src/base.hh +++ b/modules/img/base/src/base.hh @@ -44,21 +44,11 @@ #pragma warning(disable:4231) #endif - #ifdef IRIX -inline Real round(Real x) {return rint(x);} -inline float roundf(float x) {return (float)rint((Real)x);} using std::cos; using std::sin; #endif -#ifndef round_function -#define round_function -#ifndef round -inline int round(Real x) {return floor(x+0.5);} -#endif -#endif - namespace ost { namespace img { // String is not always predefined diff --git a/modules/img/base/src/image_handle.cc b/modules/img/base/src/image_handle.cc index c0059be0b852490c5e50306fffab6fca18f23208..fe84239cd624c3c3e6584151ddff9ecf1dffca3d 100644 --- a/modules/img/base/src/image_handle.cc +++ b/modules/img/base/src/image_handle.cc @@ -153,7 +153,7 @@ void ImageHandle::Reset(const Extent &e, DataType type,DataDomain dom) bool ImageHandle::IsValid() const { - return impl_; + return static_cast<bool>(impl_); } long ImageHandle::MemSize() const diff --git a/modules/info/src/info_handle.cc b/modules/info/src/info_handle.cc index 9b6ecbc49a7dac0caddd7347743f9dd634cdee2c..263ae222c9ed261b0de6061631dfb94e98753bee 100644 --- a/modules/info/src/info_handle.cc +++ b/modules/info/src/info_handle.cc @@ -74,7 +74,7 @@ void InfoHandle::Export(const String& file) const bool InfoHandle::IsValid() const { - return impl_; + return static_cast<bool>(impl_); } diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc index 2cfac7fcef03a65e57d20a6658ad07f90b339ab6..69210a1b95e5d3e3236d3807c6827e3390fdc973 100644 --- a/modules/io/tests/test_mmcif_reader.cc +++ b/modules/io/tests/test_mmcif_reader.cc @@ -1327,7 +1327,7 @@ BOOST_AUTO_TEST_CASE(mmcif_test_chain_mappings) BOOST_TEST_MESSAGE(" Running mmcif_test_chain_mappings tests..."); // check compound lib - bool compound_lib_available = SetDefaultCompoundLib(); + bool compound_lib_available = static_cast<bool>(SetDefaultCompoundLib()); // load data mol::EntityHandle eh = mol::CreateEntity(); diff --git a/modules/mol/alg/doc/molalg.rst b/modules/mol/alg/doc/molalg.rst index 81f3e77643c0eae354f789288741fd2d43de2b94..4636a4ce45ee911c944366545be4bc10947d82ba 100644 --- a/modules/mol/alg/doc/molalg.rst +++ b/modules/mol/alg/doc/molalg.rst @@ -559,8 +559,7 @@ Local Distance Test scores (lDDT, DRMSD) """Run lDDT from within script.""" from ost.io import LoadPDB from ost.mol.alg import (CleanlDDTReferences, - lDDTSettings, lDDTScorer) - from ost.io import ReadStereoChemicalPropsFile + lDDTSettings, lDDTScorer) ent_full = LoadPDB('3ia3', remote=True) model_view = ent_full.Select('cname=A') diff --git a/modules/mol/alg/src/filter_clashes.cc b/modules/mol/alg/src/filter_clashes.cc index 455d1e7dbd8114aeb7ef972cc50691de2e9a0e8c..18ffc17ba090c0a7b39f3e76788d6993bd1febe5 100644 --- a/modules/mol/alg/src/filter_clashes.cc +++ b/modules/mol/alg/src/filter_clashes.cc @@ -118,7 +118,7 @@ std::pair<Real,Real> ClashingDistances::GetClashingDistance(const String& ele1,c std::map <String,std::pair<Real,Real> >::const_iterator find_ci= min_distance_.find(key); if (find_ci == min_distance_.end()) { std::stringstream serr; - serr << "Entry for distance " << stkey << " not found in the parameter table"; + serr << "Entry for distance " << key << " not found in the parameter table"; throw Error(serr.str()); } return find_ci->second; @@ -220,7 +220,7 @@ StereoChemicalParams FillStereoChemicalParams(const String& header, std::vector< if (second_line_str_vec.size()!=4) { std::cout << "The number of elements in one of the lines is wrong" << std::endl; return StereoChemicalParams(); - } + } StringRef item = second_line_str_vec[0]; String res = second_line_str_vec[1].str(); std::pair<bool,float> parse_value = second_line_str_vec[2].to_float(); @@ -231,13 +231,13 @@ StereoChemicalParams FillStereoChemicalParams(const String& header, std::vector< } else { std::cout << "One of the values in the third column is not a number" << std::endl; return StereoChemicalParams(); - }; + } if (parse_stddev.first==true) { stddev=static_cast<Real>(parse_stddev.second); } else { std::cout << "One of the values in the fourth column is not a number" << std::endl; return StereoChemicalParams(); - }; + } std::vector<StringRef> split_item = item.split('-'); String rearranged_item; if (split_item.size() == 2) { @@ -264,7 +264,7 @@ StereoChemicalParams FillStereoChemicalParams(const String& header, std::vector< } else { std::cout << "One of the strings describing the parameter has the wrong format" << std::endl; return StereoChemicalParams(); - } + } table.SetParam(rearranged_item,res,value,stddev); } line_iter++; @@ -306,7 +306,7 @@ ClashingDistances FillClashingDistances(std::vector<String>& stereo_chemical_pro if (second_line_str_vec.size()!=3) { std::cout << "The number of elements in one of the lines is wrong" << std::endl; return ClashingDistances(); - } + } String item = second_line_str_vec[0].str(); std::pair<bool,float> parse_value = second_line_str_vec[1].to_float(); @@ -317,7 +317,7 @@ ClashingDistances FillClashingDistances(std::vector<String>& stereo_chemical_pro } else { std::cout << "One of the distance values is not a number" << std::endl; return ClashingDistances(); - }; + } if (parse_stddev.first==true) { stddev=static_cast<Real>(parse_stddev.second); } else { @@ -329,7 +329,7 @@ ClashingDistances FillClashingDistances(std::vector<String>& stereo_chemical_pro if (itemsr.size() != 3) { std::cout << "One of the strings describing the interacting atoms has the wrong format" << std::endl; return ClashingDistances(); - } + } String ele1=eles[0].str(); String ele2=eles[1].str(); if (ele2 < ele1) { @@ -340,7 +340,7 @@ ClashingDistances FillClashingDistances(std::vector<String>& stereo_chemical_pro } line_iter++; } - } + } } line_iter++; } diff --git a/modules/mol/base/src/bond_handle.cc b/modules/mol/base/src/bond_handle.cc index 3be1b88bd7017c7005e2912a71d689bb398576bc..9a68a860dc5db33eea4a28fdc807407acb889ec1 100644 --- a/modules/mol/base/src/bond_handle.cc +++ b/modules/mol/base/src/bond_handle.cc @@ -47,7 +47,7 @@ BondHandle::operator bool() const } bool BondHandle::IsValid() const { - return impl_; + return static_cast<bool>(impl_); } AtomHandle BondHandle::GetFirst() const diff --git a/modules/mol/base/src/impl/atom_impl.cc b/modules/mol/base/src/impl/atom_impl.cc index 7bc585b14662360f400d241ca77e4a48ee8b1184..f0852b73845a7ae3181109154203f40a3435d64c 100644 --- a/modules/mol/base/src/impl/atom_impl.cc +++ b/modules/mol/base/src/impl/atom_impl.cc @@ -227,7 +227,7 @@ std::ostream& operator<<(std::ostream& o, const AtomImplPtr ap) } bool ConnectorExists(const AtomImplPtr& a, const AtomImplPtr& b) { - return GetConnector(a, b); + return static_cast<bool>(GetConnector(a, b)); } ConnectorImplP GetConnector(const AtomImplPtr& a, const AtomImplPtr& b) { diff --git a/modules/mol/base/src/surface_handle.hh b/modules/mol/base/src/surface_handle.hh index 3524375d36ab919f072d3a8d19fe78d4e74d387b..a11b3a91e9768535716c30e25f5026e8fdc04c44 100644 --- a/modules/mol/base/src/surface_handle.hh +++ b/modules/mol/base/src/surface_handle.hh @@ -70,7 +70,7 @@ public: // flip normals void Invert(); - bool IsValid() const {return impl_;} + bool IsValid() const {return static_cast<bool>(impl_);} bool operator==(const SurfaceHandle& ref) const { return impl_==ref.impl_; }