diff --git a/Code/Catalogs/Catalog.h b/Code/Catalogs/Catalog.h index bd800d67a..7c14ab2f5 100644 --- a/Code/Catalogs/Catalog.h +++ b/Code/Catalogs/Catalog.h @@ -43,7 +43,7 @@ class Catalog { typedef paramType paramType_t; //------------------------------------ - Catalog() : dp_cParams(nullptr){}; + Catalog() : dp_cParams(nullptr) {} //------------------------------------ virtual ~Catalog() { delete dp_cParams; } @@ -107,7 +107,7 @@ class Catalog { // id of the entry in the catalog. // this is more along the lines of bitId unsigned int d_fpLength{0}; //!< the length of our fingerprint - paramType *dp_cParams; //!< our params object + paramType *dp_cParams; //!< our params object }; //----------------------------------------------------------------------------- diff --git a/Code/Catalogs/CatalogEntry.h b/Code/Catalogs/CatalogEntry.h index 50a2a608f..5a7acbd82 100644 --- a/Code/Catalogs/CatalogEntry.h +++ b/Code/Catalogs/CatalogEntry.h @@ -22,10 +22,10 @@ class RDKIT_CATALOGS_EXPORT CatalogEntry { virtual ~CatalogEntry() = 0; //! sets our bit Id - void setBitId(int bid) { d_bitId = bid; }; + void setBitId(int bid) { d_bitId = bid; } //! returns our bit Id - int getBitId() const { return d_bitId; }; + int getBitId() const { return d_bitId; } //! returns a text description of this entry virtual std::string getDescription() const = 0; diff --git a/Code/Catalogs/CatalogParams.h b/Code/Catalogs/CatalogParams.h index 0f4dd8d19..9604bfb21 100644 --- a/Code/Catalogs/CatalogParams.h +++ b/Code/Catalogs/CatalogParams.h @@ -20,10 +20,10 @@ class RDKIT_CATALOGS_EXPORT CatalogParams { virtual ~CatalogParams() = 0; //! returns our type string - std::string getTypeStr() const { return d_typeStr; }; + std::string getTypeStr() const { return d_typeStr; } //! sets our type string - void setTypeStr(const std::string &typeStr) { d_typeStr = typeStr; }; + void setTypeStr(const std::string &typeStr) { d_typeStr = typeStr; } //! serializes (pickles) to a stream virtual void toStream(std::ostream &) const = 0; diff --git a/Code/ChemicalFeatures/ChemicalFeature.h b/Code/ChemicalFeatures/ChemicalFeature.h index 92640eed0..7e2ab855d 100644 --- a/Code/ChemicalFeatures/ChemicalFeature.h +++ b/Code/ChemicalFeatures/ChemicalFeature.h @@ -18,8 +18,8 @@ namespace ChemicalFeatures { //! abstract base class for chemical feature class ChemicalFeature { public: - ChemicalFeature(){}; - virtual ~ChemicalFeature(){}; + ChemicalFeature() {} + virtual ~ChemicalFeature() {} // returns the feature id virtual int getId() const = 0; diff --git a/Code/ChemicalFeatures/FreeChemicalFeature.h b/Code/ChemicalFeatures/FreeChemicalFeature.h index 5f77dbab7..bbb42e95f 100644 --- a/Code/ChemicalFeatures/FreeChemicalFeature.h +++ b/Code/ChemicalFeatures/FreeChemicalFeature.h @@ -33,10 +33,7 @@ class RDKIT_CHEMICALFEATURES_EXPORT FreeChemicalFeature //! start with everything blank FreeChemicalFeature() - : - d_family(""), - d_type(""), - d_position(RDGeom::Point3D(0.0, 0.0, 0.0)) {} + : d_family(""), d_type(""), d_position(RDGeom::Point3D(0.0, 0.0, 0.0)) {} explicit FreeChemicalFeature(const std::string &pickle) { this->initFromString(pickle); diff --git a/Code/DataManip/MetricMatrixCalc/MetricMatrixCalc.h b/Code/DataManip/MetricMatrixCalc/MetricMatrixCalc.h index c89b4031a..707250ebf 100644 --- a/Code/DataManip/MetricMatrixCalc/MetricMatrixCalc.h +++ b/Code/DataManip/MetricMatrixCalc/MetricMatrixCalc.h @@ -35,7 +35,7 @@ class MetricMatrixCalc { /*! \brief Default Constructor * */ - MetricMatrixCalc(){}; + MetricMatrixCalc() {} /*! \brief Set the metric function * @@ -87,7 +87,7 @@ class MetricMatrixCalc { distMat[itab + j] = dp_metricFunc(descripts[i], descripts[j], dim); } } - }; + } private: // pointer to the metric function diff --git a/Code/DataStructs/DatastructsException.h b/Code/DataStructs/DatastructsException.h index 8ebc0fc77..8b9b595d2 100644 --- a/Code/DataStructs/DatastructsException.h +++ b/Code/DataStructs/DatastructsException.h @@ -15,12 +15,12 @@ class RDKIT_DATASTRUCTS_EXPORT DatastructsException : public std::exception { public: //! construct with an error message - DatastructsException(const char *msg) : _msg(msg){}; + DatastructsException(const char *msg) : _msg(msg) {} //! construct with an error message - DatastructsException(const std::string &msg) : _msg(msg){}; + DatastructsException(const std::string &msg) : _msg(msg) {} //! get the error message - const char *what() const noexcept override { return _msg.c_str(); }; - ~DatastructsException() noexcept {}; + const char *what() const noexcept override { return _msg.c_str(); } + ~DatastructsException() noexcept {} private: std::string _msg; diff --git a/Code/DataStructs/DiscreteDistMat.h b/Code/DataStructs/DiscreteDistMat.h index 103b5fdc4..9e1755fdf 100644 --- a/Code/DataStructs/DiscreteDistMat.h +++ b/Code/DataStructs/DiscreteDistMat.h @@ -16,7 +16,7 @@ namespace RDKit { class RDKIT_DATASTRUCTS_EXPORT DiscreteDistMat { public: DiscreteDistMat(); - ~DiscreteDistMat(){}; + ~DiscreteDistMat() {} unsigned int getDist(unsigned char v1, unsigned char v2, DiscreteValueVect::DiscreteValueType type); diff --git a/Code/DataStructs/DiscreteValueVect.h b/Code/DataStructs/DiscreteValueVect.h index c8fee127a..78a8883d2 100644 --- a/Code/DataStructs/DiscreteValueVect.h +++ b/Code/DataStructs/DiscreteValueVect.h @@ -54,11 +54,11 @@ class RDKIT_DATASTRUCTS_EXPORT DiscreteValueVect { //! constructor from a pickle DiscreteValueVect(const std::string &pkl) { initFromText(pkl.c_str(), static_cast(pkl.size())); - }; + } //! constructor from a pickle DiscreteValueVect(const char *pkl, const unsigned int len) { initFromText(pkl, len); - }; + } ~DiscreteValueVect() {} @@ -66,7 +66,7 @@ class RDKIT_DATASTRUCTS_EXPORT DiscreteValueVect { unsigned int getVal(unsigned int i) const; //! support indexing using [] - int operator[](unsigned int idx) const { return getVal(idx); }; + int operator[](unsigned int idx) const { return getVal(idx); } //! set the value at an index /*! @@ -81,7 +81,7 @@ class RDKIT_DATASTRUCTS_EXPORT DiscreteValueVect { //! returns the length unsigned int getLength() const; //! returns the length - unsigned int size() const { return getLength(); }; + unsigned int size() const { return getLength(); } //! return a pointer to our raw data storage const std::uint32_t *getData() const; diff --git a/Code/DataStructs/ExplicitBitVect.h b/Code/DataStructs/ExplicitBitVect.h index 7ae7e4c60..fbe003d6a 100644 --- a/Code/DataStructs/ExplicitBitVect.h +++ b/Code/DataStructs/ExplicitBitVect.h @@ -28,12 +28,12 @@ */ class RDKIT_DATASTRUCTS_EXPORT ExplicitBitVect : public BitVect { public: - ExplicitBitVect() {}; + ExplicitBitVect() {} //! initialize with a particular size; explicit ExplicitBitVect(unsigned int size) : dp_bits(nullptr), d_size(0), d_numOnBits(0) { _initForSize(size); - }; + } //! initialize with a particular size and all bits set ExplicitBitVect(unsigned int size, bool bitsSet); ExplicitBitVect(const ExplicitBitVect &other); @@ -46,7 +46,7 @@ class RDKIT_DATASTRUCTS_EXPORT ExplicitBitVect : public BitVect { ExplicitBitVect(boost::dynamic_bitset<> *bits) : dp_bits(bits), d_size(static_cast(bits->size())), - d_numOnBits(static_cast(bits->count())){}; + d_numOnBits(static_cast(bits->count())) {} ~ExplicitBitVect(); @@ -75,7 +75,7 @@ class RDKIT_DATASTRUCTS_EXPORT ExplicitBitVect : public BitVect { void getOnBits(IntVect &v) const; - void clearBits() { dp_bits->reset(); }; + void clearBits() { dp_bits->reset(); } std::string toString() const; boost::dynamic_bitset<> *dp_bits{nullptr}; //!< our raw storage diff --git a/Code/DataStructs/FPBReader.h b/Code/DataStructs/FPBReader.h index 209f5ffec..5d557c9d2 100644 --- a/Code/DataStructs/FPBReader.h +++ b/Code/DataStructs/FPBReader.h @@ -57,9 +57,8 @@ struct FPBReader_impl; */ class RDKIT_DATASTRUCTS_EXPORT FPBReader { public: - FPBReader() - - {}; + FPBReader() {} + //! ctor for reading from a named file /*! \param fname the name of the file to reads @@ -68,11 +67,11 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { */ FPBReader(const char *fname, bool lazyRead = false) { _initFromFilename(fname, lazyRead); - }; + } //! \overload FPBReader(const std::string &fname, bool lazyRead = false) { _initFromFilename(fname.c_str(), lazyRead); - }; + } //! ctor for reading from an open istream /*! \param inStream the stream to read from @@ -91,13 +90,13 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { dp_impl(nullptr), df_owner(takeOwnership), df_init(false), - df_lazyRead(lazyRead){}; + df_lazyRead(lazyRead) {} ~FPBReader() { destroy(); if (df_owner) delete dp_istrm; dp_istrm = nullptr; df_init = false; - }; + } //! Read the data from the file and initialize internal data structures /*! @@ -119,7 +118,7 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { if (!df_init) return; destroy(); df_init = false; - }; + } //! returns the requested fingerprint as an \c ExplicitBitVect boost::shared_ptr getFP(unsigned int idx) const; //! returns the requested fingerprint as an array of bytes @@ -131,7 +130,7 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { std::pair, std::string> operator[]( unsigned int idx) const { return std::make_pair(getFP(idx), getId(idx)); - }; + } //! returns beginning and end indices of fingerprints having on-bit counts //! within the range (including end points) @@ -150,7 +149,7 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { double getTanimoto(unsigned int idx, boost::shared_array bv) const { return getTanimoto(idx, bv.get()); - }; + } //! \overload double getTanimoto(unsigned int idx, const ExplicitBitVect &ebv) const; @@ -174,7 +173,7 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { boost::shared_array bv, double threshold = 0.7, bool usePopcountScreen = true) const { return getTanimotoNeighbors(bv.get(), threshold, usePopcountScreen); - }; + } //! \overload std::vector> getTanimotoNeighbors( const ExplicitBitVect &ebv, double threshold = 0.7, @@ -196,7 +195,7 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { double getTversky(unsigned int idx, boost::shared_array bv, double ca, double cb) const { return getTversky(idx, bv.get(), ca, cb); - }; + } //! \overload double getTversky(unsigned int idx, const ExplicitBitVect &ebv, double ca, double cb) const; @@ -223,7 +222,7 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { boost::shared_array bv, double ca, double cb, double threshold = 0.7, bool usePopcountScreen = true) const { return getTverskyNeighbors(bv.get(), ca, cb, threshold, usePopcountScreen); - }; + } //! \overload std::vector> getTverskyNeighbors( const ExplicitBitVect &ebv, double ca, double cb, double threshold = 0.7, @@ -239,7 +238,7 @@ class RDKIT_DATASTRUCTS_EXPORT FPBReader { std::vector getContainingNeighbors( boost::shared_array bv) const { return getContainingNeighbors(bv.get()); - }; + } //! \overload std::vector getContainingNeighbors( const ExplicitBitVect &ebv) const; diff --git a/Code/DataStructs/MultiFPBReader.h b/Code/DataStructs/MultiFPBReader.h index b8f105844..c4955f246 100644 --- a/Code/DataStructs/MultiFPBReader.h +++ b/Code/DataStructs/MultiFPBReader.h @@ -53,8 +53,7 @@ namespace RDKit { class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { public: typedef boost::tuple ResultTuple; - MultiFPBReader() - {}; + MultiFPBReader() {} /*! \param initOnSearch: if this is true, the \c init() method on child readers @@ -64,7 +63,7 @@ class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { MultiFPBReader(bool initOnSearch) : df_init(false), df_initOnSearch(initOnSearch), - df_takeOwnership(false){}; + df_takeOwnership(false) {} /*! \param readers: the set of FPBReader objects to use. \param takeOwnership: if true, we own the memory for the FPBReaders @@ -78,10 +77,12 @@ class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { ~MultiFPBReader() { df_init = false; if (df_takeOwnership) { - for (auto& rdr : d_readers) { delete rdr; }; + for (auto &rdr : d_readers) { + delete rdr; + } d_readers.clear(); } - }; + } //! Read the data from the file and initialize internal data structures /*! @@ -92,7 +93,7 @@ class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { void init(); //! returns the number of readers - unsigned int length() const { return d_readers.size(); }; + unsigned int length() const { return d_readers.size(); } //! returns the number of bits in our fingerprints (all readers are expected //! to have the same length) unsigned int nBits() const; @@ -122,7 +123,7 @@ class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { d_readers.push_back(rdr); if (df_init) rdr->init(); return d_readers.size(); - }; + } //! returns tanimoto neighbors that are within a similarity threshold /*! @@ -144,7 +145,7 @@ class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { boost::shared_array bv, double threshold = 0.7, int numThreads = 1) const { return getTanimotoNeighbors(bv.get(), threshold, numThreads); - }; + } //! \overload std::vector getTanimotoNeighbors(const ExplicitBitVect &ebv, double threshold = 0.7, @@ -173,7 +174,7 @@ class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { boost::shared_array bv, double ca, double cb, double threshold = 0.7, int numThreads = 1) const { return getTverskyNeighbors(bv.get(), ca, cb, threshold, numThreads); - }; + } //! \overload std::vector getTverskyNeighbors(const ExplicitBitVect &ebv, double ca, double cb, @@ -190,7 +191,7 @@ class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader { std::vector> getContainingNeighbors( boost::shared_array bv, int numThreads = 1) const { return getContainingNeighbors(bv.get(), numThreads); - }; + } //! \overload std::vector> getContainingNeighbors( const ExplicitBitVect &ebv, int numThreads = 1) const; diff --git a/Code/DataStructs/SparseBitVect.h b/Code/DataStructs/SparseBitVect.h index 54225d5d4..f2f01ac59 100644 --- a/Code/DataStructs/SparseBitVect.h +++ b/Code/DataStructs/SparseBitVect.h @@ -33,11 +33,11 @@ typedef IntSet::const_iterator IntSetConstIter; */ class RDKIT_DATASTRUCTS_EXPORT SparseBitVect : public BitVect { public: - SparseBitVect() {}; + SparseBitVect() {} //! initialize with a particular size; explicit SparseBitVect(unsigned int size) : dp_bits(nullptr), d_size(0) { _initForSize(size); - }; + } //! copy constructor SparseBitVect(const SparseBitVect &other) : BitVect(other) { @@ -53,18 +53,18 @@ class RDKIT_DATASTRUCTS_EXPORT SparseBitVect : public BitVect { SparseBitVect(const char *data, const unsigned int dataLen); SparseBitVect &operator=(const SparseBitVect &); - ~SparseBitVect() { delete dp_bits; }; + ~SparseBitVect() { delete dp_bits; } bool operator[](const unsigned int which) const; SparseBitVect operator|(const SparseBitVect &) const; - SparseBitVect operator&(const SparseBitVect &)const; + SparseBitVect operator&(const SparseBitVect &) const; SparseBitVect operator^(const SparseBitVect &) const; SparseBitVect operator~() const; //! returns a (const) pointer to our raw storage const IntSet *getBitSet() const { return dp_bits; } - unsigned int getNumBits() const { return d_size; }; + unsigned int getNumBits() const { return d_size; } bool setBit(const unsigned int which); bool setBit(const IntSetIter which); bool unsetBit(const unsigned int which); @@ -74,16 +74,17 @@ class RDKIT_DATASTRUCTS_EXPORT SparseBitVect : public BitVect { unsigned int getNumOnBits() const { return static_cast(dp_bits->size()); - }; + } unsigned int getNumOffBits() const { return d_size - static_cast(dp_bits->size()); - }; + } std::string toString() const; void getOnBits(IntVect &v) const; - void clearBits() { dp_bits->clear(); }; - IntSet *dp_bits{nullptr}; //!< our raw data, exposed for the sake of efficiency + void clearBits() { dp_bits->clear(); } + IntSet *dp_bits{ + nullptr}; //!< our raw data, exposed for the sake of efficiency bool operator==(const SparseBitVect &o) const { return *dp_bits == *o.dp_bits; diff --git a/Code/DataStructs/SparseIntVect.h b/Code/DataStructs/SparseIntVect.h index 2901cdb29..d1854f348 100644 --- a/Code/DataStructs/SparseIntVect.h +++ b/Code/DataStructs/SparseIntVect.h @@ -29,10 +29,10 @@ class SparseIntVect { public: typedef std::map StorageType; - SparseIntVect() : d_length(0){}; + SparseIntVect() : d_length(0) {} //! initialize with a particular length - SparseIntVect(IndexType length) : d_length(length){}; + SparseIntVect(IndexType length) : d_length(length) {} //! Copy constructor SparseIntVect(const SparseIntVect &other) { @@ -44,11 +44,11 @@ class SparseIntVect { //! constructor from a pickle SparseIntVect(const std::string &pkl) { initFromText(pkl.c_str(), pkl.size()); - }; + } //! constructor from a pickle SparseIntVect(const char *pkl, const unsigned int len) { initFromText(pkl, len); - }; + } SparseIntVect &operator=(const SparseIntVect &other) { if (this == &other) { @@ -84,7 +84,7 @@ class SparseIntVect { res = iter->second; } return res; - }; + } //! set the value at an index void setVal(IndexType idx, int val) { @@ -96,7 +96,7 @@ class SparseIntVect { } else { d_data.erase(idx); } - }; + } #ifdef __clang__ #pragma clang diagnostic pop #elif (defined(__GNUC__) || defined(__GNUG__)) && \ @@ -104,10 +104,10 @@ class SparseIntVect { #pragma GCC diagnostic pop #endif //! support indexing using [] - int operator[](IndexType idx) const { return getVal(idx); }; + int operator[](IndexType idx) const { return getVal(idx); } //! returns the length - IndexType getLength() const { return d_length; }; + IndexType getLength() const { return d_length; } //! returns the sum of all the elements in the vect //! the doAbs argument toggles summing the absolute values of the elements @@ -121,9 +121,9 @@ class SparseIntVect { res += abs(iter->second); } return res; - }; + } //! returns the length - unsigned int size() const { return getLength(); }; + unsigned int size() const { return getLength(); } //! returns our nonzero elements as a map(IndexType->int) const StorageType &getNonzeroElements() const { return d_data; } @@ -160,7 +160,7 @@ class SparseIntVect { } } return *this; - }; + } const SparseIntVect operator&( const SparseIntVect &other) const { SparseIntVect res(*this); @@ -198,7 +198,7 @@ class SparseIntVect { ++oIter; } return *this; - }; + } const SparseIntVect operator|( const SparseIntVect &other) const { SparseIntVect res(*this); @@ -232,7 +232,7 @@ class SparseIntVect { ++oIter; } return *this; - }; + } const SparseIntVect operator+( const SparseIntVect &other) const { SparseIntVect res(*this); @@ -266,7 +266,7 @@ class SparseIntVect { ++oIter; } return *this; - }; + } const SparseIntVect operator-( const SparseIntVect &other) const { SparseIntVect res(*this); @@ -279,11 +279,11 @@ class SparseIntVect { ++iter; } return *this; - }; + } SparseIntVect &operator*(int v) { SparseIntVect res(*this); return res *= v; - }; + } SparseIntVect &operator/=(int v) { typename StorageType::iterator iter = d_data.begin(); while (iter != d_data.end()) { @@ -291,11 +291,11 @@ class SparseIntVect { ++iter; } return *this; - }; + } SparseIntVect &operator/(int v) { SparseIntVect res(*this); return res /= v; - }; + } SparseIntVect &operator+=(int v) { typename StorageType::iterator iter = d_data.begin(); while (iter != d_data.end()) { @@ -303,11 +303,11 @@ class SparseIntVect { ++iter; } return *this; - }; + } SparseIntVect &operator+(int v) { SparseIntVect res(*this); return res += v; - }; + } SparseIntVect &operator-=(int v) { typename StorageType::iterator iter = d_data.begin(); while (iter != d_data.end()) { @@ -315,11 +315,11 @@ class SparseIntVect { ++iter; } return *this; - }; + } SparseIntVect &operator-(int v) { SparseIntVect res(*this); return res -= v; - }; + } bool operator==(const SparseIntVect &v2) const { if (d_length != v2.d_length) { @@ -352,7 +352,7 @@ class SparseIntVect { ++iter; } return ss.str(); - }; + } void fromString(const std::string &txt) { initFromText(txt.c_str(), txt.length()); @@ -393,7 +393,7 @@ class SparseIntVect { } else { throw ValueErrorException("bad version in SparseIntVect pickle"); } - }; + } template void readVals(std::stringstream &ss) { PRECONDITION(sizeof(T) <= sizeof(IndexType), "invalid size"); @@ -435,14 +435,20 @@ void calcVectParams(const SparseIntVect &v1, // the other vector: typename SparseIntVect::StorageType::const_iterator iter1, iter2; iter1 = v1.getNonzeroElements().begin(); - if (iter1 != v1.getNonzeroElements().end()) v1Sum += abs(iter1->second); + if (iter1 != v1.getNonzeroElements().end()) { + v1Sum += abs(iter1->second); + } iter2 = v2.getNonzeroElements().begin(); - if (iter2 != v2.getNonzeroElements().end()) v2Sum += abs(iter2->second); + if (iter2 != v2.getNonzeroElements().end()) { + v2Sum += abs(iter2->second); + } while (iter1 != v1.getNonzeroElements().end()) { while (iter2 != v2.getNonzeroElements().end() && iter2->first < iter1->first) { ++iter2; - if (iter2 != v2.getNonzeroElements().end()) v2Sum += abs(iter2->second); + if (iter2 != v2.getNonzeroElements().end()) { + v2Sum += abs(iter2->second); + } } if (iter2 != v2.getNonzeroElements().end()) { if (iter2->first == iter1->first) { @@ -452,10 +458,14 @@ void calcVectParams(const SparseIntVect &v1, andSum += abs(iter1->second); } ++iter2; - if (iter2 != v2.getNonzeroElements().end()) v2Sum += abs(iter2->second); + if (iter2 != v2.getNonzeroElements().end()) { + v2Sum += abs(iter2->second); + } } ++iter1; - if (iter1 != v1.getNonzeroElements().end()) v1Sum += abs(iter1->second); + if (iter1 != v1.getNonzeroElements().end()) { + v1Sum += abs(iter1->second); + } } else { break; } diff --git a/Code/Demos/RDKit/Basement/TemplEnum/TemplEnum.h b/Code/Demos/RDKit/Basement/TemplEnum/TemplEnum.h index be666fe86..62c46dd56 100644 --- a/Code/Demos/RDKit/Basement/TemplEnum/TemplEnum.h +++ b/Code/Demos/RDKit/Basement/TemplEnum/TemplEnum.h @@ -14,10 +14,10 @@ using namespace RDKit; class EnumException : public std::exception { public: - EnumException(const char *msg) : _msg(msg){}; - EnumException(const std::string msg) : _msg(msg){}; - const char *what() const noexcept override { return _msg.c_str(); }; - ~EnumException() noexcept {}; + EnumException(const char *msg) : _msg(msg) {} + EnumException(const std::string msg) : _msg(msg) {} + const char *what() const noexcept override { return _msg.c_str(); } + ~EnumException() noexcept {} private: std::string _msg; diff --git a/Code/Demos/RDKit/Basement/xpcom/RDMolImpl.h b/Code/Demos/RDKit/Basement/xpcom/RDMolImpl.h index a81e6b95a..bfd0be2cd 100644 --- a/Code/Demos/RDKit/Basement/xpcom/RDMolImpl.h +++ b/Code/Demos/RDKit/Basement/xpcom/RDMolImpl.h @@ -11,8 +11,8 @@ class RDMolecule : public IRDMolecule { NS_DECL_ISUPPORTS NS_DECL_IRDMOLECULE - RDMolecule() : dp_mol(0){}; - RDMolecule(RDKit::ROMol *mol) : dp_mol(mol){}; + RDMolecule() : dp_mol(0) {} + RDMolecule(RDKit::ROMol *mol) : dp_mol(mol) {} RDKit::ROMol *dp_mol; private: diff --git a/Code/Demos/RDKit/Basement/xpcom/RDMolSupplierImpl.h b/Code/Demos/RDKit/Basement/xpcom/RDMolSupplierImpl.h index 3e40e29b3..a7bad708a 100644 --- a/Code/Demos/RDKit/Basement/xpcom/RDMolSupplierImpl.h +++ b/Code/Demos/RDKit/Basement/xpcom/RDMolSupplierImpl.h @@ -12,8 +12,8 @@ class RDMolSupplier : public IRDMolSupplier { NS_DECL_ISUPPORTS NS_DECL_IRDMOLSUPPLIER - RDMolSupplier() : dp_suppl(0){}; - RDMolSupplier(RDKit::MolSupplier *suppl) : dp_suppl(suppl){}; + RDMolSupplier() : dp_suppl(0) {} + RDMolSupplier(RDKit::MolSupplier *suppl) : dp_suppl(suppl) {} RDKit::MolSupplier *dp_suppl; private: diff --git a/Code/Demos/boost/EBV_err/classA.h b/Code/Demos/boost/EBV_err/classA.h index c0ca430ad..7dae5679d 100644 --- a/Code/Demos/boost/EBV_err/classA.h +++ b/Code/Demos/boost/EBV_err/classA.h @@ -16,7 +16,7 @@ class classA { public: - classA() { setProp("useless", 10); }; + classA() { setProp("useless", 10); } ~classA() {} void printA() const { diff --git a/Code/Demos/boost/EBV_err/classC.h b/Code/Demos/boost/EBV_err/classC.h index 2f92d6a92..926f129bc 100644 --- a/Code/Demos/boost/EBV_err/classC.h +++ b/Code/Demos/boost/EBV_err/classC.h @@ -20,7 +20,7 @@ typedef std::vector PAIR_VECT; class classC { public: - classC() { setProp("useless", 10); }; + classC() { setProp("useless", 10); } ~classC() {} void printC() const { diff --git a/Code/Demos/boost/cross_mod_err/classA.h b/Code/Demos/boost/cross_mod_err/classA.h index c0ca430ad..7dae5679d 100644 --- a/Code/Demos/boost/cross_mod_err/classA.h +++ b/Code/Demos/boost/cross_mod_err/classA.h @@ -16,7 +16,7 @@ class classA { public: - classA() { setProp("useless", 10); }; + classA() { setProp("useless", 10); } ~classA() {} void printA() const { diff --git a/Code/Demos/boost/cross_mod_err/classC.h b/Code/Demos/boost/cross_mod_err/classC.h index 2f92d6a92..926f129bc 100644 --- a/Code/Demos/boost/cross_mod_err/classC.h +++ b/Code/Demos/boost/cross_mod_err/classC.h @@ -20,7 +20,7 @@ typedef std::vector PAIR_VECT; class classC { public: - classC() { setProp("useless", 10); }; + classC() { setProp("useless", 10); } ~classC() {} void printC() const { diff --git a/Code/Demos/boost/cross_module/mods.h b/Code/Demos/boost/cross_module/mods.h index 418e10eb5..fa6495a62 100644 --- a/Code/Demos/boost/cross_module/mods.h +++ b/Code/Demos/boost/cross_module/mods.h @@ -6,12 +6,12 @@ class ClassA { public: - int get4() { return 4; }; + int get4() { return 4; } }; class ClassB { public: - ClassA *returnOther() { return new ClassA; }; - int get3() { return 3; }; - int acceptOther(ClassA *other) { return other->get4(); }; + ClassA *returnOther() { return new ClassA; } + int get3() { return 3; } + int acceptOther(ClassA *other) { return other->get4(); } }; diff --git a/Code/DistGeom/BoundsMatrix.h b/Code/DistGeom/BoundsMatrix.h index b47af52b9..7113e9e2a 100644 --- a/Code/DistGeom/BoundsMatrix.h +++ b/Code/DistGeom/BoundsMatrix.h @@ -30,9 +30,9 @@ class RDKIT_DISTGEOMETRY_EXPORT BoundsMatrix typedef boost::shared_array DATA_SPTR; explicit BoundsMatrix(unsigned int N) - : RDNumeric::SquareMatrix(N, 0.0){}; + : RDNumeric::SquareMatrix(N, 0.0) {} BoundsMatrix(unsigned int N, DATA_SPTR data) - : RDNumeric::SquareMatrix(N, data){}; + : RDNumeric::SquareMatrix(N, data) {} //! Get the upper bound between points i and j inline double getUpperBound(unsigned int i, unsigned int j) const { diff --git a/Code/DistGeom/ChiralViolationContrib.h b/Code/DistGeom/ChiralViolationContrib.h index 22562192b..e163d418a 100644 --- a/Code/DistGeom/ChiralViolationContrib.h +++ b/Code/DistGeom/ChiralViolationContrib.h @@ -16,9 +16,7 @@ class ChiralSet; class RDKIT_DISTGEOMETRY_EXPORT ChiralViolationContrib : public ForceFields::ForceFieldContrib { public: - ChiralViolationContrib() - - {}; + ChiralViolationContrib() {} //! Constructor /*! @@ -40,7 +38,7 @@ class RDKIT_DISTGEOMETRY_EXPORT ChiralViolationContrib void getGrad(double *pos, double *grad) const; virtual ChiralViolationContrib *copy() const { return new ChiralViolationContrib(*this); - }; + } static double calcChiralVolume(unsigned int idx1, unsigned int idx2, unsigned int idx3, unsigned int idx4, diff --git a/Code/DistGeom/DistViolationContrib.h b/Code/DistGeom/DistViolationContrib.h index 37d3f6830..fd2fc5307 100644 --- a/Code/DistGeom/DistViolationContrib.h +++ b/Code/DistGeom/DistViolationContrib.h @@ -19,8 +19,7 @@ namespace DistGeom { class RDKIT_DISTGEOMETRY_EXPORT DistViolationContrib : public ForceFields::ForceFieldContrib { public: - DistViolationContrib() - {}; + DistViolationContrib() {} //! Constructor /*! @@ -40,12 +39,14 @@ class RDKIT_DISTGEOMETRY_EXPORT DistViolationContrib void getGrad(double *pos, double *grad) const; virtual DistViolationContrib *copy() const { return new DistViolationContrib(*this); - }; + } private: unsigned int d_end1Idx{0}, d_end2Idx{0}; //!< indices of end points - double d_ub{1000.0}; //!< upper bound on the distance between d_end1Idx,d_end2Idx - double d_lb{0.0}; //!< lower bound on the distance between d_end1Idx,d_end2Idx + double d_ub{ + 1000.0}; //!< upper bound on the distance between d_end1Idx, d_end2Idx + double d_lb{ + 0.0}; //!< lower bound on the distance between d_end1Idx, d_end2Idx double d_weight{1.0}; //!< used to adjust relative contribution weights }; } // namespace DistGeom diff --git a/Code/DistGeom/FourthDimContrib.h b/Code/DistGeom/FourthDimContrib.h index 29598fdd7..31e620537 100644 --- a/Code/DistGeom/FourthDimContrib.h +++ b/Code/DistGeom/FourthDimContrib.h @@ -15,7 +15,7 @@ namespace DistGeom { class RDKIT_DISTGEOMETRY_EXPORT FourthDimContrib : public ForceFields::ForceFieldContrib { public: - FourthDimContrib() {}; + FourthDimContrib() {} //! Constructor /*! @@ -30,7 +30,7 @@ class RDKIT_DISTGEOMETRY_EXPORT FourthDimContrib PRECONDITION(owner, "bad force field"); PRECONDITION(owner->dimension() == 4, "force field has wrong dimension"); dp_forceField = owner; - }; + } //! return the contribution of this contrib to the energy of a given state double getEnergy(double *pos) const { @@ -52,9 +52,7 @@ class RDKIT_DISTGEOMETRY_EXPORT FourthDimContrib unsigned int pid = d_idx * dp_forceField->dimension() + 3; grad[pid] += d_weight * pos[pid]; } - virtual FourthDimContrib *copy() const { - return new FourthDimContrib(*this); - }; + virtual FourthDimContrib *copy() const { return new FourthDimContrib(*this); } private: unsigned int d_idx{0}; diff --git a/Code/Features/Feature.h b/Code/Features/Feature.h index 10b1b166a..3010e0210 100644 --- a/Code/Features/Feature.h +++ b/Code/Features/Feature.h @@ -19,24 +19,24 @@ template class ExplicitFeature { public: - ExplicitFeature(){}; + ExplicitFeature() {} explicit ExplicitFeature(const FAMILYMARKER &f, const TYPEMARKER &t) - : d_family(f), d_type(t){}; + : d_family(f), d_type(t) {} ExplicitFeature(const FAMILYMARKER &f, const TYPEMARKER &t, const LOCTYPE &loc) - : d_family(f), d_type(t), d_loc(loc){}; + : d_family(f), d_type(t), d_loc(loc) {} - const FAMILYMARKER &getFamily() const { return d_family; }; - void setFamily(const FAMILYMARKER &f) { d_family = f; }; + const FAMILYMARKER &getFamily() const { return d_family; } + void setFamily(const FAMILYMARKER &f) { d_family = f; } - const TYPEMARKER &getType() const { return d_type; }; - void setType(const TYPEMARKER &t) { d_type = t; }; + const TYPEMARKER &getType() const { return d_type; } + void setType(const TYPEMARKER &t) { d_type = t; } - const LOCTYPE &getLoc() const { return d_loc; }; - void setLoc(const LOCTYPE &loc) { d_loc = loc; }; + const LOCTYPE &getLoc() const { return d_loc; } + void setLoc(const LOCTYPE &loc) { d_loc = loc; } - const std::vector &getDirs() const { return d_dirs; }; - std::vector &getDirs() { return d_dirs; }; + const std::vector &getDirs() const { return d_dirs; } + std::vector &getDirs() { return d_dirs; } private: FAMILYMARKER d_family; @@ -49,15 +49,15 @@ template class ImplicitFeature { public: - ImplicitFeature() : d_weightSum(0.0){}; + ImplicitFeature() : d_weightSum(0.0) {} explicit ImplicitFeature(const FAMILYMARKER &f, const TYPEMARKER &t) - : d_weightSum(0.0), d_family(f), d_type(t){}; + : d_weightSum(0.0), d_family(f), d_type(t) {} - const FAMILYMARKER &getFamily() const { return d_family; }; - void setFamily(const FAMILYMARKER &f) { d_family = f; }; + const FAMILYMARKER &getFamily() const { return d_family; } + void setFamily(const FAMILYMARKER &f) { d_family = f; } - const TYPEMARKER &getType() const { return d_type; }; - void setType(const TYPEMARKER &t) { d_type = t; }; + const TYPEMARKER &getType() const { return d_type; } + void setType(const TYPEMARKER &t) { d_type = t; } LOCTYPE getLoc() const { PRECONDITION(d_weights.size() == d_locs.size(), "weight/locs mismatch"); @@ -68,7 +68,7 @@ class ImplicitFeature { accum += tmp; } return accum; - }; + } void addPoint(const LOCTYPE *p, double weight = 1.0) { d_locs.push_back(p); d_weights.push_back(weight); @@ -80,8 +80,8 @@ class ImplicitFeature { d_weightSum = 0.0; } - const std::vector &getDirs() const { return d_dirs; }; - std::vector &getDirs() { return d_dirs; }; + const std::vector &getDirs() const { return d_dirs; } + std::vector &getDirs() { return d_dirs; } private: double d_weightSum; diff --git a/Code/ForceField/Contrib.h b/Code/ForceField/Contrib.h index 533acc729..df29d0205 100644 --- a/Code/ForceField/Contrib.h +++ b/Code/ForceField/Contrib.h @@ -19,9 +19,9 @@ class RDKIT_FORCEFIELD_EXPORT ForceFieldContrib { public: friend class ForceField; - ForceFieldContrib() {}; - ForceFieldContrib(ForceFields::ForceField *owner) : dp_forceField(owner){}; - virtual ~ForceFieldContrib(){}; + ForceFieldContrib() {} + ForceFieldContrib(ForceFields::ForceField *owner) : dp_forceField(owner) {} + virtual ~ForceFieldContrib() {} //! returns our contribution to the energy of a position virtual double getEnergy(double *pos) const = 0; diff --git a/Code/ForceField/ForceField.h b/Code/ForceField/ForceField.h index 3e527705a..5119f5e3b 100644 --- a/Code/ForceField/ForceField.h +++ b/Code/ForceField/ForceField.h @@ -79,9 +79,7 @@ typedef std::vector ContribPtrVect; class RDKIT_FORCEFIELD_EXPORT ForceField { public: //! construct with a dimension - ForceField(unsigned int dimension = 3) - : d_dimension(dimension) - {}; + ForceField(unsigned int dimension = 3) : d_dimension(dimension) {} ~ForceField(); @@ -180,12 +178,12 @@ class RDKIT_FORCEFIELD_EXPORT ForceField { // setters and getters //! returns a reference to our points (a PointPtrVect) - RDGeom::PointPtrVect &positions() { return d_positions; }; - const RDGeom::PointPtrVect &positions() const { return d_positions; }; + RDGeom::PointPtrVect &positions() { return d_positions; } + const RDGeom::PointPtrVect &positions() const { return d_positions; } //! returns a reference to our contribs (a ContribPtrVect) - ContribPtrVect &contribs() { return d_contribs; }; - const ContribPtrVect &contribs() const { return d_contribs; }; + ContribPtrVect &contribs() { return d_contribs; } + const ContribPtrVect &contribs() const { return d_contribs; } //! returns the distance between two points /*! @@ -222,16 +220,16 @@ class RDKIT_FORCEFIELD_EXPORT ForceField { unsigned int dimension() const { return d_dimension; } //! returns the number of points the ForceField is handling - unsigned int numPoints() const { return d_numPoints; }; + unsigned int numPoints() const { return d_numPoints; } - INT_VECT &fixedPoints() { return d_fixedPoints; }; - const INT_VECT &fixedPoints() const { return d_fixedPoints; }; + INT_VECT &fixedPoints() { return d_fixedPoints; } + const INT_VECT &fixedPoints() const { return d_fixedPoints; } protected: unsigned int d_dimension; - bool df_init{false}; //!< whether or not we've been initialized - unsigned int d_numPoints{0}; //!< the number of active points - double *dp_distMat{nullptr}; //!< our internal distance matrix + bool df_init{false}; //!< whether or not we've been initialized + unsigned int d_numPoints{0}; //!< the number of active points + double *dp_distMat{nullptr}; //!< our internal distance matrix RDGeom::PointPtrVect d_positions; //!< pointers to the points we're using ContribPtrVect d_contribs; //!< contributions to the energy INT_VECT d_fixedPoints; diff --git a/Code/ForceField/MMFF/AngleBend.h b/Code/ForceField/MMFF/AngleBend.h index b98d4a16b..8f66cf1cb 100644 --- a/Code/ForceField/MMFF/AngleBend.h +++ b/Code/ForceField/MMFF/AngleBend.h @@ -25,7 +25,7 @@ class MMFFProp; //! The angle-bend term for MMFF class RDKIT_FORCEFIELD_EXPORT AngleBendContrib : public ForceFieldContrib { public: - AngleBendContrib() {}; + AngleBendContrib() {} //! Constructor /*! The angle is between atom1 - atom2 - atom3 @@ -42,9 +42,7 @@ class RDKIT_FORCEFIELD_EXPORT AngleBendContrib : public ForceFieldContrib { const MMFFProp *mmffPropParamsCentralAtom); double getEnergy(double *pos) const; void getGrad(double *pos, double *grad) const; - virtual AngleBendContrib *copy() const { - return new AngleBendContrib(*this); - }; + virtual AngleBendContrib *copy() const { return new AngleBendContrib(*this); } private: bool d_isLinear; diff --git a/Code/ForceField/MMFF/AngleConstraint.h b/Code/ForceField/MMFF/AngleConstraint.h index 48ff353f0..1cbccd846 100644 --- a/Code/ForceField/MMFF/AngleConstraint.h +++ b/Code/ForceField/MMFF/AngleConstraint.h @@ -22,7 +22,7 @@ namespace MMFF { class RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib : public ForceFieldContrib { public: - AngleConstraintContrib(){}; + AngleConstraintContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -50,7 +50,7 @@ class RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib virtual AngleConstraintContrib *copy() const { return new AngleConstraintContrib(*this); - }; + } private: double computeAngleTerm(double angle) const; diff --git a/Code/ForceField/MMFF/BondStretch.h b/Code/ForceField/MMFF/BondStretch.h index 782b7fa1f..818c351a0 100644 --- a/Code/ForceField/MMFF/BondStretch.h +++ b/Code/ForceField/MMFF/BondStretch.h @@ -22,7 +22,7 @@ class MMFFBondStretchEmpiricalRule; //! The bond-stretch term for MMFF class RDKIT_FORCEFIELD_EXPORT BondStretchContrib : public ForceFieldContrib { public: - BondStretchContrib() {}; + BondStretchContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -42,12 +42,12 @@ class RDKIT_FORCEFIELD_EXPORT BondStretchContrib : public ForceFieldContrib { virtual BondStretchContrib *copy() const { return new BondStretchContrib(*this); - }; + } private: int d_at1Idx{-1}, d_at2Idx{-1}; //!< indices of end points - double d_r0; //!< rest length of the bond - double d_kb; //!< force constant of the bond + double d_r0; //!< rest length of the bond + double d_kb; //!< force constant of the bond }; namespace Utils { diff --git a/Code/ForceField/MMFF/DistanceConstraint.h b/Code/ForceField/MMFF/DistanceConstraint.h index 23d0730b8..c2c431c57 100644 --- a/Code/ForceField/MMFF/DistanceConstraint.h +++ b/Code/ForceField/MMFF/DistanceConstraint.h @@ -22,7 +22,7 @@ namespace MMFF { class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib : public ForceFieldContrib { public: - DistanceConstraintContrib() {}; + DistanceConstraintContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -49,12 +49,12 @@ class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib void getGrad(double *pos, double *grad) const; virtual DistanceConstraintContrib *copy() const { return new DistanceConstraintContrib(*this); - }; + } private: - int d_end1Idx{-1}, d_end2Idx{-1}; //!< indices of end points - double d_minLen, d_maxLen; //!< rest length of the bond - double d_forceConstant; //!< force constant of the bond + int d_end1Idx{-1}, d_end2Idx{-1}; //!< indices of end points + double d_minLen, d_maxLen; //!< rest length of the bond + double d_forceConstant; //!< force constant of the bond }; } // namespace MMFF } // namespace ForceFields diff --git a/Code/ForceField/MMFF/Nonbonded.h b/Code/ForceField/MMFF/Nonbonded.h index fa7d67908..873287918 100644 --- a/Code/ForceField/MMFF/Nonbonded.h +++ b/Code/ForceField/MMFF/Nonbonded.h @@ -23,7 +23,7 @@ class MMFFVdW; //! the van der Waals term for MMFF class RDKIT_FORCEFIELD_EXPORT VdWContrib : public ForceFieldContrib { public: - VdWContrib() {}; + VdWContrib() {} //! Constructor /*! @@ -36,7 +36,7 @@ class RDKIT_FORCEFIELD_EXPORT VdWContrib : public ForceFieldContrib { const MMFFVdWRijstarEps *mmffVdWConstants); double getEnergy(double *pos) const; void getGrad(double *pos, double *grad) const; - virtual VdWContrib *copy() const { return new VdWContrib(*this); }; + virtual VdWContrib *copy() const { return new VdWContrib(*this); } private: int d_at1Idx{-1}, d_at2Idx{-1}; @@ -47,7 +47,7 @@ class RDKIT_FORCEFIELD_EXPORT VdWContrib : public ForceFieldContrib { //! the electrostatic term for MMFF class RDKIT_FORCEFIELD_EXPORT EleContrib : public ForceFieldContrib { public: - EleContrib() {}; + EleContrib() {} //! Constructor /*! @@ -61,7 +61,7 @@ class RDKIT_FORCEFIELD_EXPORT EleContrib : public ForceFieldContrib { double getEnergy(double *pos) const; void getGrad(double *pos, double *grad) const; - virtual EleContrib *copy() const { return new EleContrib(*this); }; + virtual EleContrib *copy() const { return new EleContrib(*this); } private: int d_at1Idx{-1}, d_at2Idx{-1}; diff --git a/Code/ForceField/MMFF/OopBend.h b/Code/ForceField/MMFF/OopBend.h index df49814ff..a9606af44 100644 --- a/Code/ForceField/MMFF/OopBend.h +++ b/Code/ForceField/MMFF/OopBend.h @@ -23,7 +23,7 @@ class MMFFOop; //! the out-of-plane term for MMFF class RDKIT_FORCEFIELD_EXPORT OopBendContrib : public ForceFieldContrib { public: - OopBendContrib() {}; + OopBendContrib() {} //! Constructor /*! The Wilson angle is between the vector formed by atom2-atom4 @@ -40,7 +40,7 @@ and the angle formed by atom1-atom2-atom3 const MMFFOop *mmffOopParams); double getEnergy(double *pos) const; void getGrad(double *pos, double *grad) const; - virtual OopBendContrib *copy() const { return new OopBendContrib(*this); }; + virtual OopBendContrib *copy() const { return new OopBendContrib(*this); } private: int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1}, d_at4Idx{-1}; diff --git a/Code/ForceField/MMFF/PositionConstraint.h b/Code/ForceField/MMFF/PositionConstraint.h index 895e9cfe3..d7618e6a8 100644 --- a/Code/ForceField/MMFF/PositionConstraint.h +++ b/Code/ForceField/MMFF/PositionConstraint.h @@ -23,7 +23,7 @@ namespace MMFF { class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib : public ForceFieldContrib { public: - PositionConstraintContrib() {}; + PositionConstraintContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -42,10 +42,10 @@ class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib void getGrad(double *pos, double *grad) const; virtual PositionConstraintContrib *copy() const { return new PositionConstraintContrib(*this); - }; + } private: - int d_atIdx{-1}; //!< index of the restrained atom + int d_atIdx{-1}; //!< index of the restrained atom double d_maxDispl; //!< maximum allowed displacement RDGeom::Point3D d_pos0; //!< reference position double d_forceConstant; //!< force constant of the bond diff --git a/Code/ForceField/MMFF/StretchBend.h b/Code/ForceField/MMFF/StretchBend.h index 180491f1c..ef4605967 100644 --- a/Code/ForceField/MMFF/StretchBend.h +++ b/Code/ForceField/MMFF/StretchBend.h @@ -26,7 +26,7 @@ class MMFFProp; //! The angle-bend term for MMFF class RDKIT_FORCEFIELD_EXPORT StretchBendContrib : public ForceFieldContrib { public: - StretchBendContrib() {}; + StretchBendContrib() {} //! Constructor /*! The angle is between atom1 - atom2 - atom3 @@ -49,7 +49,7 @@ class RDKIT_FORCEFIELD_EXPORT StretchBendContrib : public ForceFieldContrib { void getGrad(double *pos, double *grad) const; virtual StretchBendContrib *copy() const { return new StretchBendContrib(*this); - }; + } private: int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1}; diff --git a/Code/ForceField/MMFF/TorsionAngle.h b/Code/ForceField/MMFF/TorsionAngle.h index 24ad925c7..5cc834a72 100644 --- a/Code/ForceField/MMFF/TorsionAngle.h +++ b/Code/ForceField/MMFF/TorsionAngle.h @@ -27,7 +27,7 @@ class MMFFTor; //! the torsion term for MMFF class RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib : public ForceFieldContrib { public: - TorsionAngleContrib(){}; + TorsionAngleContrib() {} //! Constructor /*! The torsion is between atom1 - atom2 - atom3 - atom4 @@ -48,7 +48,7 @@ class RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib : public ForceFieldContrib { void getGrad(double *pos, double *grad) const; virtual TorsionAngleContrib *copy() const { return new TorsionAngleContrib(*this); - }; + } private: int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1}, d_at4Idx{-1}; diff --git a/Code/ForceField/MMFF/TorsionConstraint.h b/Code/ForceField/MMFF/TorsionConstraint.h index cf4acc3b1..98625ac25 100644 --- a/Code/ForceField/MMFF/TorsionConstraint.h +++ b/Code/ForceField/MMFF/TorsionConstraint.h @@ -22,7 +22,7 @@ namespace MMFF { class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib : public ForceFieldContrib { public: - TorsionConstraintContrib(){}; + TorsionConstraintContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -51,7 +51,7 @@ class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib void getGrad(double *pos, double *grad) const; virtual TorsionConstraintContrib *copy() const { return new TorsionConstraintContrib(*this); - }; + } private: void setParameters(ForceField *owner, unsigned int idx1, unsigned int idx2, diff --git a/Code/ForceField/UFF/AngleBend.h b/Code/ForceField/UFF/AngleBend.h index 485ddae48..fbebd0a3b 100644 --- a/Code/ForceField/UFF/AngleBend.h +++ b/Code/ForceField/UFF/AngleBend.h @@ -21,7 +21,7 @@ class AtomicParams; //! The angle-bend term for the Universal Force Field class RDKIT_FORCEFIELD_EXPORT AngleBendContrib : public ForceFieldContrib { public: - AngleBendContrib(){}; + AngleBendContrib() {} //! Constructor /*! The angle is between atom1 - atom2 - atom3 @@ -50,9 +50,7 @@ class RDKIT_FORCEFIELD_EXPORT AngleBendContrib : public ForceFieldContrib { double getEnergy(double *pos) const; void getGrad(double *pos, double *grad) const; - virtual AngleBendContrib *copy() const { - return new AngleBendContrib(*this); - }; + virtual AngleBendContrib *copy() const { return new AngleBendContrib(*this); } private: int d_at1Idx{-1}; diff --git a/Code/ForceField/UFF/AngleConstraint.h b/Code/ForceField/UFF/AngleConstraint.h index e9930a8b9..c419e9152 100644 --- a/Code/ForceField/UFF/AngleConstraint.h +++ b/Code/ForceField/UFF/AngleConstraint.h @@ -22,7 +22,7 @@ namespace UFF { class RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib : public ForceFieldContrib { public: - AngleConstraintContrib(){}; + AngleConstraintContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -50,7 +50,7 @@ class RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib virtual AngleConstraintContrib *copy() const { return new AngleConstraintContrib(*this); - }; + } private: double computeAngleTerm(double angle) const; diff --git a/Code/ForceField/UFF/BondStretch.h b/Code/ForceField/UFF/BondStretch.h index 648a5775d..316584ba7 100644 --- a/Code/ForceField/UFF/BondStretch.h +++ b/Code/ForceField/UFF/BondStretch.h @@ -19,7 +19,7 @@ class AtomicParams; //! The bond-stretch term for the Universal Force Field class RDKIT_FORCEFIELD_EXPORT BondStretchContrib : public ForceFieldContrib { public: - BondStretchContrib(){}; + BondStretchContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -40,7 +40,7 @@ class RDKIT_FORCEFIELD_EXPORT BondStretchContrib : public ForceFieldContrib { virtual BondStretchContrib *copy() const { return new BondStretchContrib(*this); - }; + } private: int d_end1Idx{-1}; //!< indices of end points diff --git a/Code/ForceField/UFF/DistanceConstraint.h b/Code/ForceField/UFF/DistanceConstraint.h index 797dfb706..087430c7c 100644 --- a/Code/ForceField/UFF/DistanceConstraint.h +++ b/Code/ForceField/UFF/DistanceConstraint.h @@ -22,7 +22,7 @@ namespace UFF { class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib : public ForceFieldContrib { public: - DistanceConstraintContrib(){}; + DistanceConstraintContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -49,7 +49,7 @@ class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib void getGrad(double *pos, double *grad) const; virtual DistanceConstraintContrib *copy() const { return new DistanceConstraintContrib(*this); - }; + } private: int d_end1Idx{-1}; //!< indices of end points diff --git a/Code/ForceField/UFF/Inversion.h b/Code/ForceField/UFF/Inversion.h index 18558edb1..b15d1b40e 100644 --- a/Code/ForceField/UFF/Inversion.h +++ b/Code/ForceField/UFF/Inversion.h @@ -23,7 +23,7 @@ class AtomicParams; //! The inversion term for the Universal Force Field class RDKIT_FORCEFIELD_EXPORT InversionContrib : public ForceFieldContrib { public: - InversionContrib(){}; + InversionContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -43,9 +43,7 @@ class RDKIT_FORCEFIELD_EXPORT InversionContrib : public ForceFieldContrib { double getEnergy(double *pos) const; void getGrad(double *pos, double *grad) const; - virtual InversionContrib *copy() const { - return new InversionContrib(*this); - }; + virtual InversionContrib *copy() const { return new InversionContrib(*this); } private: int d_at1Idx{-1}; diff --git a/Code/ForceField/UFF/Nonbonded.h b/Code/ForceField/UFF/Nonbonded.h index 7aeb35b40..edf6cb3a3 100644 --- a/Code/ForceField/UFF/Nonbonded.h +++ b/Code/ForceField/UFF/Nonbonded.h @@ -30,7 +30,7 @@ class AtomicParams; */ class RDKIT_FORCEFIELD_EXPORT vdWContrib : public ForceFieldContrib { public: - vdWContrib(){}; + vdWContrib() {} //! Constructor /*! @@ -48,7 +48,7 @@ class RDKIT_FORCEFIELD_EXPORT vdWContrib : public ForceFieldContrib { double threshMultiplier = 10.0); double getEnergy(double *pos) const; void getGrad(double *pos, double *grad) const; - virtual vdWContrib *copy() const { return new vdWContrib(*this); }; + virtual vdWContrib *copy() const { return new vdWContrib(*this); } private: int d_at1Idx{-1}; diff --git a/Code/ForceField/UFF/PositionConstraint.h b/Code/ForceField/UFF/PositionConstraint.h index 98ccd5890..f7619586e 100644 --- a/Code/ForceField/UFF/PositionConstraint.h +++ b/Code/ForceField/UFF/PositionConstraint.h @@ -23,7 +23,7 @@ namespace UFF { class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib : public ForceFieldContrib { public: - PositionConstraintContrib() {}; + PositionConstraintContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -42,10 +42,10 @@ class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib void getGrad(double *pos, double *grad) const; virtual PositionConstraintContrib *copy() const { return new PositionConstraintContrib(*this); - }; + } private: - int d_atIdx{-1}; //!< index of the restrained atom + int d_atIdx{-1}; //!< index of the restrained atom double d_maxDispl; //!< maximum allowed displacement RDGeom::Point3D d_pos0; //!< reference position double d_forceConstant; //!< force constant of the bond diff --git a/Code/ForceField/UFF/TorsionAngle.h b/Code/ForceField/UFF/TorsionAngle.h index 1c8f69a28..03a6ce63a 100644 --- a/Code/ForceField/UFF/TorsionAngle.h +++ b/Code/ForceField/UFF/TorsionAngle.h @@ -28,7 +28,7 @@ class AtomicParams; //! the torsion term for the Universal Force Field class RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib : public ForceFieldContrib { public: - TorsionAngleContrib(){}; + TorsionAngleContrib() {} //! Constructor /*! The torsion is between atom1 - atom2 - atom3 - atom4 @@ -68,10 +68,10 @@ class RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib : public ForceFieldContrib { void getGrad(double *pos, double *grad) const; void scaleForceConstant(unsigned int count) { this->d_forceConstant /= static_cast(count); - }; + } virtual TorsionAngleContrib *copy() const { return new TorsionAngleContrib(*this); - }; + } private: int d_at1Idx{-1}; diff --git a/Code/ForceField/UFF/TorsionConstraint.h b/Code/ForceField/UFF/TorsionConstraint.h index 84108b610..aa36c70ae 100644 --- a/Code/ForceField/UFF/TorsionConstraint.h +++ b/Code/ForceField/UFF/TorsionConstraint.h @@ -22,7 +22,7 @@ namespace UFF { class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib : public ForceFieldContrib { public: - TorsionConstraintContrib(){}; + TorsionConstraintContrib() {} //! Constructor /*! \param owner pointer to the owning ForceField @@ -51,7 +51,7 @@ class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib void getGrad(double *pos, double *grad) const; virtual TorsionConstraintContrib *copy() const { return new TorsionConstraintContrib(*this); - }; + } private: void setParameters(ForceField *owner, unsigned int idx1, unsigned int idx2, diff --git a/Code/ForceField/Wrap/PyForceField.h b/Code/ForceField/Wrap/PyForceField.h index 63de3c84f..df699c20b 100644 --- a/Code/ForceField/Wrap/PyForceField.h +++ b/Code/ForceField/Wrap/PyForceField.h @@ -23,7 +23,7 @@ namespace python = boost::python; namespace ForceFields { class PyForceField { public: - PyForceField(ForceField *f) : field(f){}; + PyForceField(ForceField *f) : field(f) {} ~PyForceField() { // std::cerr << " *** destroy PyForce field " << std::endl; @@ -86,18 +86,18 @@ class PyForceField { class PyMMFFMolProperties { public: PyMMFFMolProperties(RDKit::MMFF::MMFFMolProperties *mp) - : mmffMolProperties(mp){}; - ~PyMMFFMolProperties(){}; + : mmffMolProperties(mp) {} + ~PyMMFFMolProperties() {} unsigned int getMMFFAtomType(unsigned int idx) { return (unsigned int)(mmffMolProperties->getMMFFAtomType(idx)); - }; + } double getMMFFFormalCharge(unsigned int idx) { return mmffMolProperties->getMMFFFormalCharge(idx); - }; + } double getMMFFPartialCharge(unsigned int idx) { return mmffMolProperties->getMMFFPartialCharge(idx); - }; + } PyObject *getMMFFBondStretchParams(const RDKit::ROMol &mol, const unsigned int idx1, const unsigned int idx2); @@ -122,37 +122,37 @@ class PyMMFFMolProperties { PyObject *getMMFFVdWParams(const unsigned int idx1, const unsigned int idx2); void setMMFFDielectricModel(std::uint8_t dielModel) { mmffMolProperties->setMMFFDielectricModel(dielModel); - }; + } void setMMFFDielectricConstant(double dielConst) { mmffMolProperties->setMMFFDielectricConstant(dielConst); - }; + } void setMMFFBondTerm(bool state) { mmffMolProperties->setMMFFBondTerm(state); - }; + } void setMMFFAngleTerm(const bool state) { mmffMolProperties->setMMFFAngleTerm(state); - }; + } void setMMFFStretchBendTerm(const bool state) { mmffMolProperties->setMMFFStretchBendTerm(state); - }; + } void setMMFFOopTerm(const bool state) { mmffMolProperties->setMMFFOopTerm(state); - }; + } void setMMFFTorsionTerm(const bool state) { mmffMolProperties->setMMFFTorsionTerm(state); - }; + } void setMMFFVdWTerm(const bool state) { mmffMolProperties->setMMFFVdWTerm(state); - }; + } void setMMFFEleTerm(const bool state) { mmffMolProperties->setMMFFEleTerm(state); - }; + } void setMMFFVariant(const std::string &mmffVariant) { mmffMolProperties->setMMFFVariant(mmffVariant); - }; + } void setMMFFVerbosity(unsigned int verbosity) { mmffMolProperties->setMMFFVerbosity(verbosity); - }; + } boost::shared_ptr mmffMolProperties; }; PyObject *getUFFBondStretchParams(const RDKit::ROMol &mol, diff --git a/Code/Fuzz/include/fuzzer/FuzzedDataProvider.h b/Code/Fuzz/include/fuzzer/FuzzedDataProvider.h index 83bcd0134..e5a5f48d2 100644 --- a/Code/Fuzz/include/fuzzer/FuzzedDataProvider.h +++ b/Code/Fuzz/include/fuzzer/FuzzedDataProvider.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -41,10 +42,12 @@ class FuzzedDataProvider { // when splitting fuzzing input into pieces, as every piece is put into a // separate buffer (i.e. ASan would catch any under-/overflow) and the memory // will be released automatically. - template std::vector ConsumeBytes(size_t num_bytes); + template + std::vector ConsumeBytes(size_t num_bytes); template std::vector ConsumeBytesWithTerminator(size_t num_bytes, T terminator = 0); - template std::vector ConsumeRemainingBytes(); + template + std::vector ConsumeRemainingBytes(); // Methods returning strings. Use only when you need a std::string or a null // terminated C-string. Otherwise, prefer the methods returning std::vector. @@ -54,24 +57,32 @@ class FuzzedDataProvider { std::string ConsumeRemainingBytesAsString(); // Methods returning integer values. - template T ConsumeIntegral(); - template T ConsumeIntegralInRange(T min, T max); + template + T ConsumeIntegral(); + template + T ConsumeIntegralInRange(T min, T max); // Methods returning floating point values. - template T ConsumeFloatingPoint(); - template T ConsumeFloatingPointInRange(T min, T max); + template + T ConsumeFloatingPoint(); + template + T ConsumeFloatingPointInRange(T min, T max); // 0 <= return value <= 1. - template T ConsumeProbability(); + template + T ConsumeProbability(); bool ConsumeBool(); // Returns a value chosen from the given enum. - template T ConsumeEnum(); + template + T ConsumeEnum(); // Returns a value from the given array. - template T PickValueInArray(const T (&array)[size]); - template T PickValueInArray(std::initializer_list list); + template + T PickValueInArray(const T (&array)[size]); + template + T PickValueInArray(std::initializer_list list); // Writes data to the given destination and returns number of bytes written. size_t ConsumeData(void *destination, size_t num_bytes); @@ -90,7 +101,8 @@ class FuzzedDataProvider { template std::vector ConsumeBytes(size_t size, size_t num_bytes); - template TS ConvertUnsignedToSigned(TU value); + template + TS ConvertUnsignedToSigned(TU value); const uint8_t *data_ptr_; size_t remaining_bytes_; @@ -144,8 +156,8 @@ inline std::string FuzzedDataProvider::ConsumeBytesAsString(size_t num_bytes) { // input data, returns what remains of the input. Designed to be more stable // with respect to a fuzzer inserting characters than just picking a random // length and then consuming that many bytes with |ConsumeBytes|. -inline std::string -FuzzedDataProvider::ConsumeRandomLengthString(size_t max_length) { +inline std::string FuzzedDataProvider::ConsumeRandomLengthString( + size_t max_length) { // Reads bytes from the start of |data_ptr_|. Maps "\\" to "\", and maps "\" // followed by anything else to the end of the string. As a result of this // logic, a fuzzer can insert characters into the string, and the string @@ -162,8 +174,9 @@ FuzzedDataProvider::ConsumeRandomLengthString(size_t max_length) { if (next == '\\' && remaining_bytes_ != 0) { next = ConvertUnsignedToSigned(data_ptr_[0]); Advance(1); - if (next != '\\') + if (next != '\\') { break; + } } result += next; } @@ -187,7 +200,8 @@ inline std::string FuzzedDataProvider::ConsumeRemainingBytesAsString() { // Returns a number in the range [Type's min, Type's max]. The value might // not be uniformly distributed in the given range. If there's no input data // left, always returns |min|. -template T FuzzedDataProvider::ConsumeIntegral() { +template +T FuzzedDataProvider::ConsumeIntegral() { return ConsumeIntegralInRange(std::numeric_limits::min(), std::numeric_limits::max()); } @@ -201,8 +215,9 @@ T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) { static_assert(std::is_integral::value, "An integral type is required."); static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type."); - if (min > max) + if (min > max) { abort(); + } // Use the biggest type possible to hold the range and the result. uint64_t range = static_cast(max) - min; @@ -232,7 +247,8 @@ T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) { // Returns a floating point value in the range [Type's lowest, Type's max] by // consuming bytes from the input data. If there's no input data left, always // returns approximately 0. -template T FuzzedDataProvider::ConsumeFloatingPoint() { +template +T FuzzedDataProvider::ConsumeFloatingPoint() { return ConsumeFloatingPointInRange(std::numeric_limits::lowest(), std::numeric_limits::max()); } @@ -242,8 +258,9 @@ template T FuzzedDataProvider::ConsumeFloatingPoint() { // |min| must be less than or equal to |max|. template T FuzzedDataProvider::ConsumeFloatingPointInRange(T min, T max) { - if (min > max) + if (min > max) { abort(); + } T range = .0; T result = min; @@ -265,7 +282,8 @@ T FuzzedDataProvider::ConsumeFloatingPointInRange(T min, T max) { // Returns a floating point number in the range [0.0, 1.0]. If there's no // input data left, always returns 0. -template T FuzzedDataProvider::ConsumeProbability() { +template +T FuzzedDataProvider::ConsumeProbability() { static_assert(std::is_floating_point::value, "A floating point type is required."); @@ -288,7 +306,8 @@ inline bool FuzzedDataProvider::ConsumeBool() { // Returns an enum value. The enum must start at 0 and be contiguous. It must // also contain |kMaxValue| aliased to its largest (inclusive) value. Such as: // enum class Foo { SomeValue, OtherValue, kMaxValue = OtherValue }; -template T FuzzedDataProvider::ConsumeEnum() { +template +T FuzzedDataProvider::ConsumeEnum() { static_assert(std::is_enum::value, "|T| must be an enum type."); return static_cast( ConsumeIntegralInRange(0, static_cast(T::kMaxValue))); @@ -304,8 +323,9 @@ T FuzzedDataProvider::PickValueInArray(const T (&array)[size]) { template T FuzzedDataProvider::PickValueInArray(std::initializer_list list) { // TODO(Dor1s): switch to static_assert once C++14 is allowed. - if (!list.size()) + if (!list.size()) { abort(); + } return *(list.begin() + ConsumeIntegralInRange(0, list.size() - 1)); } @@ -331,8 +351,9 @@ inline void FuzzedDataProvider::CopyAndAdvance(void *destination, } inline void FuzzedDataProvider::Advance(size_t num_bytes) { - if (num_bytes > remaining_bytes_) + if (num_bytes > remaining_bytes_) { abort(); + } data_ptr_ += num_bytes; remaining_bytes_ -= num_bytes; @@ -350,8 +371,9 @@ std::vector FuzzedDataProvider::ConsumeBytes(size_t size, size_t num_bytes) { // To increase the odds even more, we also call |shrink_to_fit| below. std::vector result(size); if (size == 0) { - if (num_bytes != 0) + if (num_bytes != 0) { abort(); + } return result; } @@ -371,8 +393,9 @@ TS FuzzedDataProvider::ConvertUnsignedToSigned(TU value) { "Source type must be unsigned."); // TODO(Dor1s): change to `if constexpr` once C++17 becomes mainstream. - if (std::numeric_limits::is_modulo) + if (std::numeric_limits::is_modulo) { return static_cast(value); + } // Avoid using implementation-defined unsigned to signed conversions. // To learn more, see https://stackoverflow.com/questions/13150449. @@ -384,4 +407,4 @@ TS FuzzedDataProvider::ConvertUnsignedToSigned(TU value) { } } -#endif // LLVM_FUZZER_FUZZED_DATA_PROVIDER_H_ +#endif // LLVM_FUZZER_FUZZED_DATA_PROVIDER_H_ diff --git a/Code/Geometry/Grid3D.h b/Code/Geometry/Grid3D.h index 440658f60..dfc20911b 100644 --- a/Code/Geometry/Grid3D.h +++ b/Code/Geometry/Grid3D.h @@ -22,12 +22,12 @@ class Point3D; class RDKIT_RDGEOMETRYLIB_EXPORT GridException : public std::exception { public: //! construct with an error message - GridException(const char *msg) : _msg(msg){}; + GridException(const char *msg) : _msg(msg) {} //! construct with an error message - GridException(const std::string &msg) : _msg(msg){}; + GridException(const std::string &msg) : _msg(msg) {} //! get the error message - const char *what() const noexcept override { return _msg.c_str(); }; - ~GridException() noexcept {}; + const char *what() const noexcept override { return _msg.c_str(); } + ~GridException() noexcept {} private: std::string _msg; @@ -36,7 +36,7 @@ class RDKIT_RDGEOMETRYLIB_EXPORT GridException : public std::exception { //! Virtual base class for a grid object class RDKIT_RDGEOMETRYLIB_EXPORT Grid3D { public: - virtual ~Grid3D(){}; + virtual ~Grid3D() {} virtual int getGridPointIndex(const Point3D &point) const = 0; virtual int getVal(const Point3D &point) const = 0; virtual void setVal(const Point3D &point, unsigned int val) = 0; diff --git a/Code/Geometry/UniformGrid3D.h b/Code/Geometry/UniformGrid3D.h index c4cf21135..9c66f1d64 100644 --- a/Code/Geometry/UniformGrid3D.h +++ b/Code/Geometry/UniformGrid3D.h @@ -83,7 +83,7 @@ class RDKIT_RDGEOMETRYLIB_EXPORT UniformGrid3D : public Grid3D { void setVal(unsigned int pointId, unsigned int val); //! \brief get the size of the grid (number of grid points) - unsigned int getSize() const { return d_numX * d_numY * d_numZ; }; + unsigned int getSize() const { return d_numX * d_numY * d_numZ; } //! \brief set the occupancy for a multi-layered sphere /*! @@ -115,24 +115,24 @@ class RDKIT_RDGEOMETRYLIB_EXPORT UniformGrid3D : public Grid3D { unsigned int &zi) const; //! \brief get the number of grid points along x-axis - unsigned int getNumX() const { return d_numX; }; + unsigned int getNumX() const { return d_numX; } //! \brief get the number of grid points along y-axis - unsigned int getNumY() const { return d_numY; }; + unsigned int getNumY() const { return d_numY; } //! \brief get the number of grid points along z-axis - unsigned int getNumZ() const { return d_numZ; }; + unsigned int getNumZ() const { return d_numZ; } //! \brief get the grid's offset - const Point3D &getOffset() const { return d_offSet; }; + const Point3D &getOffset() const { return d_offSet; } //! \brief get the grid's spacing - double getSpacing() const { return d_spacing; }; + double getSpacing() const { return d_spacing; } //! \brief return a \b const pointer to our occupancy vector const RDKit::DiscreteValueVect *getOccupancyVect() const { return dp_storage; - }; + } //! \brief returns true if the grid \c other has parameters //! compatible with ours. @@ -168,7 +168,7 @@ class RDKIT_RDGEOMETRYLIB_EXPORT UniformGrid3D : public Grid3D { d_numZ * d_spacing, d_spacing, dp_storage->getValueType(), &d_offSet); return res; - }; + } private: //! \brief internal initialization code diff --git a/Code/Geometry/point.h b/Code/Geometry/point.h index 5fe07eb66..27b2dbcca 100644 --- a/Code/Geometry/point.h +++ b/Code/Geometry/point.h @@ -29,7 +29,7 @@ namespace RDGeom { class RDKIT_RDGEOMETRYLIB_EXPORT Point { // this is the virtual base class, mandating certain functions public: - virtual ~Point(){}; + virtual ~Point() {} virtual double operator[](unsigned int i) const = 0; virtual double &operator[](unsigned int i) = 0; @@ -57,10 +57,10 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Point3D : public Point { double y{0.0}; double z{0.0}; - Point3D(){}; - Point3D(double xv, double yv, double zv) : x(xv), y(yv), z(zv){}; + Point3D() {} + Point3D(double xv, double yv, double zv) : x(xv), y(yv), z(zv) {} - ~Point3D(){}; + ~Point3D() {} Point3D(const Point3D &other) : Point(other), x(other.x), y(other.y), z(other.z) {} @@ -99,35 +99,35 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Point3D : public Point { y = other.y; z = other.z; return *this; - }; + } Point3D &operator+=(const Point3D &other) { x += other.x; y += other.y; z += other.z; return *this; - }; + } Point3D &operator-=(const Point3D &other) { x -= other.x; y -= other.y; z -= other.z; return *this; - }; + } Point3D &operator*=(double scale) { x *= scale; y *= scale; z *= scale; return *this; - }; + } Point3D &operator/=(double scale) { x /= scale; y /= scale; z /= scale; return *this; - }; + } Point3D operator-() const { Point3D res(x, y, z); @@ -142,23 +142,23 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Point3D : public Point { x /= l; y /= l; z /= l; - }; + } double length() const { double res = x * x + y * y + z * z; return sqrt(res); - }; + } double lengthSq() const { // double res = pow(x,2) + pow(y,2) + pow(z,2); double res = x * x + y * y + z * z; return res; - }; + } double dotProduct(const Point3D &other) const { double res = x * (other.x) + y * (other.y) + z * (other.z); return res; - }; + } /*! \brief determines the angle between a vector to this point * from the origin and a vector to the other point. @@ -217,7 +217,7 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Point3D : public Point { res.y = -x * (other.z) + z * (other.x); res.z = x * (other.y) - y * (other.x); return res; - }; + } /*! \brief Get a unit perpendicular from this point (treating it as a vector): * @@ -273,13 +273,13 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Point2D : public Point { double x{0.0}; double y{0.0}; - Point2D(){}; - Point2D(double xv, double yv) : x(xv), y(yv){}; - ~Point2D(){}; + Point2D() {} + Point2D(double xv, double yv) : x(xv), y(yv) {} + ~Point2D() {} Point2D(const Point2D &other) : Point(other), x(other.x), y(other.y) {} //! construct from a Point3D (ignoring the z coordinate) - Point2D(const Point3D &p3d) : Point(p3d), x(p3d.x), y(p3d.y){}; + Point2D(const Point3D &p3d) : Point(p3d), x(p3d.x), y(p3d.y) {} virtual Point *copy() const { return new Point2D(*this); } @@ -307,31 +307,31 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Point2D : public Point { x = other.x; y = other.y; return *this; - }; + } Point2D &operator+=(const Point2D &other) { x += other.x; y += other.y; return *this; - }; + } Point2D &operator-=(const Point2D &other) { x -= other.x; y -= other.y; return *this; - }; + } Point2D &operator*=(double scale) { x *= scale; y *= scale; return *this; - }; + } Point2D &operator/=(double scale) { x /= scale; y /= scale; return *this; - }; + } Point2D operator-() const { Point2D res(x, y); @@ -344,7 +344,7 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Point2D : public Point { double ln = this->length(); x /= ln; y /= ln; - }; + } void rotate90() { double temp = x; @@ -356,17 +356,17 @@ class RDKIT_RDGEOMETRYLIB_EXPORT Point2D : public Point { // double res = pow(x,2) + pow(y,2); double res = x * x + y * y; return sqrt(res); - }; + } double lengthSq() const { double res = x * x + y * y; return res; - }; + } double dotProduct(const Point2D &other) const { double res = x * (other.x) + y * (other.y); return res; - }; + } double angleTo(const Point2D &other) const { Point2D t1, t2; @@ -405,7 +405,7 @@ class RDKIT_RDGEOMETRYLIB_EXPORT PointND : public Point { PointND(unsigned int dim) { RDNumeric::Vector *nvec = new RDNumeric::Vector(dim, 0.0); dp_storage.reset(nvec); - }; + } PointND(const PointND &other) : Point(other) { RDNumeric::Vector *nvec = diff --git a/Code/GraphMol/Abbreviations/Abbreviations.h b/Code/GraphMol/Abbreviations/Abbreviations.h index 3accb5862..50afea6ff 100644 --- a/Code/GraphMol/Abbreviations/Abbreviations.h +++ b/Code/GraphMol/Abbreviations/Abbreviations.h @@ -39,8 +39,8 @@ struct RDKIT_ABBREVIATIONS_EXPORT AbbreviationMatch { AbbreviationDefinition abbrev; AbbreviationMatch(const std::vector>& matchArg, const AbbreviationDefinition& abbrevArg) - : match(matchArg), abbrev(abbrevArg){}; - AbbreviationMatch() : match(), abbrev(){}; + : match(matchArg), abbrev(abbrevArg) {} + AbbreviationMatch() : match(), abbrev() {} bool operator==(const AbbreviationMatch& other) const { return abbrev == other.abbrev && match == other.match; } diff --git a/Code/GraphMol/Atom.h b/Code/GraphMol/Atom.h index b312c2e2f..9807ac466 100644 --- a/Code/GraphMol/Atom.h +++ b/Code/GraphMol/Atom.h @@ -112,31 +112,31 @@ class RDKIT_GRAPHMOL_EXPORT Atom : public RDProps { virtual Atom *copy() const; //! returns our atomic number - int getAtomicNum() const { return d_atomicNum; }; + int getAtomicNum() const { return d_atomicNum; } //! sets our atomic number - void setAtomicNum(int newNum) { d_atomicNum = newNum; }; + void setAtomicNum(int newNum) { d_atomicNum = newNum; } //! returns our symbol (determined by our atomic number) std::string getSymbol() const; //! returns whether or not this instance belongs to a molecule - bool hasOwningMol() const { return dp_mol != nullptr; }; + bool hasOwningMol() const { return dp_mol != nullptr; } //! returns a reference to the ROMol that owns this instance ROMol &getOwningMol() const { PRECONDITION(dp_mol, "no owner"); return *dp_mol; - }; + } //! returns our index within the ROMol - unsigned int getIdx() const { return d_index; }; + unsigned int getIdx() const { return d_index; } //! sets our index within the ROMol /*! Notes: - this makes no sense if we do not have an owning molecule - the index should be < this->getOwningMol()->getNumAtoms() */ - void setIdx(unsigned int index) { d_index = index; }; + void setIdx(unsigned int index) { d_index = index; } //! overload template void setIdx(const U index) { @@ -196,31 +196,29 @@ class RDKIT_GRAPHMOL_EXPORT Atom : public RDProps { Notes: - requires an owning molecule */ - unsigned int getNumRadicalElectrons() const { return d_numRadicalElectrons; }; - void setNumRadicalElectrons(unsigned int num) { - d_numRadicalElectrons = num; - }; + unsigned int getNumRadicalElectrons() const { return d_numRadicalElectrons; } + void setNumRadicalElectrons(unsigned int num) { d_numRadicalElectrons = num; } //! returns the formal charge of this atom - int getFormalCharge() const { return d_formalCharge; }; + int getFormalCharge() const { return d_formalCharge; } //! set's the formal charge of this atom - void setFormalCharge(int what) { d_formalCharge = what; }; + void setFormalCharge(int what) { d_formalCharge = what; } //! \brief sets our \c noImplicit flag, indicating whether or not //! we are allowed to have implicit Hs - void setNoImplicit(bool what) { df_noImplicit = what; }; + void setNoImplicit(bool what) { df_noImplicit = what; } //! returns the \c noImplicit flag - bool getNoImplicit() const { return df_noImplicit; }; + bool getNoImplicit() const { return df_noImplicit; } //! sets our number of explicit Hs - void setNumExplicitHs(unsigned int what) { d_numExplicitHs = what; }; + void setNumExplicitHs(unsigned int what) { d_numExplicitHs = what; } //! returns our number of explicit Hs - unsigned int getNumExplicitHs() const { return d_numExplicitHs; }; + unsigned int getNumExplicitHs() const { return d_numExplicitHs; } //! sets our \c isAromatic flag, indicating whether or not we are aromatic - void setIsAromatic(bool what) { df_isAromatic = what; }; + void setIsAromatic(bool what) { df_isAromatic = what; } //! returns our \c isAromatic flag - bool getIsAromatic() const { return df_isAromatic; }; + bool getIsAromatic() const { return df_isAromatic; } //! returns our mass double getMass() const; @@ -228,23 +226,23 @@ class RDKIT_GRAPHMOL_EXPORT Atom : public RDProps { //! sets our isotope number void setIsotope(unsigned int what); //! returns our isotope number - unsigned int getIsotope() const { return d_isotope; }; + unsigned int getIsotope() const { return d_isotope; } //! sets our \c chiralTag - void setChiralTag(ChiralType what) { d_chiralTag = what; }; + void setChiralTag(ChiralType what) { d_chiralTag = what; } //! inverts our \c chiralTag void invertChirality(); //! returns our \c chiralTag ChiralType getChiralTag() const { return static_cast(d_chiralTag); - }; + } //! sets our hybridization - void setHybridization(HybridizationType what) { d_hybrid = what; }; + void setHybridization(HybridizationType what) { d_hybrid = what; } //! returns our hybridization HybridizationType getHybridization() const { return static_cast(d_hybrid); - }; + } // ------------------------------------ // Some words of explanation before getting down into @@ -259,7 +257,7 @@ class RDKIT_GRAPHMOL_EXPORT Atom : public RDProps { // ------------------------------------ // This method can be used to distinguish query atoms from standard atoms: - virtual bool hasQuery() const { return false; }; + virtual bool hasQuery() const { return false; } //! NOT CALLABLE virtual void setQuery(QUERYATOM_QUERY *what); @@ -356,10 +354,10 @@ class RDKIT_GRAPHMOL_EXPORT Atom : public RDProps { */ int calcImplicitValence(bool strict = true); - AtomMonomerInfo *getMonomerInfo() { return dp_monomerInfo; }; - const AtomMonomerInfo *getMonomerInfo() const { return dp_monomerInfo; }; + AtomMonomerInfo *getMonomerInfo() { return dp_monomerInfo; } + const AtomMonomerInfo *getMonomerInfo() const { return dp_monomerInfo; } //! takes ownership of the pointer - void setMonomerInfo(AtomMonomerInfo *info) { dp_monomerInfo = info; }; + void setMonomerInfo(AtomMonomerInfo *info) { dp_monomerInfo = info; } //! Set the atom map Number of the atom void setAtomMapNum(int mapno, bool strict = true) { @@ -384,7 +382,7 @@ class RDKIT_GRAPHMOL_EXPORT Atom : public RDProps { //! sets our owning molecule void setOwningMol(ROMol *other); //! sets our owning molecule - void setOwningMol(ROMol &other) { setOwningMol(&other); }; + void setOwningMol(ROMol &other) { setOwningMol(&other); } bool df_isAromatic; bool df_noImplicit; diff --git a/Code/GraphMol/AtomIterators.h b/Code/GraphMol/AtomIterators.h index e595d7e71..f948c8b5d 100644 --- a/Code/GraphMol/AtomIterators.h +++ b/Code/GraphMol/AtomIterators.h @@ -31,7 +31,7 @@ template class RDKIT_GRAPHMOL_EXPORT AtomIterator_ { public: typedef AtomIterator_ ThisType; - AtomIterator_() : _mol(nullptr){}; + AtomIterator_() : _mol(nullptr) {} AtomIterator_(Mol_ *mol); AtomIterator_(Mol_ *mol, int pos); AtomIterator_(const ThisType &other); @@ -74,7 +74,7 @@ template class RDKIT_GRAPHMOL_EXPORT HeteroatomIterator_ { public: typedef HeteroatomIterator_ ThisType; - HeteroatomIterator_() : _mol(nullptr){}; + HeteroatomIterator_() : _mol(nullptr) {} HeteroatomIterator_(Mol_ *mol); HeteroatomIterator_(Mol_ *mol, int pos); ~HeteroatomIterator_(); @@ -111,7 +111,7 @@ template class RDKIT_GRAPHMOL_EXPORT AromaticAtomIterator_ { public: typedef AromaticAtomIterator_ ThisType; - AromaticAtomIterator_() : _mol(nullptr){}; + AromaticAtomIterator_() : _mol(nullptr) {} AromaticAtomIterator_(Mol_ *mol); AromaticAtomIterator_(Mol_ *mol, int pos); ~AromaticAtomIterator_(); @@ -144,7 +144,7 @@ template class RDKIT_GRAPHMOL_EXPORT QueryAtomIterator_ { public: typedef QueryAtomIterator_ ThisType; - QueryAtomIterator_() : _mol(nullptr){}; + QueryAtomIterator_() : _mol(nullptr) {} QueryAtomIterator_(Mol_ *mol, QueryAtom const *what); QueryAtomIterator_(Mol_ *mol, int pos); ~QueryAtomIterator_(); @@ -178,7 +178,7 @@ template class RDKIT_GRAPHMOL_EXPORT MatchingAtomIterator_ { public: typedef MatchingAtomIterator_ ThisType; - MatchingAtomIterator_() : _mol(nullptr), _qF(nullptr){}; + MatchingAtomIterator_() : _mol(nullptr), _qF(nullptr) {} MatchingAtomIterator_(Mol_ *mol, bool (*fn)(Atom_ *)); MatchingAtomIterator_(Mol_ *mol, int pos); ~MatchingAtomIterator_(); diff --git a/Code/GraphMol/Bond.h b/Code/GraphMol/Bond.h index a4d75c01c..297dd38ea 100644 --- a/Code/GraphMol/Bond.h +++ b/Code/GraphMol/Bond.h @@ -117,9 +117,9 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps { virtual Bond *copy() const; //! returns our \c bondType - BondType getBondType() const { return static_cast(d_bondType); }; + BondType getBondType() const { return static_cast(d_bondType); } //! sets our \c bondType - void setBondType(BondType bT) { d_bondType = bT; }; + void setBondType(BondType bT) { d_bondType = bT; } //! \brief returns our \c bondType as a double //! (e.g. SINGLE->1.0, AROMATIC->1.5, etc.) double getBondTypeAsDouble() const; @@ -132,27 +132,27 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps { double getValenceContrib(const Atom *at) const; //! sets our \c isAromatic flag - void setIsAromatic(bool what) { df_isAromatic = what; }; + void setIsAromatic(bool what) { df_isAromatic = what; } //! returns the status of our \c isAromatic flag - bool getIsAromatic() const { return df_isAromatic; }; + bool getIsAromatic() const { return df_isAromatic; } //! sets our \c isConjugated flag - void setIsConjugated(bool what) { df_isConjugated = what; }; + void setIsConjugated(bool what) { df_isConjugated = what; } //! returns the status of our \c isConjugated flag - bool getIsConjugated() const { return df_isConjugated; }; + bool getIsConjugated() const { return df_isConjugated; } //! returns whether or not this instance belongs to a molecule - bool hasOwningMol() const { return dp_mol != nullptr; }; + bool hasOwningMol() const { return dp_mol != nullptr; } //! returns a reference to the ROMol that owns this instance ROMol &getOwningMol() const { PRECONDITION(dp_mol, "no owner"); return *dp_mol; - }; + } //! sets our owning molecule void setOwningMol(ROMol *other); //! sets our owning molecule - void setOwningMol(ROMol &other) { setOwningMol(&other); }; + void setOwningMol(ROMol &other) { setOwningMol(&other); } //! returns our index within the ROMol /*! @@ -160,28 +160,28 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps { - this makes no sense if we do not have an owning molecule */ - unsigned int getIdx() const { return d_index; }; + unsigned int getIdx() const { return d_index; } //! sets our index within the ROMol /*! Notes: - this makes no sense if we do not have an owning molecule - the index should be < this->getOwningMol()->getNumBonds() */ - void setIdx(unsigned int index) { d_index = index; }; + void setIdx(unsigned int index) { d_index = index; } //! returns the index of our begin Atom /*! Notes: - this makes no sense if we do not have an owning molecule */ - unsigned int getBeginAtomIdx() const { return d_beginAtomIdx; }; + unsigned int getBeginAtomIdx() const { return d_beginAtomIdx; } //! returns the index of our end Atom /*! Notes: - this makes no sense if we do not have an owning molecule */ - unsigned int getEndAtomIdx() const { return d_endAtomIdx; }; + unsigned int getEndAtomIdx() const { return d_endAtomIdx; } //! given the index of one Atom, returns the index of the other /*! @@ -241,7 +241,7 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps { // ------------------------------------ // This method can be used to distinguish query bonds from standard bonds - virtual bool hasQuery() const { return false; }; + virtual bool hasQuery() const { return false; } // FIX: the const crap here is all mucked up. //! NOT CALLABLE @@ -265,9 +265,9 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps { virtual bool Match(Bond const *what) const; //! sets our direction - void setBondDir(BondDir what) { d_dirTag = what; }; + void setBondDir(BondDir what) { d_dirTag = what; } //! returns our direction - BondDir getBondDir() const { return static_cast(d_dirTag); }; + BondDir getBondDir() const { return static_cast(d_dirTag); } //! sets our stereo code /*! @@ -286,9 +286,9 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps { "Stereo atoms should be specified before specifying CIS/TRANS " "bond stereochemistry") d_stereo = what; - }; + } //! returns our stereo code - BondStereo getStereo() const { return static_cast(d_stereo); }; + BondStereo getStereo() const { return static_cast(d_stereo); } //! sets the atoms to be considered as reference points for bond stereo /*! @@ -310,12 +310,12 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps { const_cast(this)->dp_stereoAtoms = new INT_VECT(); } return *dp_stereoAtoms; - }; + } //! \overload INT_VECT &getStereoAtoms() { if (!dp_stereoAtoms) dp_stereoAtoms = new INT_VECT(); return *dp_stereoAtoms; - }; + } //! calculates any of our lazy \c properties /*! @@ -328,7 +328,7 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps { //! sets our owning molecule // void setOwningMol(ROMol *other); //! sets our owning molecule - // void setOwningMol(ROMol &other) {setOwningMol(&other);}; + // void setOwningMol(ROMol &other) { setOwningMol(&other); } bool df_isAromatic; bool df_isConjugated; std::uint8_t d_bondType; diff --git a/Code/GraphMol/BondIterators.h b/Code/GraphMol/BondIterators.h index 580c46177..f61619ea7 100644 --- a/Code/GraphMol/BondIterators.h +++ b/Code/GraphMol/BondIterators.h @@ -28,7 +28,7 @@ class RDKIT_GRAPHMOL_EXPORT BondIterator_ { // FIX: I'm not pleased with the lack of internal testing code // (PREs and the like) in here public: - BondIterator_() {}; + BondIterator_() {} BondIterator_(ROMol *mol); BondIterator_(ROMol *mol, ROMol::EDGE_ITER pos); BondIterator_(const BondIterator_ &other); @@ -51,7 +51,7 @@ class RDKIT_GRAPHMOL_EXPORT BondIterator_ { //! but it theoretically ought to be RandomAccess. class RDKIT_GRAPHMOL_EXPORT ConstBondIterator_ { public: - ConstBondIterator_() {}; + ConstBondIterator_() {} ConstBondIterator_(ROMol const *mol); ConstBondIterator_(ROMol const *mol, ROMol::EDGE_ITER pos); ConstBondIterator_(const ConstBondIterator_ &other); diff --git a/Code/GraphMol/CIPLabeler/CIPLabeler.h b/Code/GraphMol/CIPLabeler/CIPLabeler.h index 28478786d..a13a84cec 100644 --- a/Code/GraphMol/CIPLabeler/CIPLabeler.h +++ b/Code/GraphMol/CIPLabeler/CIPLabeler.h @@ -52,8 +52,8 @@ RDKIT_CIPLABELER_EXPORT void assignCIPLabels(ROMol &mol); * \param bonds - bitset with the bond indexes to be labeled. * */ -RDKIT_CIPLABELER_EXPORT void -assignCIPLabels(ROMol &mol, const boost::dynamic_bitset<> &atoms, - const boost::dynamic_bitset<> &bonds); -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +RDKIT_CIPLABELER_EXPORT void assignCIPLabels( + ROMol &mol, const boost::dynamic_bitset<> &atoms, + const boost::dynamic_bitset<> &bonds); +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/CIPMol.h b/Code/GraphMol/CIPLabeler/CIPMol.h index c906bf74a..16d13d317 100644 --- a/Code/GraphMol/CIPLabeler/CIPMol.h +++ b/Code/GraphMol/CIPLabeler/CIPMol.h @@ -21,10 +21,11 @@ namespace RDKit { namespace CIPLabeler { -template class CIPMolSpan { -public: +template +class CIPMolSpan { + public: class CIPMolIter { - public: + public: CIPMolIter() = delete; CIPMolIter(ROMol &mol, U pos) : d_mol{mol}, d_pos{std::move(pos)} {} @@ -40,29 +41,30 @@ public: bool operator!=(const CIPMolIter &it) const { return d_pos != it.d_pos; } - private: + private: ROMol &d_mol; U d_pos; T d_current = nullptr; }; -public: + public: CIPMolSpan() = delete; CIPMolSpan(ROMol &mol, std::pair &&itr) - : d_mol{mol}, d_istart{std::move(itr.first)}, + : d_mol{mol}, + d_istart{std::move(itr.first)}, d_iend{std::move(itr.second)} {} CIPMolIter begin() { return {d_mol, d_istart}; } CIPMolIter end() { return {d_mol, d_iend}; } -private: + private: ROMol &d_mol; const U d_istart; const U d_iend; }; class CIPMol { -public: + public: CIPMol() = delete; explicit CIPMol(ROMol &mol); @@ -91,12 +93,12 @@ public: // Dative bonds get bond order 0. int getBondOrder(Bond *bond) const; -private: + private: ROMol &d_mol; std::unique_ptr dp_kekulized_mol = nullptr; std::vector> d_atomnums; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/Descriptor.h b/Code/GraphMol/CIPLabeler/Descriptor.h index cf588edd8..75645eab2 100644 --- a/Code/GraphMol/CIPLabeler/Descriptor.h +++ b/Code/GraphMol/CIPLabeler/Descriptor.h @@ -23,12 +23,12 @@ namespace CIPLabeler { * */ enum class Descriptor { - NONE, // Unspecified + NONE, // Unspecified UNKNOWN, - ns, // Other - /** - * Tetrahedral - */ + ns, // Other + /** + * Tetrahedral + */ R, S, r, @@ -53,45 +53,45 @@ enum class Descriptor { static std::string to_string(const Descriptor &desc) { switch (desc) { - case Descriptor::NONE: - return "NONE"; - case Descriptor::UNKNOWN: - return "UNKNOWN"; - case Descriptor::ns: - return "ns"; - case Descriptor::R: - return "R"; - case Descriptor::S: - return "S"; - case Descriptor::r: - return "r"; - case Descriptor::s: - return "s"; - case Descriptor::seqTrans: - return "e"; - case Descriptor::seqCis: - return "z"; - case Descriptor::E: - return "E"; - case Descriptor::Z: - return "Z"; - case Descriptor::M: - return "M"; - case Descriptor::P: - return "P"; - case Descriptor::m: - return "m"; - case Descriptor::p: - return "p"; - case Descriptor::SP_4: - return "SP_4"; - case Descriptor::TBPY_5: - return "TBPY_5"; - case Descriptor::OC_6: - return "OC_6"; + case Descriptor::NONE: + return "NONE"; + case Descriptor::UNKNOWN: + return "UNKNOWN"; + case Descriptor::ns: + return "ns"; + case Descriptor::R: + return "R"; + case Descriptor::S: + return "S"; + case Descriptor::r: + return "r"; + case Descriptor::s: + return "s"; + case Descriptor::seqTrans: + return "e"; + case Descriptor::seqCis: + return "z"; + case Descriptor::E: + return "E"; + case Descriptor::Z: + return "Z"; + case Descriptor::M: + return "M"; + case Descriptor::P: + return "P"; + case Descriptor::m: + return "m"; + case Descriptor::p: + return "p"; + case Descriptor::SP_4: + return "SP_4"; + case Descriptor::TBPY_5: + return "TBPY_5"; + case Descriptor::OC_6: + return "OC_6"; } throw std::runtime_error("Unknown descriptor"); } -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/Digraph.h b/Code/GraphMol/CIPLabeler/Digraph.h index 2402cb852..c992d4101 100644 --- a/Code/GraphMol/CIPLabeler/Digraph.h +++ b/Code/GraphMol/CIPLabeler/Digraph.h @@ -44,8 +44,7 @@ class CIPMol; * */ class Digraph { - -public: + public: Digraph() = delete; Digraph(const Digraph &) = delete; Digraph &operator=(const Digraph &) = delete; @@ -93,7 +92,7 @@ public: Node &addNode(std::vector &&visit, Atom *atom, boost::rational &&frac, int dist, int flags); -private: + private: const CIPMol &d_mol; // The node from which the Digraph is first initialized. @@ -113,5 +112,5 @@ private: void addEdge(Node *beg, Bond *bond, Node *end); }; -} // namespace CIPLabeler -} // namespace RDKit +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/Edge.h b/Code/GraphMol/CIPLabeler/Edge.h index 64d9092c3..025b770a4 100644 --- a/Code/GraphMol/CIPLabeler/Edge.h +++ b/Code/GraphMol/CIPLabeler/Edge.h @@ -21,8 +21,7 @@ namespace CIPLabeler { class Node; class Edge { - -public: + public: Edge() = delete; Edge(const Edge &) = delete; Edge &operator=(const Edge &) = delete; @@ -47,12 +46,12 @@ public: void flip(); -private: + private: Node *dp_beg; Node *dp_end; Bond *dp_bond; Descriptor d_aux = Descriptor::NONE; }; -} // namespace CIPLabeler -} // namespace RDKit +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/Mancude.h b/Code/GraphMol/CIPLabeler/Mancude.h index 0c0a1a7d2..33ecb0194 100644 --- a/Code/GraphMol/CIPLabeler/Mancude.h +++ b/Code/GraphMol/CIPLabeler/Mancude.h @@ -30,12 +30,12 @@ namespace CIPLabeler { class CIPMol; enum class Type { - Cv4D3, // =C(X)- - Nv3D2, // =N- - Nv4D3Plus, // =[N+]< - Nv2D2Minus, // -[N-]- - Cv3D3Minus, // -[C(X)-]- - Ov3D2Plus, // -[O+]= + Cv4D3, // =C(X)- + Nv3D2, // =N- + Nv4D3Plus, // =[N+]< + Nv2D2Minus, // -[N-]- + Cv3D3Minus, // -[C(X)-]- + Ov3D2Plus, // -[O+]= Other }; @@ -48,5 +48,5 @@ enum class Type { */ std::vector> calcFracAtomNums(const CIPMol &mol); -} // namespace CIPLabeler -} // namespace RDKit +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/Node.h b/Code/GraphMol/CIPLabeler/Node.h index 6604d1943..b86fb1b86 100644 --- a/Code/GraphMol/CIPLabeler/Node.h +++ b/Code/GraphMol/CIPLabeler/Node.h @@ -25,7 +25,7 @@ namespace CIPLabeler { class Digraph; class Node { -public: + public: /** * Flag indicates whether the node has been expanded. */ @@ -105,7 +105,7 @@ public: std::vector getNonTerminalOutEdges() const; -private: + private: Digraph *dp_g; Atom *dp_atom; int d_dist; @@ -121,5 +121,5 @@ private: Node *newTerminalChild(int idx, Atom *atom, int flags) const; }; -} // namespace CIPLabeler -} // namespace RDKit +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/Priority.h b/Code/GraphMol/CIPLabeler/Priority.h index 7e42139a2..304197714 100644 --- a/Code/GraphMol/CIPLabeler/Priority.h +++ b/Code/GraphMol/CIPLabeler/Priority.h @@ -19,8 +19,7 @@ namespace CIPLabeler { * */ class Priority { - -public: + public: Priority() = delete; Priority(bool unique, bool pseudoAsym) @@ -42,10 +41,10 @@ public: */ bool isPseudoAsymetric() const { return d_pseudoAsym; } -private: + private: bool d_unique; bool d_pseudoAsym; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/Sort.h b/Code/GraphMol/CIPLabeler/Sort.h index e71bdfb32..c23cb361f 100644 --- a/Code/GraphMol/CIPLabeler/Sort.h +++ b/Code/GraphMol/CIPLabeler/Sort.h @@ -26,8 +26,7 @@ class Node; * */ class Sort { - -public: + public: Sort(const SequenceRule *comparator); Sort(std::vector comparators); @@ -37,15 +36,15 @@ public: Priority prioritize(const Node *node, std::vector &edges, bool deep = true) const; - std::vector> - getGroups(const std::vector &sorted) const; + std::vector> getGroups( + const std::vector &sorted) const; -private: + private: const std::vector d_rules; int compareSubstituents(const Node *node, const Edge *a, const Edge *b, bool deep) const; -}; // namespace CIPLabeler +}; // namespace CIPLabeler -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/TooManyNodesException.h b/Code/GraphMol/CIPLabeler/TooManyNodesException.h index d7b989d6a..76e714aef 100644 --- a/Code/GraphMol/CIPLabeler/TooManyNodesException.h +++ b/Code/GraphMol/CIPLabeler/TooManyNodesException.h @@ -21,8 +21,8 @@ namespace CIPLabeler { class RDKIT_CIPLABELER_EXPORT TooManyNodesException : public std::runtime_error { public: - TooManyNodesException(const std::string &msg) : std::runtime_error(msg){}; + TooManyNodesException(const std::string &msg) : std::runtime_error(msg) {} }; } // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/configs/Configuration.h b/Code/GraphMol/CIPLabeler/configs/Configuration.h index d6284e667..7ed7c69d8 100644 --- a/Code/GraphMol/CIPLabeler/configs/Configuration.h +++ b/Code/GraphMol/CIPLabeler/configs/Configuration.h @@ -27,8 +27,7 @@ namespace CIPLabeler { class Rules; class Configuration { - -public: + public: template static int parity4(const std::vector &trg, const std::vector &ref) { if (ref.size() != 4 || trg.size() != ref.size()) { @@ -38,94 +37,118 @@ public: if (ref[0] == trg[0]) { if (ref[1] == trg[1]) { // a,b,c,d -> a,b,c,d - if (ref[2] == trg[2] && ref[3] == trg[3]) + if (ref[2] == trg[2] && ref[3] == trg[3]) { return 2; + } // a,b,c,d -> a,b,d,c - if (ref[2] == trg[3] && ref[3] == trg[2]) + if (ref[2] == trg[3] && ref[3] == trg[2]) { return 1; + } } else if (ref[1] == trg[2]) { // a,b,c,d -> a,c,b,d - if (ref[2] == trg[1] && ref[3] == trg[3]) + if (ref[2] == trg[1] && ref[3] == trg[3]) { return 1; + } // a,b,c,d -> a,c,d,b - if (ref[2] == trg[3] && ref[3] == trg[1]) + if (ref[2] == trg[3] && ref[3] == trg[1]) { return 2; + } } else if (ref[1] == trg[3]) { // a,b,c,d -> a,d,c,b - if (ref[2] == trg[2] && ref[3] == trg[1]) + if (ref[2] == trg[2] && ref[3] == trg[1]) { return 1; + } // a,b,c,d -> a,d,b,c - if (ref[2] == trg[1] && ref[3] == trg[2]) + if (ref[2] == trg[1] && ref[3] == trg[2]) { return 2; + } } } else if (ref[0] == trg[1]) { if (ref[1] == trg[0]) { // a,b,c,d -> b,a,c,d - if (ref[2] == trg[2] && ref[3] == trg[3]) + if (ref[2] == trg[2] && ref[3] == trg[3]) { return 1; + } // a,b,c,d -> b,a,d,c - if (ref[2] == trg[3] && ref[3] == trg[2]) + if (ref[2] == trg[3] && ref[3] == trg[2]) { return 2; + } } else if (ref[1] == trg[2]) { // a,b,c,d -> b,c,a,d - if (ref[2] == trg[0] && ref[3] == trg[3]) + if (ref[2] == trg[0] && ref[3] == trg[3]) { return 2; + } // a,b,c,d -> b,c,d,a - if (ref[2] == trg[3] && ref[3] == trg[0]) + if (ref[2] == trg[3] && ref[3] == trg[0]) { return 1; + } } else if (ref[1] == trg[3]) { // a,b,c,d -> b,d,c,a - if (ref[2] == trg[2] && ref[3] == trg[0]) + if (ref[2] == trg[2] && ref[3] == trg[0]) { return 2; + } // a,b,c,d -> b,d,a,c - if (ref[2] == trg[0] && ref[3] == trg[2]) + if (ref[2] == trg[0] && ref[3] == trg[2]) { return 1; + } } } else if (ref[0] == trg[2]) { if (ref[1] == trg[1]) { // a,b,c,d -> c,b,a,d - if (ref[2] == trg[0] && ref[3] == trg[3]) + if (ref[2] == trg[0] && ref[3] == trg[3]) { return 1; + } // a,b,c,d -> c,b,d,a - if (ref[2] == trg[3] && ref[3] == trg[0]) + if (ref[2] == trg[3] && ref[3] == trg[0]) { return 2; + } } else if (ref[1] == trg[0]) { // a,b,c,d -> c,a,b,d - if (ref[2] == trg[1] && ref[3] == trg[3]) + if (ref[2] == trg[1] && ref[3] == trg[3]) { return 2; + } // a,b,c,d -> c,a,d,b - if (ref[2] == trg[3] && ref[3] == trg[1]) + if (ref[2] == trg[3] && ref[3] == trg[1]) { return 1; + } } else if (ref[1] == trg[3]) { // a,b,c,d -> c,d,a,b - if (ref[2] == trg[0] && ref[3] == trg[1]) + if (ref[2] == trg[0] && ref[3] == trg[1]) { return 2; + } // a,b,c,d -> c,d,b,a - if (ref[2] == trg[1] && ref[3] == trg[0]) + if (ref[2] == trg[1] && ref[3] == trg[0]) { return 1; + } } } else if (ref[0] == trg[3]) { if (ref[1] == trg[1]) { // a,b,c,d -> d,b,c,a - if (ref[2] == trg[2] && ref[3] == trg[0]) + if (ref[2] == trg[2] && ref[3] == trg[0]) { return 1; + } // a,b,c,d -> d,b,a,c - if (ref[2] == trg[0] && ref[3] == trg[2]) + if (ref[2] == trg[0] && ref[3] == trg[2]) { return 2; + } } else if (ref[1] == trg[2]) { // a,b,c,d -> d,c,b,a - if (ref[2] == trg[1] && ref[3] == trg[0]) + if (ref[2] == trg[1] && ref[3] == trg[0]) { return 2; + } // a,b,c,d -> d,c,a,b - if (ref[2] == trg[0] && ref[3] == trg[1]) + if (ref[2] == trg[0] && ref[3] == trg[1]) { return 1; + } } else if (ref[1] == trg[0]) { // a,b,c,d -> d,a,c,b - if (ref[2] == trg[2] && ref[3] == trg[1]) + if (ref[2] == trg[2] && ref[3] == trg[1]) { return 2; + } // a,b,c,d -> d,a,b,c - if (ref[2] == trg[1] && ref[3] == trg[2]) + if (ref[2] == trg[1] && ref[3] == trg[2]) { return 1; + } } } @@ -156,7 +179,7 @@ public: virtual void setPrimaryLabel(Descriptor desc) = 0; -protected: + protected: Edge *findInternalEdge(const std::vector &edges, Atom *f1, Atom *f2); bool isInternalEdge(const Edge *edge, Atom *f1, Atom *f2); @@ -165,7 +188,7 @@ protected: void setCarriers(std::vector &&carriers); -private: + private: /** * Foci are the atoms on which the configuration is based, * and which will carry the label. E.g., the chiral atom in @@ -183,7 +206,7 @@ private: Digraph d_digraph; -}; // namespace CIPLabeler +}; // namespace CIPLabeler -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/configs/Sp2Bond.h b/Code/GraphMol/CIPLabeler/configs/Sp2Bond.h index 12918e1f4..3ac942258 100644 --- a/Code/GraphMol/CIPLabeler/configs/Sp2Bond.h +++ b/Code/GraphMol/CIPLabeler/configs/Sp2Bond.h @@ -16,7 +16,7 @@ namespace RDKit { namespace CIPLabeler { class Sp2Bond : public Configuration { -public: + public: Sp2Bond() = delete; Sp2Bond(const CIPMol &mol, Bond *bond, Atom *startAtom, Atom *endAtom, @@ -28,14 +28,14 @@ public: Descriptor label(Node *root1, Digraph &digraph, const Rules &comp) override; -private: + private: Bond *dp_bond; // bond->getStereo() can return both E/Z or CIS/TRANS, // so we cache CIS/TRANS we found. Bond::BondStereo d_cfg; -}; // namespace CIPLabeler +}; // namespace CIPLabeler -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/configs/Tetrahedral.h b/Code/GraphMol/CIPLabeler/configs/Tetrahedral.h index 43169dbf2..a2e57d7bb 100644 --- a/Code/GraphMol/CIPLabeler/configs/Tetrahedral.h +++ b/Code/GraphMol/CIPLabeler/configs/Tetrahedral.h @@ -16,7 +16,7 @@ namespace RDKit { namespace CIPLabeler { class Tetrahedral : public Configuration { -public: + public: Tetrahedral() = delete; Tetrahedral(const CIPMol &mol, Atom *focus); @@ -27,9 +27,9 @@ public: Descriptor label(Node *node, Digraph &digraph, const Rules &comp) override; -private: + private: Descriptor label(Node *node, const Rules &comp) const; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Pairlist.h b/Code/GraphMol/CIPLabeler/rules/Pairlist.h index 5c83da3bc..7251f4a71 100644 --- a/Code/GraphMol/CIPLabeler/rules/Pairlist.h +++ b/Code/GraphMol/CIPLabeler/rules/Pairlist.h @@ -30,19 +30,19 @@ namespace CIPLabeler { * @see Descriptor */ class PairList { -public: + public: static Descriptor ref(Descriptor descriptor) { switch (descriptor) { - case Descriptor::R: - case Descriptor::M: - case Descriptor::seqCis: - return Descriptor::R; - case Descriptor::S: - case Descriptor::P: - case Descriptor::seqTrans: - return Descriptor::S; - default: - return Descriptor::NONE; + case Descriptor::R: + case Descriptor::M: + case Descriptor::seqCis: + return Descriptor::R; + case Descriptor::S: + case Descriptor::P: + case Descriptor::seqTrans: + return Descriptor::S; + default: + return Descriptor::NONE; } } @@ -77,16 +77,16 @@ public: bool add(Descriptor descriptor) { switch (descriptor) { - case Descriptor::R: - case Descriptor::S: - case Descriptor::M: - case Descriptor::P: - case Descriptor::seqTrans: - case Descriptor::seqCis: - addAndPair(descriptor); - return true; - default: - return false; + case Descriptor::R: + case Descriptor::S: + case Descriptor::M: + case Descriptor::P: + case Descriptor::seqTrans: + case Descriptor::seqCis: + addAndPair(descriptor); + return true; + default: + return false; } } @@ -96,7 +96,8 @@ public: * * @param descriptors a collection of descriptors to be added */ - template void addAll(const T &descriptors) { + template + void addAll(const T &descriptors) { for (const auto &descriptor : descriptors) { add(descriptor); } @@ -151,7 +152,7 @@ public: return ss.str(); } -private: + private: std::vector d_descriptors; std::uint32_t d_pairing = 0; @@ -173,5 +174,5 @@ private: } }; -} // namespace CIPLabeler -} // namespace RDKit +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule1a.h b/Code/GraphMol/CIPLabeler/rules/Rule1a.h index 91756ba40..66482da94 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule1a.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule1a.h @@ -17,11 +17,11 @@ namespace CIPLabeler { // CIP Rule 1a: Higher atomic number precedes lower. class Rule1a : public SequenceRule { -public: + public: Rule1a(); int compare(const Edge *a, const Edge *b) const override; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule1b.h b/Code/GraphMol/CIPLabeler/rules/Rule1b.h index 5801c036c..ccb81c82b 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule1b.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule1b.h @@ -24,8 +24,7 @@ namespace CIPLabeler { * */ class Rule1b : public SequenceRule { - -public: + public: Rule1b(); int compare(const Edge *a, const Edge *b) const override; @@ -34,9 +33,9 @@ public: * Flag indicates whether to match the problematic * IUPAC 2013 recommendations for Rule 1B. */ -private: + private: static const bool IUPAC_2013 = false; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule2.h b/Code/GraphMol/CIPLabeler/rules/Rule2.h index 5c09374a7..beeeeb72a 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule2.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule2.h @@ -31,12 +31,11 @@ namespace CIPLabeler { * cases as the element’s atomic weight." */ class Rule2 : public SequenceRule { - -public: + public: Rule2(); int compare(const Edge *a, const Edge *b) const override; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule3.h b/Code/GraphMol/CIPLabeler/rules/Rule3.h index b3698a548..76468b5f3 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule3.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule3.h @@ -22,12 +22,11 @@ namespace CIPLabeler { * */ class Rule3 : public SequenceRule { - -public: + public: Rule3(); int compare(const Edge *a, const Edge *b) const override; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule4a.h b/Code/GraphMol/CIPLabeler/rules/Rule4a.h index c69892dc9..0adb61f83 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule4a.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule4a.h @@ -22,12 +22,11 @@ namespace CIPLabeler { * */ class Rule4a : public SequenceRule { - -public: + public: Rule4a(); int compare(const Edge *a, const Edge *b) const override; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule4b.h b/Code/GraphMol/CIPLabeler/rules/Rule4b.h index 78aecc0e2..0ae223c09 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule4b.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule4b.h @@ -23,15 +23,14 @@ namespace CIPLabeler { * */ class Rule4b : public SequenceRule { - -public: + public: Rule4b(); Rule4b(Descriptor ref); int compare(const Edge *a, const Edge *b) const override; -private: + private: const Descriptor d_ref = Descriptor::NONE; std::vector getReferenceDescriptors(const Node *node) const; @@ -43,14 +42,14 @@ private: std::vector> initialLevel(const Node *node) const; - std::vector> - getNextLevel(const std::vector> &prevLevel) const; + std::vector> getNextLevel( + const std::vector> &prevLevel) const; - std::vector - toNodeList(const std::vector &eqEdges) const; + std::vector toNodeList( + const std::vector &eqEdges) const; - std::vector - newPairLists(const std::vector &descriptors) const; + std::vector newPairLists( + const std::vector &descriptors) const; void fillPairs(const Node *beg, PairList &plist) const; @@ -60,5 +59,5 @@ private: Sort getRefSorter(const SequenceRule *replacement_rule) const; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule4c.h b/Code/GraphMol/CIPLabeler/rules/Rule4c.h index 981d17b81..3fac30eba 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule4c.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule4c.h @@ -21,12 +21,11 @@ namespace CIPLabeler { * */ class Rule4c : public SequenceRule { - -public: + public: Rule4c(); int compare(const Edge *a, const Edge *b) const override; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule5.h b/Code/GraphMol/CIPLabeler/rules/Rule5.h index 52dfe13d2..456123b8a 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule5.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule5.h @@ -22,12 +22,11 @@ namespace CIPLabeler { * */ class Rule5 : public SequenceRule { - -public: + public: Rule5(); int compare(const Edge *a, const Edge *b) const override; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule5New.h b/Code/GraphMol/CIPLabeler/rules/Rule5New.h index 3209ccd20..f2abca667 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule5New.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule5New.h @@ -21,15 +21,14 @@ namespace CIPLabeler { * */ class Rule5New : public SequenceRule { - -public: + public: Rule5New(); Rule5New(Descriptor ref); int compare(const Edge *a, const Edge *b) const override; -private: + private: const Descriptor d_ref = Descriptor::NONE; void fillPairs(const Node *beg, PairList &plist) const; @@ -37,5 +36,5 @@ private: Sort getRefSorter(const SequenceRule *replacement_rule) const; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rule6.h b/Code/GraphMol/CIPLabeler/rules/Rule6.h index 1b368d5ae..7b910468e 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rule6.h +++ b/Code/GraphMol/CIPLabeler/rules/Rule6.h @@ -19,11 +19,11 @@ namespace CIPLabeler { * Sequence Rule 6 (proposed) */ class Rule6 : public SequenceRule { -public: + public: Rule6(); int compare(const Edge *a, const Edge *b) const override; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/Rules.h b/Code/GraphMol/CIPLabeler/rules/Rules.h index c3704ba6d..1d75c8d70 100644 --- a/Code/GraphMol/CIPLabeler/rules/Rules.h +++ b/Code/GraphMol/CIPLabeler/rules/Rules.h @@ -20,8 +20,7 @@ namespace RDKit { namespace CIPLabeler { class Rules : public SequenceRule { - -public: + public: Rules() = delete; Rules(std::initializer_list rules) { @@ -83,9 +82,9 @@ public: return 0; } -private: + private: std::vector d_rules; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/rules/SequenceRule.h b/Code/GraphMol/CIPLabeler/rules/SequenceRule.h index 8a8478b27..c4dd7ca66 100644 --- a/Code/GraphMol/CIPLabeler/rules/SequenceRule.h +++ b/Code/GraphMol/CIPLabeler/rules/SequenceRule.h @@ -26,14 +26,14 @@ namespace CIPLabeler { class CIPMol; namespace { -template inline int three_way_comparison(const T &x, const T &y) { +template +inline int three_way_comparison(const T &x, const T &y) { return x < y ? -1 : (x == y ? 0 : 1); } -} // namespace +} // namespace class SequenceRule { - -public: + public: SequenceRule(); virtual ~SequenceRule(); @@ -56,12 +56,12 @@ public: virtual int compare(const Edge *a, const Edge *b) const = 0; -protected: + protected: std::unique_ptr dp_sorter = nullptr; -private: + private: bool areUpEdges(Node *aNode, Node *bNode, Edge *aEdge, Edge *bEdge) const; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit diff --git a/Code/GraphMol/Canon.h b/Code/GraphMol/Canon.h index 44dc321f2..57a367dfb 100644 --- a/Code/GraphMol/Canon.h +++ b/Code/GraphMol/Canon.h @@ -55,7 +55,7 @@ class RDKIT_GRAPHMOL_EXPORT MolStackElem { explicit MolStackElem(Atom *at) { type = MOL_STACK_ATOM; obj.atom = at; - }; + } //! construct a bond node /*! @@ -67,12 +67,12 @@ class RDKIT_GRAPHMOL_EXPORT MolStackElem { type = MOL_STACK_BOND; obj.bond = bond; number = idx; - }; + } //! construct for a ring closure explicit MolStackElem(int idx) { type = MOL_STACK_RING; number = idx; - }; + } //! construct for a branch opening or closing explicit MolStackElem(const char *chr, int idx) { switch (chr[0]) { diff --git a/Code/GraphMol/ChemReactions/Enumerate/CartesianProduct.h b/Code/GraphMol/ChemReactions/Enumerate/CartesianProduct.h index 51222fd0b..e448e4c64 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/CartesianProduct.h +++ b/Code/GraphMol/ChemReactions/Enumerate/CartesianProduct.h @@ -72,8 +72,7 @@ class RDKIT_CHEMREACTIONS_EXPORT CartesianProductStrategy size_t m_numPermutationsProcessed{}; public: - CartesianProductStrategy() - : EnumerationStrategyBase() {} + CartesianProductStrategy() : EnumerationStrategyBase() {} using EnumerationStrategyBase::initialize; diff --git a/Code/GraphMol/ChemReactions/Enumerate/Enumerate.h b/Code/GraphMol/ChemReactions/Enumerate/Enumerate.h index c40773a48..087dbd2ed 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/Enumerate.h +++ b/Code/GraphMol/ChemReactions/Enumerate/Enumerate.h @@ -60,8 +60,7 @@ namespace RDKit { struct RDKIT_CHEMREACTIONS_EXPORT EnumerationParams { int reagentMaxMatchCount{INT_MAX}; bool sanePartialProducts{false}; - EnumerationParams() - {} + EnumerationParams() {} EnumerationParams(const EnumerationParams &rhs) : reagentMaxMatchCount(rhs.reagentMaxMatchCount), diff --git a/Code/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h b/Code/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h index e0c25f57d..0b2e6f84c 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h +++ b/Code/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h @@ -56,10 +56,10 @@ namespace RDKit { class RDKIT_CHEMREACTIONS_EXPORT EnumerationStrategyException : public std::exception { public: - EnumerationStrategyException(const char *msg) : _msg(msg){}; - EnumerationStrategyException(const std::string &msg) : _msg(msg){}; - const char *what() const noexcept override { return _msg.c_str(); }; - ~EnumerationStrategyException() noexcept {}; + EnumerationStrategyException(const char *msg) : _msg(msg) {} + EnumerationStrategyException(const std::string &msg) : _msg(msg) {} + const char *what() const noexcept override { return _msg.c_str(); } + ~EnumerationStrategyException() noexcept {} private: std::string _msg; @@ -124,12 +124,11 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerationStrategyBase { m_permutationSizes; // m_permutationSizes num bbs per group boost::uint64_t m_numPermutations{}; // total number of permutations for this group - // -1 if > ssize_t::max + // -1 if > ssize_t::max public: static const boost::uint64_t EnumerationOverflow = static_cast(-1); - EnumerationStrategyBase() - : m_permutation(), m_permutationSizes() {} + EnumerationStrategyBase() : m_permutation(), m_permutationSizes() {} virtual ~EnumerationStrategyBase() {} @@ -138,7 +137,8 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerationStrategyBase { //! Initialize the enumerator based on the reaction and the //! supplied building blocks //! This is the standard API point. - //! This calls the derived class's initializeStrategy method which must be implemented + //! This calls the derived class's initializeStrategy method which must be + //! implemented void initialize(const ChemicalReaction &reaction, const EnumerationTypes::BBS &building_blocks) { // default initialization, may be overridden (sets the # reactants @@ -155,8 +155,10 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerationStrategyBase { // ! Initialize derived class. Must exist. // ! EnumerationStrategyBase structures are already initialized: // ! m_permutationSizes - [ length of building blocks for each reactant set ] - // ! m_numPermutations - number of possible permutations ( -1 if not computable ) - // ! m_permutation - the first permutation, always the first supplied reactants + // ! m_numPermutations - number of possible permutations + // ! ( -1 if not computable ) + // ! m_permutation - the first permutation, always the first supplied + // ! reactants virtual void initializeStrategy( const ChemicalReaction &reaction, const EnumerationTypes::BBS &building_blocks) = 0; diff --git a/Code/GraphMol/ChemReactions/Enumerate/EvenSamplePairs.h b/Code/GraphMol/ChemReactions/Enumerate/EvenSamplePairs.h index 62e2c1761..a85ae5ec8 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/EvenSamplePairs.h +++ b/Code/GraphMol/ChemReactions/Enumerate/EvenSamplePairs.h @@ -62,7 +62,7 @@ class RDKIT_CHEMREACTIONS_EXPORT EvenSamplePairsStrategy std::vector> pair_counts; std::set selected; - boost::uint64_t seed{}; // last seed for permutation (starts at 0) + boost::uint64_t seed{}; // last seed for permutation (starts at 0) boost::uint64_t M{}, a{}, b{}; // random number stuff boost::uint64_t nslack{}, min_nslack{}; boost::uint64_t rejected_period{}, rejected_unique{}; @@ -71,13 +71,12 @@ class RDKIT_CHEMREACTIONS_EXPORT EvenSamplePairsStrategy public: EvenSamplePairsStrategy() : EnumerationStrategyBase(), - + used_count(), var_used(), pair_used(), pair_counts(), - selected() - {} + selected() {} EvenSamplePairsStrategy(const EvenSamplePairsStrategy &rhs) : EnumerationStrategyBase(rhs), diff --git a/Code/GraphMol/ChemReactions/Enumerate/RandomSample.h b/Code/GraphMol/ChemReactions/Enumerate/RandomSample.h index cda182ff9..c3d87c8eb 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/RandomSample.h +++ b/Code/GraphMol/ChemReactions/Enumerate/RandomSample.h @@ -71,7 +71,7 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleStrategy public: RandomSampleStrategy() : EnumerationStrategyBase(), - + m_rng(), m_distributions() { for (size_t i = 0; i < m_permutation.size(); ++i) { @@ -85,8 +85,7 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleStrategy const EnumerationTypes::BBS &) { m_distributions.clear(); for (size_t i = 0; i < m_permutationSizes.size(); ++i) { - m_distributions.emplace_back( - 0, m_permutationSizes[i] - 1); + m_distributions.emplace_back(0, m_permutationSizes[i] - 1); } m_numPermutationsProcessed = 0; @@ -145,8 +144,7 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleStrategy // reset the uniform distributions m_distributions.clear(); for (size_t i = 0; i < m_permutationSizes.size(); ++i) { - m_distributions.emplace_back( - 0, m_permutationSizes[i] - 1); + m_distributions.emplace_back(0, m_permutationSizes[i] - 1); } } diff --git a/Code/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h b/Code/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h index c3eaffbed..418246f19 100644 --- a/Code/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h +++ b/Code/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h @@ -77,7 +77,7 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleAllBBsStrategy public: RandomSampleAllBBsStrategy() : EnumerationStrategyBase(), - + m_rng(), m_distributions() { for (size_t i = 0; i < m_permutation.size(); ++i) { @@ -94,8 +94,7 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleAllBBsStrategy m_maxoffset = *std::max_element(m_permutationSizes.begin(), m_permutationSizes.end()); for (size_t i = 0; i < m_permutationSizes.size(); ++i) { - m_distributions.emplace_back( - 0, m_permutationSizes[i] - 1); + m_distributions.emplace_back(0, m_permutationSizes[i] - 1); } m_numPermutationsProcessed = 0; @@ -166,8 +165,7 @@ class RDKIT_CHEMREACTIONS_EXPORT RandomSampleAllBBsStrategy // reset the uniform distributions m_distributions.clear(); for (size_t i = 0; i < m_permutationSizes.size(); ++i) { - m_distributions.emplace_back( - 0, m_permutationSizes[i] - 1); + m_distributions.emplace_back(0, m_permutationSizes[i] - 1); } } diff --git a/Code/GraphMol/ChemReactions/Reaction.h b/Code/GraphMol/ChemReactions/Reaction.h index d6f571bb8..593e7422f 100644 --- a/Code/GraphMol/ChemReactions/Reaction.h +++ b/Code/GraphMol/ChemReactions/Reaction.h @@ -47,12 +47,12 @@ class RDKIT_CHEMREACTIONS_EXPORT ChemicalReactionException : public std::exception { public: //! construct with an error message - explicit ChemicalReactionException(const char *msg) : _msg(msg){}; + explicit ChemicalReactionException(const char *msg) : _msg(msg) {} //! construct with an error message - explicit ChemicalReactionException(const std::string msg) : _msg(msg){}; + explicit ChemicalReactionException(const std::string msg) : _msg(msg) {} //! get the error message - const char *what() const noexcept override { return _msg.c_str(); }; - ~ChemicalReactionException() noexcept {}; + const char *what() const noexcept override { return _msg.c_str(); } + ~ChemicalReactionException() noexcept {} private: std::string _msg; @@ -120,7 +120,7 @@ class RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction : public RDProps { friend class ReactionPickler; public: - ChemicalReaction() : RDProps(){}; + ChemicalReaction() : RDProps() {} ChemicalReaction(const ChemicalReaction &other) : RDProps() { df_needsInit = other.df_needsInit; df_implicitProperties = other.df_implicitProperties; @@ -277,13 +277,13 @@ class RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction : public RDProps { } unsigned int getNumReactantTemplates() const { return rdcast(this->m_reactantTemplates.size()); - }; + } unsigned int getNumProductTemplates() const { return rdcast(this->m_productTemplates.size()); - }; + } unsigned int getNumAgentTemplates() const { return rdcast(this->m_agentTemplates.size()); - }; + } //! initializes our internal reactant-matching datastructures. /*! @@ -296,7 +296,7 @@ class RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction : public RDProps { */ void initReactantMatchers(bool silent = false); - bool isInitialized() const { return !df_needsInit; }; + bool isInitialized() const { return !df_needsInit; } //! validates the reactants and products to make sure the reaction seems //"reasonable" @@ -335,10 +335,10 @@ class RDKIT_CHEMREACTIONS_EXPORT ChemicalReaction : public RDProps { specified in the reaction. */ - bool getImplicitPropertiesFlag() const { return df_implicitProperties; }; + bool getImplicitPropertiesFlag() const { return df_implicitProperties; } //! sets the implicit properties flag. See the documentation for //! getImplicitProertiesFlag() for a discussion of what this means. - void setImplicitPropertiesFlag(bool val) { df_implicitProperties = val; }; + void setImplicitPropertiesFlag(bool val) { df_implicitProperties = val; } private: bool df_needsInit{true}; diff --git a/Code/GraphMol/ChemReactions/ReactionFingerprints.h b/Code/GraphMol/ChemReactions/ReactionFingerprints.h index 862db1571..6677da5af 100644 --- a/Code/GraphMol/ChemReactions/ReactionFingerprints.h +++ b/Code/GraphMol/ChemReactions/ReactionFingerprints.h @@ -73,9 +73,7 @@ enum FingerprintType { the difference fingerprint. */ struct RDKIT_CHEMREACTIONS_EXPORT ReactionFingerprintParams { - ReactionFingerprintParams() - - {} + ReactionFingerprintParams() {} ReactionFingerprintParams(bool includeAgents, double bitRatioAgents, unsigned int nonAgentWeight, int agentWeight, diff --git a/Code/GraphMol/ChemReactions/ReactionParser.h b/Code/GraphMol/ChemReactions/ReactionParser.h index fa8f9f08f..9276de83f 100644 --- a/Code/GraphMol/ChemReactions/ReactionParser.h +++ b/Code/GraphMol/ChemReactions/ReactionParser.h @@ -50,13 +50,13 @@ class RDKIT_CHEMREACTIONS_EXPORT ChemicalReactionParserException : public std::exception { public: //! construct with an error message - explicit ChemicalReactionParserException(const char *msg) : _msg(msg){}; + explicit ChemicalReactionParserException(const char *msg) : _msg(msg) {} //! construct with an error message explicit ChemicalReactionParserException(const std::string &msg) - : _msg(msg){}; + : _msg(msg) {} //! get the error message - const char *what() const noexcept override { return _msg.c_str(); }; - ~ChemicalReactionParserException() noexcept {}; + const char *what() const noexcept override { return _msg.c_str(); } + ~ChemicalReactionParserException() noexcept {} private: std::string _msg; diff --git a/Code/GraphMol/ChemReactions/ReactionPickler.h b/Code/GraphMol/ChemReactions/ReactionPickler.h index a131eb622..fe9067654 100644 --- a/Code/GraphMol/ChemReactions/ReactionPickler.h +++ b/Code/GraphMol/ChemReactions/ReactionPickler.h @@ -28,10 +28,10 @@ class ChemicalReaction; class RDKIT_CHEMREACTIONS_EXPORT ReactionPicklerException : public std::exception { public: - ReactionPicklerException(const char *msg) : _msg(msg){}; - ReactionPicklerException(const std::string msg) : _msg(msg){}; - const char *what() const noexcept override { return _msg.c_str(); }; - ~ReactionPicklerException() noexcept {}; + ReactionPicklerException(const char *msg) : _msg(msg) {} + ReactionPicklerException(const std::string msg) : _msg(msg) {} + const char *what() const noexcept override { return _msg.c_str(); } + ~ReactionPicklerException() noexcept {} private: std::string _msg; @@ -67,22 +67,22 @@ class RDKIT_CHEMREACTIONS_EXPORT ReactionPickler { static void pickleReaction(const ChemicalReaction *rxn, std::ostream &ss); static void pickleReaction(const ChemicalReaction &rxn, std::ostream &ss) { ReactionPickler::pickleReaction(&rxn, ss); - }; + } static void pickleReaction(const ChemicalReaction &rxn, std::ostream &ss, unsigned int propertyFlags) { ReactionPickler::pickleReaction(&rxn, ss, propertyFlags); - }; + } //! pickles a reaction and adds the results to string \c res static void pickleReaction(const ChemicalReaction *rxn, std::string &res, unsigned int propertyFlags); static void pickleReaction(const ChemicalReaction *rxn, std::string &res); static void pickleReaction(const ChemicalReaction &rxn, std::string &res) { ReactionPickler::pickleReaction(&rxn, res); - }; + } static void pickleReaction(const ChemicalReaction &rxn, std::string &res, unsigned int propertyFlags) { ReactionPickler::pickleReaction(&rxn, res, propertyFlags); - }; + } //! constructs a reaction from a pickle stored in a //! string @@ -91,14 +91,14 @@ class RDKIT_CHEMREACTIONS_EXPORT ReactionPickler { static void reactionFromPickle(const std::string &pickle, ChemicalReaction &rxn) { ReactionPickler::reactionFromPickle(pickle, &rxn); - }; + } //! constructs a reaction from a pickle stored in a //! stream static void reactionFromPickle(std::istream &ss, ChemicalReaction *rxn); static void reactionFromPickle(std::istream &ss, ChemicalReaction &rxn) { ReactionPickler::reactionFromPickle(ss, &rxn); - }; + } private: //! do the actual work of pickling a reaction diff --git a/Code/GraphMol/ChemReactions/SanitizeRxn.h b/Code/GraphMol/ChemReactions/SanitizeRxn.h index 757a54407..c3d180e1c 100644 --- a/Code/GraphMol/ChemReactions/SanitizeRxn.h +++ b/Code/GraphMol/ChemReactions/SanitizeRxn.h @@ -43,10 +43,10 @@ namespace RDKit { //! class for flagging sanitization errors class RDKIT_CHEMREACTIONS_EXPORT RxnSanitizeException : public std::exception { public: - RxnSanitizeException(const char *msg) : _msg(msg){}; - RxnSanitizeException(const std::string &msg) : _msg(msg){}; - const char *what() const noexcept override { return _msg.c_str(); }; - ~RxnSanitizeException() noexcept {}; + RxnSanitizeException(const char *msg) : _msg(msg) {} + RxnSanitizeException(const std::string &msg) : _msg(msg) {} + const char *what() const noexcept override { return _msg.c_str(); } + ~RxnSanitizeException() noexcept {} private: std::string _msg; diff --git a/Code/GraphMol/ChemTransforms/MolFragmenter.h b/Code/GraphMol/ChemTransforms/MolFragmenter.h index 85a496433..aff2dd85c 100644 --- a/Code/GraphMol/ChemTransforms/MolFragmenter.h +++ b/Code/GraphMol/ChemTransforms/MolFragmenter.h @@ -101,25 +101,24 @@ RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSBondTypes( std::vector &defs); } // namespace MolFragmenter - -enum class RDKIT_CHEMTRANSFORMS_EXPORT MolzipLabel { - AtomMapNumber, - Isotope, - FragmentOnBonds, - AtomType }; +enum class RDKIT_CHEMTRANSFORMS_EXPORT MolzipLabel { + AtomMapNumber, + Isotope, + FragmentOnBonds, + AtomType +}; struct RDKIT_CHEMTRANSFORMS_EXPORT MolzipParams { MolzipLabel label = MolzipLabel::AtomMapNumber; std::vector atomSymbols; }; -RDKIT_CHEMTRANSFORMS_EXPORT std::unique_ptr molzip( +RDKIT_CHEMTRANSFORMS_EXPORT std::unique_ptr molzip( const ROMol &a, const ROMol &b, - const MolzipParams ¶ms=MolzipParams()); - -RDKIT_CHEMTRANSFORMS_EXPORT std::unique_ptr molzip(const ROMol &a, - const MolzipParams ¶ms=MolzipParams()); + const MolzipParams ¶ms = MolzipParams()); +RDKIT_CHEMTRANSFORMS_EXPORT std::unique_ptr molzip( + const ROMol &a, const MolzipParams ¶ms = MolzipParams()); } // namespace RDKit #endif diff --git a/Code/GraphMol/Conformer.h b/Code/GraphMol/Conformer.h index 753daa4ff..b0731938a 100644 --- a/Code/GraphMol/Conformer.h +++ b/Code/GraphMol/Conformer.h @@ -24,12 +24,12 @@ class ROMol; class RDKIT_GRAPHMOL_EXPORT ConformerException : public std::exception { public: //! construct with an error message - ConformerException(const char *msg) : _msg(msg){}; + ConformerException(const char *msg) : _msg(msg) {} //! construct with an error message - ConformerException(const std::string &msg) : _msg(msg){}; + ConformerException(const std::string &msg) : _msg(msg) {} //! get the error message - const char *what() const noexcept override { return _msg.c_str(); }; - ~ConformerException() noexcept {}; + const char *what() const noexcept override { return _msg.c_str(); } + ~ConformerException() noexcept {} private: std::string _msg; @@ -46,7 +46,7 @@ class RDKIT_GRAPHMOL_EXPORT Conformer : public RDProps { friend class ROMol; //! Constructor - Conformer() { d_positions.clear(); }; + Conformer() { d_positions.clear(); } //! Constructor with number of atoms specified ID specification Conformer(unsigned int numAtoms) { @@ -56,14 +56,14 @@ class RDKIT_GRAPHMOL_EXPORT Conformer : public RDProps { d_positions.resize(0); d_positions.clear(); } - }; + } //! Copy Constructor: initialize from a second conformation. Conformer(const Conformer &other); Conformer &operator=(const Conformer &other); //! Destructor - ~Conformer(){}; + ~Conformer() {} //! Resize the conformer so that more atoms location can be added. //! Useful, for e.g., when adding hydrogens @@ -73,7 +73,7 @@ class RDKIT_GRAPHMOL_EXPORT Conformer : public RDProps { void reserve(unsigned int size) { d_positions.reserve(size); } //! returns whether or not this instance belongs to a molecule - bool hasOwningMol() const { return dp_mol != nullptr; }; + bool hasOwningMol() const { return dp_mol != nullptr; } //! Get the molecule that owns this instance ROMol &getOwningMol() const { diff --git a/Code/GraphMol/Depictor/EmbeddedFrag.h b/Code/GraphMol/Depictor/EmbeddedFrag.h index 16e3c6df0..7eb00f71e 100644 --- a/Code/GraphMol/Depictor/EmbeddedFrag.h +++ b/Code/GraphMol/Depictor/EmbeddedFrag.h @@ -30,11 +30,7 @@ class RDKIT_DEPICTOR_EXPORT EmbeddedAtom { public: typedef enum { UNSPECIFIED = 0, CISTRANS, RING } EAtomType; - EmbeddedAtom() - - { - neighs.clear(); - } + EmbeddedAtom() { neighs.clear(); } EmbeddedAtom(const EmbeddedAtom &other) = default; @@ -161,7 +157,7 @@ class RDKIT_DEPICTOR_EXPORT EmbeddedFrag { EmbeddedFrag() { d_eatoms.clear(); d_attachPts.clear(); - }; + } //! Initializer from a single atom id /*! diff --git a/Code/GraphMol/Depictor/RDDepictor.h b/Code/GraphMol/Depictor/RDDepictor.h index 810762b40..5e6c86dcf 100644 --- a/Code/GraphMol/Depictor/RDDepictor.h +++ b/Code/GraphMol/Depictor/RDDepictor.h @@ -30,10 +30,10 @@ typedef boost::shared_array DOUBLE_SMART_PTR; class RDKIT_DEPICTOR_EXPORT DepictException : public std::exception { public: - DepictException(const char *msg) : _msg(msg){}; - DepictException(const std::string msg) : _msg(msg){}; - const char *what() const noexcept override { return _msg.c_str(); }; - ~DepictException() noexcept {}; + DepictException(const char *msg) : _msg(msg) {} + DepictException(const std::string msg) : _msg(msg) {} + const char *what() const noexcept override { return _msg.c_str(); } + ~DepictException() noexcept {} private: std::string _msg; diff --git a/Code/GraphMol/Deprotect/Deprotect.h b/Code/GraphMol/Deprotect/Deprotect.h index 833afd29a..30d6cfcd8 100644 --- a/Code/GraphMol/Deprotect/Deprotect.h +++ b/Code/GraphMol/Deprotect/Deprotect.h @@ -47,9 +47,8 @@ struct RDKIT_DEPROTECT_EXPORT DeprotectData { DeprotectData(const std::string &deprotection_class, const std::string &reaction_smarts, - const std::string &abbrevition, - const std::string &full_name, - const std::string &example=""); + const std::string &abbrevition, const std::string &full_name, + const std::string &example = ""); bool operator==(const DeprotectData &other) const { return (deprotection_class == other.deprotection_class && @@ -83,6 +82,6 @@ RDKIT_DEPROTECT_EXPORT const std::vector &getDeprotections(); RDKIT_DEPROTECT_EXPORT std::unique_ptr deprotect( const ROMol &mol, const std::vector &deprotections = getDeprotections()); -} // namspace Deprotect -} // namespace RDKit +} // namespace Deprotect +} // namespace RDKit #endif diff --git a/Code/GraphMol/Descriptors/AtomFeat.h b/Code/GraphMol/Descriptors/AtomFeat.h index 7db0592ca..2a1d461e3 100644 --- a/Code/GraphMol/Descriptors/AtomFeat.h +++ b/Code/GraphMol/Descriptors/AtomFeat.h @@ -30,8 +30,10 @@ class ROMol; namespace Descriptors { const std::string AtomFeatVersion = "1.0.0"; -RDKIT_DESCRIPTORS_EXPORT void AtomFeatVect( - const ROMol &, std::vector &res, int atomid = 0, bool addchiral = false ); +RDKIT_DESCRIPTORS_EXPORT void AtomFeatVect(const ROMol &, + std::vector &res, + int atomid = 0, + bool addchiral = false); } // namespace Descriptors } // namespace RDKit -#endif \ No newline at end of file +#endif diff --git a/Code/GraphMol/Descriptors/BCUT.h b/Code/GraphMol/Descriptors/BCUT.h index 2d723dc31..af4ce907d 100644 --- a/Code/GraphMol/Descriptors/BCUT.h +++ b/Code/GraphMol/Descriptors/BCUT.h @@ -18,42 +18,49 @@ class ROMol; namespace Descriptors { const std::string BCUT2DVersion = "1.0.0"; -//! Implements BCUT descriptors From J. Chem. Inf. Comput. Sci., Vol. 39, No. 1, 1999 +//! Implements BCUT descriptors From J. Chem. Inf. Comput. Sci., Vol. 39, No. 1, +//! 1999 /*! \param mol the molecule of interest - \param atom_props A vector of double for the atom properties to use for the diagonal elements - of the BCUT matrix. Must be equal to he number of atoms in mol. - \return std::pair pair.first is the high eval, pair.second the lowest -*/ + \param atom_props A vector of double for the atom properties to use for the + diagonal elements of the BCUT matrix. Must be equal to + the number of atoms in mol. + \return std::pair pair.first is the high eval, + pair.second the lowest +*/ RDKIT_DESCRIPTORS_EXPORT -std::pair BCUT2D(const ROMol &mol, const std::vector &atom_props); +std::pair BCUT2D(const ROMol &mol, + const std::vector &atom_props); -//! Implements BCUT descriptors From J. Chem. Inf. Comput. Sci., Vol. 39, No. 1, 1999 +//! Implements BCUT descriptors From J. Chem. Inf. Comput. Sci., Vol. 39, No. 1, +//! 1999 /*! \param mol the molecule of interest \param atom_props An atom property holding a double value on the atom If atom_propname does not exist on the atom, raises If atom_propname cannot be coerced into a double, raises - \return std::pair pair.first is the high eval, pair.second the lowest -*/ + \return std::pair pair.first is the high eval, + pair.second the lowest +*/ RDKIT_DESCRIPTORS_EXPORT -std::pair BCUT2D(const ROMol &mol, const std::string &atom_propname); +std::pair BCUT2D(const ROMol &mol, + const std::string &atom_propname); -//! Implements BCUT descriptors From J. Chem. Inf. Comput. Sci., Vol. 39, No. 1, 1999 +//! Implements BCUT descriptors From J. Chem. Inf. Comput. Sci., Vol. 39, No. 1, +//! 1999 //! Diagonal elements are (currently) atomic mass, gasteiger charge, //! crippen logP and crippen MR /*! \param mol the molecule of interest \return The bcut vector (mass high eval, mass low eval, - gasteiger charge high eval, gasteiger charge low eval, - LogP high eval, LogP low eval, - MR high eval, MR low eval) + gasteiger charge high eval, gasteiger + charge low eval, LogP high eval, LogP low eval, MR high eval, MR low eval) */ -RDKIT_DESCRIPTORS_EXPORT +RDKIT_DESCRIPTORS_EXPORT std::vector BCUT2D(const ROMol &m); -} -} - +} // namespace Descriptors +} // namespace RDKit + #endif #endif diff --git a/Code/GraphMol/Descriptors/CoulombMat.h b/Code/GraphMol/Descriptors/CoulombMat.h index d6e8feb68..e9b74919d 100644 --- a/Code/GraphMol/Descriptors/CoulombMat.h +++ b/Code/GraphMol/Descriptors/CoulombMat.h @@ -25,7 +25,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifndef CoulombMatRDKIT_H_MAY2018 #define CoulombMatRDKIT_H_MAY2018 @@ -34,9 +33,10 @@ namespace RDKit { class ROMol; namespace Descriptors { const std::string CoulombMatVersion = "1.0.0"; -RDKIT_DESCRIPTORS_EXPORT void CoulombMat(const ROMol &mol, std::vector> &res, - int confId=-1); -} -} +RDKIT_DESCRIPTORS_EXPORT void CoulombMat(const ROMol &mol, + std::vector> &res, + int confId = -1); +} // namespace Descriptors +} // namespace RDKit #endif #endif diff --git a/Code/GraphMol/Descriptors/Crippen.h b/Code/GraphMol/Descriptors/Crippen.h index d813e5106..42a846c18 100644 --- a/Code/GraphMol/Descriptors/Crippen.h +++ b/Code/GraphMol/Descriptors/Crippen.h @@ -123,8 +123,8 @@ class RDKIT_DESCRIPTORS_EXPORT CrippenParamCollection { typedef std::vector ParamsVect; static const CrippenParamCollection *getParams( const std::string ¶mData = ""); - ParamsVect::const_iterator begin() const { return d_params.begin(); }; - ParamsVect::const_iterator end() const { return d_params.end(); }; + ParamsVect::const_iterator begin() const { return d_params.begin(); } + ParamsVect::const_iterator end() const { return d_params.end(); } CrippenParamCollection(const std::string ¶mData); diff --git a/Code/GraphMol/Descriptors/Property.h b/Code/GraphMol/Descriptors/Property.h index 0fafaaab6..70ea02ca7 100644 --- a/Code/GraphMol/Descriptors/Property.h +++ b/Code/GraphMol/Descriptors/Property.h @@ -53,7 +53,7 @@ struct RDKIT_DESCRIPTORS_EXPORT PropertyFunctor { PropertyFunctor(const std::string &name, const std::string &version, double (*func)(const ROMol &) = nullptr) : propName(name), propVersion(version), d_dataFunc(func) {} - virtual ~PropertyFunctor(){}; + virtual ~PropertyFunctor() {} //! Compute the value of the property virtual double operator()(const RDKit::ROMol &) const = 0; diff --git a/Code/GraphMol/DistGeomHelpers/Embedder.h b/Code/GraphMol/DistGeomHelpers/Embedder.h index 547b728a1..f76de1c4e 100644 --- a/Code/GraphMol/DistGeomHelpers/Embedder.h +++ b/Code/GraphMol/DistGeomHelpers/Embedder.h @@ -127,12 +127,7 @@ struct RDKIT_DISTGEOMHELPERS_EXPORT EmbedParameters { void (*callback)(unsigned int); bool forceTransAmides{true}; bool useSymmetryForPruning{true}; - EmbedParameters() - : boundsMat(nullptr), - - CPCI(nullptr), - - callback(nullptr){}; + EmbedParameters() : boundsMat(nullptr), CPCI(nullptr), callback(nullptr) {} EmbedParameters( unsigned int maxIterations, int numThreads, int randomSeed, bool clearConfs, bool useRandomCoords, double boxSizeMult, @@ -173,7 +168,7 @@ struct RDKIT_DISTGEOMHELPERS_EXPORT EmbedParameters { useMacrocycleTorsions(useMacrocycleTorsions), useMacrocycle14config(useMacrocycle14config), CPCI(CPCI), - callback(callback){}; + callback(callback) {} }; //*! update parameters from a JSON string diff --git a/Code/GraphMol/FMCS/DebugTrace.h b/Code/GraphMol/FMCS/DebugTrace.h index f56348401..60f045956 100644 --- a/Code/GraphMol/FMCS/DebugTrace.h +++ b/Code/GraphMol/FMCS/DebugTrace.h @@ -16,8 +16,8 @@ #include #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS -#include // for timeval -#ifdef _DEBUG // check memory leaks +#include // for timeval +#ifdef _DEBUG // check memory leaks #include #define _CRTDBG_MAP_ALLOC #ifndef new diff --git a/Code/GraphMol/FMCS/DuplicatedSeedCache.h b/Code/GraphMol/FMCS/DuplicatedSeedCache.h index e532e431d..a336e8ce0 100644 --- a/Code/GraphMol/FMCS/DuplicatedSeedCache.h +++ b/Code/GraphMol/FMCS/DuplicatedSeedCache.h @@ -68,7 +68,7 @@ class DuplicatedSeedCache { std::map Index; size_t MaxAtoms{0}; // max key in the cache for fast failed find public: - DuplicatedSeedCache() {} + DuplicatedSeedCache() {} void clear() { Index.clear(); MaxAtoms = 0; diff --git a/Code/GraphMol/FMCS/RingMatchTableSet.h b/Code/GraphMol/FMCS/RingMatchTableSet.h index ed9aa777d..1ce01d29d 100644 --- a/Code/GraphMol/FMCS/RingMatchTableSet.h +++ b/Code/GraphMol/FMCS/RingMatchTableSet.h @@ -49,7 +49,7 @@ class RDKIT_FMCS_EXPORT RingMatchTableSet { inline unsigned getRingIndex(const INT_VECT* r2) const { std::map::const_iterator j = RingIndex.find(r2); - if (RingIndex.end() == j) throw - 1; + if (RingIndex.end() == j) throw -1; return j->second; } }; @@ -63,7 +63,7 @@ class RDKIT_FMCS_EXPORT RingMatchTableSet { std::map QueryRingIndex; public: - RingMatchTableSet() {} + RingMatchTableSet() {} inline void clear() { if (QueryBondRingsIndeces) QueryBondRingsIndeces->clear(); @@ -82,14 +82,14 @@ class RDKIT_FMCS_EXPORT RingMatchTableSet { inline bool isTargetBondInRing(const ROMol* target, unsigned bi) const { std::map>>::const_iterator i = TargetBondRingsIndecesSet.find(target); - if (TargetBondRingsIndecesSet.end() == i) throw - 1; // never + if (TargetBondRingsIndecesSet.end() == i) throw -1; // never return i->second[bi].empty(); } inline const std::vector& getTargetBondRings(const ROMol* target, unsigned bi) const { std::map>>::const_iterator i = TargetBondRingsIndecesSet.find(target); - if (TargetBondRingsIndecesSet.end() == i) throw - 1; // never + if (TargetBondRingsIndecesSet.end() == i) throw -1; // never return i->second[bi]; } @@ -211,13 +211,13 @@ class RDKIT_FMCS_EXPORT RingMatchTableSet { inline unsigned getQueryRingIndex(const INT_VECT* r1) const { std::map::const_iterator i = QueryRingIndex.find(r1); - if (QueryRingIndex.end() == i) throw - 1; // never + if (QueryRingIndex.end() == i) throw -1; // never return i->second; } inline const RingMatchTable& getTargetMatchMatrix(const ROMol* mol2) const { std::map::const_iterator mi = MatchMatrixSet.find(mol2); - if (MatchMatrixSet.end() == mi) throw - 1; // never + if (MatchMatrixSet.end() == mi) throw -1; // never return mi->second; } diff --git a/Code/GraphMol/FMCS/SubstructureCache.h b/Code/GraphMol/FMCS/SubstructureCache.h index 53917cdb1..3793f386a 100644 --- a/Code/GraphMol/FMCS/SubstructureCache.h +++ b/Code/GraphMol/FMCS/SubstructureCache.h @@ -29,7 +29,7 @@ class RDKIT_FMCS_EXPORT SubstructureCache { TValue Value{0}; public: - KeyNumericMetrics() {} + KeyNumericMetrics() {} }; #pragma pack(pop) diff --git a/Code/GraphMol/FMCS/TargetMatch.h b/Code/GraphMol/FMCS/TargetMatch.h index 9560357a8..af956e992 100644 --- a/Code/GraphMol/FMCS/TargetMatch.h +++ b/Code/GraphMol/FMCS/TargetMatch.h @@ -24,7 +24,7 @@ struct TargetMatch { std::vector VisitedTargetBonds; std::vector VisitedTargetAtoms; // for checking rings public: - TargetMatch() {} + TargetMatch() {} TargetMatch(const TargetMatch& src) { *this = src; } TargetMatch& operator=(const TargetMatch& src) { Empty = src.Empty; diff --git a/Code/GraphMol/FileParsers/FileParsers.h b/Code/GraphMol/FileParsers/FileParsers.h index a9584a453..ec9585df5 100644 --- a/Code/GraphMol/FileParsers/FileParsers.h +++ b/Code/GraphMol/FileParsers/FileParsers.h @@ -29,13 +29,13 @@ class RDKIT_FILEPARSERS_EXPORT MolFileUnhandledFeatureException : public std::exception { public: //! construct with an error message - explicit MolFileUnhandledFeatureException(const char *msg) : _msg(msg){}; + explicit MolFileUnhandledFeatureException(const char *msg) : _msg(msg) {} //! construct with an error message explicit MolFileUnhandledFeatureException(const std::string msg) - : _msg(msg){}; + : _msg(msg) {} //! get the error message - const char *what() const noexcept override { return _msg.c_str(); }; - ~MolFileUnhandledFeatureException() noexcept override{}; + const char *what() const noexcept override { return _msg.c_str(); } + ~MolFileUnhandledFeatureException() noexcept override {} private: std::string _msg; diff --git a/Code/GraphMol/FileParsers/MolSupplier.h b/Code/GraphMol/FileParsers/MolSupplier.h index 342f1a94e..6a09d34a6 100644 --- a/Code/GraphMol/FileParsers/MolSupplier.h +++ b/Code/GraphMol/FileParsers/MolSupplier.h @@ -58,8 +58,8 @@ RDKIT_FILEPARSERS_EXPORT std::string strip(const std::string &orig); class RDKIT_FILEPARSERS_EXPORT MolSupplier { // this is an abstract base class to supply molecules one at a time public: - MolSupplier(){}; - virtual ~MolSupplier(){}; + MolSupplier() {} + virtual ~MolSupplier() {} virtual void init() = 0; virtual void reset() = 0; virtual bool atEnd() = 0; @@ -123,14 +123,14 @@ class RDKIT_FILEPARSERS_EXPORT ForwardSDMolSupplier : public MolSupplier { *noted. ***********************************************************************************/ public: - ForwardSDMolSupplier() { init(); }; + ForwardSDMolSupplier() { init(); } explicit ForwardSDMolSupplier(std::istream *inStream, bool takeOwnership = true, bool sanitize = true, bool removeHs = true, bool strictParsing = false); - virtual ~ForwardSDMolSupplier() { close(); }; + virtual ~ForwardSDMolSupplier() { close(); } virtual void init(); virtual void reset(); @@ -168,7 +168,7 @@ class RDKIT_FILEPARSERS_EXPORT SDMolSupplier : public ForwardSDMolSupplier { ***********************************************************************************/ public: - SDMolSupplier() { init(); }; + SDMolSupplier() { init(); } /*! * \param fileName - the name of the SD file @@ -186,7 +186,7 @@ class RDKIT_FILEPARSERS_EXPORT SDMolSupplier : public ForwardSDMolSupplier { bool sanitize = true, bool removeHs = true, bool strictParsing = true); - virtual ~SDMolSupplier() { close(); }; + virtual ~SDMolSupplier() { close(); } void init(); void reset(); ROMol *next(); @@ -270,7 +270,7 @@ class RDKIT_FILEPARSERS_EXPORT SmilesMolSupplier : public MolSupplier { int smilesColumn = 0, int nameColumn = 1, bool titleLine = true, bool sanitize = true); - virtual ~SmilesMolSupplier() { close(); }; + virtual ~SmilesMolSupplier() { close(); } void setData(const std::string &text, const std::string &delimiter = " ", int smilesColumn = 0, int nameColumn = 1, bool titleLine = true, bool sanitize = true); @@ -342,7 +342,7 @@ class RDKIT_FILEPARSERS_EXPORT TDTMolSupplier : public MolSupplier { const std::string &nameRecord = "", int confId2D = -1, int confId3D = 0, bool sanitize = true); TDTMolSupplier(); - virtual ~TDTMolSupplier() { close(); }; + virtual ~TDTMolSupplier() { close(); } void setData(const std::string &text, const std::string &nameRecord = "", int confId2D = -1, int confId3D = 0, bool sanitize = true); void init(); @@ -387,7 +387,7 @@ class RDKIT_FILEPARSERS_EXPORT PDBMolSupplier : public MolSupplier { bool removeHs = true, unsigned int flavor = 0, bool proximityBonding = true); - virtual ~PDBMolSupplier() { close(); }; + virtual ~PDBMolSupplier() { close(); } virtual void init(); virtual void reset(); @@ -408,7 +408,7 @@ class RDKIT_FILEPARSERS_EXPORT MaeMolSupplier : public MolSupplier { */ public: - MaeMolSupplier() { init(); }; + MaeMolSupplier() { init(); } explicit MaeMolSupplier(std::shared_ptr inStream, bool sanitize = true, bool removeHs = true); @@ -419,7 +419,7 @@ class RDKIT_FILEPARSERS_EXPORT MaeMolSupplier : public MolSupplier { explicit MaeMolSupplier(const std::string &fname, bool sanitize = true, bool removeHs = true); - virtual ~MaeMolSupplier(){}; + virtual ~MaeMolSupplier() {} virtual void init(); virtual void reset(); diff --git a/Code/GraphMol/FileParsers/MolWriters.h b/Code/GraphMol/FileParsers/MolWriters.h index 948ac95b1..f80475b47 100644 --- a/Code/GraphMol/FileParsers/MolWriters.h +++ b/Code/GraphMol/FileParsers/MolWriters.h @@ -85,7 +85,7 @@ class RDKIT_FILEPARSERS_EXPORT SmilesWriter : public MolWriter { } catch (const std::runtime_error &) { } } - }; + } //! \brief close our stream (the writer cannot be used again) void close() { @@ -97,10 +97,10 @@ class RDKIT_FILEPARSERS_EXPORT SmilesWriter : public MolWriter { df_owner = false; } dp_ostream = nullptr; - }; + } //! \brief get the number of molecules written so far - unsigned int numMols() const { return d_molid; }; + unsigned int numMols() const { return d_molid; } private: // local initialization @@ -163,7 +163,7 @@ class RDKIT_FILEPARSERS_EXPORT SDWriter : public MolWriter { } catch (const std::runtime_error &) { } } - }; + } //! \brief close our stream (the writer cannot be used again) void close() { @@ -175,16 +175,16 @@ class RDKIT_FILEPARSERS_EXPORT SDWriter : public MolWriter { df_owner = false; } dp_ostream = nullptr; - }; + } //! \brief get the number of molecules written so far - unsigned int numMols() const { return d_molid; }; + unsigned int numMols() const { return d_molid; } - void setForceV3000(bool val) { df_forceV3000 = val; }; - bool getForceV3000() const { return df_forceV3000; }; + void setForceV3000(bool val) { df_forceV3000 = val; } + bool getForceV3000() const { return df_forceV3000; } - void setKekulize(bool val) { df_kekulize = val; }; - bool getKekulize() const { return df_kekulize; }; + void setKekulize(bool val) { df_kekulize = val; } + bool getKekulize() const { return df_kekulize; } private: void writeProperty(const ROMol &mol, const std::string &name); @@ -234,7 +234,7 @@ class RDKIT_FILEPARSERS_EXPORT TDTWriter : public MolWriter { } catch (const std::runtime_error &) { } } - }; + } //! \brief close our stream (the writer cannot be used again) void close() { @@ -250,19 +250,19 @@ class RDKIT_FILEPARSERS_EXPORT TDTWriter : public MolWriter { df_owner = false; } dp_ostream = nullptr; - }; + } //! \brief get the number of molecules written so far - unsigned int numMols() const { return d_molid; }; + unsigned int numMols() const { return d_molid; } - void setWrite2D(bool state = true) { df_write2D = state; }; - bool getWrite2D() const { return df_write2D; }; + void setWrite2D(bool state = true) { df_write2D = state; } + bool getWrite2D() const { return df_write2D; } - void setWriteNames(bool state = true) { df_writeNames = state; }; - bool getWriteNames() const { return df_writeNames; }; + void setWriteNames(bool state = true) { df_writeNames = state; } + bool getWriteNames() const { return df_writeNames; } - void setNumDigits(unsigned int numDigits) { d_numDigits = numDigits; }; - unsigned int getNumDigits() const { return d_numDigits; }; + void setNumDigits(unsigned int numDigits) { d_numDigits = numDigits; } + unsigned int getNumDigits() const { return d_numDigits; } private: void writeProperty(const ROMol &mol, const std::string &name); @@ -289,7 +289,7 @@ class RDKIT_FILEPARSERS_EXPORT PDBWriter : public MolWriter { //! \brief write a new molecule to the file void write(const ROMol &mol, int confId = defaultConfId); - void setProps(const STR_VECT &){}; + void setProps(const STR_VECT &) {} //! \brief flush the ostream void flush() { @@ -302,7 +302,7 @@ class RDKIT_FILEPARSERS_EXPORT PDBWriter : public MolWriter { } catch (const std::runtime_error &) { } } - }; + } //! \brief close our stream (the writer cannot be used again) void close() { @@ -314,10 +314,10 @@ class RDKIT_FILEPARSERS_EXPORT PDBWriter : public MolWriter { df_owner = false; } dp_ostream = nullptr; - }; + } //! \brief get the number of molecules written so far - unsigned int numMols() const { return d_count; }; + unsigned int numMols() const { return d_count; } private: std::ostream *dp_ostream; diff --git a/Code/GraphMol/FileParsers/MultithreadedMolSupplier.h b/Code/GraphMol/FileParsers/MultithreadedMolSupplier.h index 256f1e741..8ca3fe363 100644 --- a/Code/GraphMol/FileParsers/MultithreadedMolSupplier.h +++ b/Code/GraphMol/FileParsers/MultithreadedMolSupplier.h @@ -32,7 +32,7 @@ class RDKIT_FILEPARSERS_EXPORT MultithreadedMolSupplier : public MolSupplier { //! this is an abstract base class to concurrently supply molecules one at a //! time public: - MultithreadedMolSupplier(){}; + MultithreadedMolSupplier() {} virtual ~MultithreadedMolSupplier(); //! pop elements from the output queue ROMol *next(); diff --git a/Code/GraphMol/FileParsers/MultithreadedSDMolSupplier.h b/Code/GraphMol/FileParsers/MultithreadedSDMolSupplier.h index 4b915164c..cb7a82695 100644 --- a/Code/GraphMol/FileParsers/MultithreadedSDMolSupplier.h +++ b/Code/GraphMol/FileParsers/MultithreadedSDMolSupplier.h @@ -31,7 +31,7 @@ class RDKIT_FILEPARSERS_EXPORT MultithreadedSDMolSupplier MultithreadedSDMolSupplier(); ~MultithreadedSDMolSupplier(); - void init(){}; + void init() {} void checkForEnd(); bool getEnd() const; diff --git a/Code/GraphMol/FileParsers/MultithreadedSmilesMolSupplier.h b/Code/GraphMol/FileParsers/MultithreadedSmilesMolSupplier.h index 62b76988f..7022679ec 100644 --- a/Code/GraphMol/FileParsers/MultithreadedSmilesMolSupplier.h +++ b/Code/GraphMol/FileParsers/MultithreadedSmilesMolSupplier.h @@ -13,7 +13,7 @@ #include "MultithreadedMolSupplier.h" namespace RDKit { //! This class is still a bit experimental and the public API may change -//! in future releases. +//! in future releases. class RDKIT_FILEPARSERS_EXPORT MultithreadedSmilesMolSupplier : public MultithreadedMolSupplier { public: @@ -32,7 +32,7 @@ class RDKIT_FILEPARSERS_EXPORT MultithreadedSmilesMolSupplier MultithreadedSmilesMolSupplier(); ~MultithreadedSmilesMolSupplier(); - void init(){}; + void init() {} //! returns df_end bool getEnd() const; //! reads and processes the title line diff --git a/Code/GraphMol/FilterCatalog/FilterCatalog.h b/Code/GraphMol/FilterCatalog/FilterCatalog.h index a61b418f9..b34f08ab3 100644 --- a/Code/GraphMol/FilterCatalog/FilterCatalog.h +++ b/Code/GraphMol/FilterCatalog/FilterCatalog.h @@ -242,19 +242,19 @@ RDKIT_FILTERCATALOG_EXPORT bool FilterCatalogCanSerialize(); //! Run a filter catalog on a set of smiles strings /* \param smiles vector of smiles strings to analyze - \param nthreads specify the number of threads to use or specify 0 to use all processors - [default 1] + \param nthreads specify the number of threads to use or specify 0 to use all + processors [default 1] \returns a vector of vectors. For each input smiles string, returns a vector of shared_ptr::FilterMatchEntry objects. If a molecule matches no filters, the vector will be empty. - If a smiles can't be parsed, a 'no valid RDKit molecule' catalog entry is returned. + If a smiles can't be parsed, a 'no valid RDKit molecule' + catalog entry is returned. */ RDKIT_FILTERCATALOG_EXPORT -std::vector>> RunFilterCatalog( - const FilterCatalog &filterCatalog, - const std::vector &smiles, - int numThreads=1); +std::vector>> +RunFilterCatalog(const FilterCatalog &filterCatalog, + const std::vector &smiles, int numThreads = 1); } // namespace RDKit #endif diff --git a/Code/GraphMol/FilterCatalog/FilterCatalogEntry.h b/Code/GraphMol/FilterCatalog/FilterCatalogEntry.h index 40734c85e..9fe9ec5f9 100644 --- a/Code/GraphMol/FilterCatalog/FilterCatalogEntry.h +++ b/Code/GraphMol/FilterCatalog/FilterCatalogEntry.h @@ -179,9 +179,9 @@ class RDKIT_FILTERCATALOG_EXPORT FilterCatalogEntry void clearProp(const char *key) { std::string what(key); clearProp(what); - }; + } //! \overload - void clearProp(const std::string &key) { d_props.clearVal(key); }; + void clearProp(const std::string &key) { d_props.clearVal(key); } // ------------------------------------------- //! Properties usually contain the reference and source diff --git a/Code/GraphMol/FilterCatalog/FilterMatchers.h b/Code/GraphMol/FilterCatalog/FilterMatchers.h index 3ee876598..7eeb91362 100644 --- a/Code/GraphMol/FilterCatalog/FilterMatchers.h +++ b/Code/GraphMol/FilterCatalog/FilterMatchers.h @@ -237,7 +237,7 @@ class RDKIT_FILTERCATALOG_EXPORT SmartsMatcher : public FilterMatcherBase { SmartsMatcher(const std::string &name = SMARTS_MATCH_NAME_DEFAULT) : FilterMatcherBase(name), d_pattern(), - + d_max_count(UINT_MAX) {} //! Construct a SmartsMatcher from a query molecule diff --git a/Code/GraphMol/Fingerprints/FingerprintGenerator.h b/Code/GraphMol/Fingerprints/FingerprintGenerator.h index 837dc6599..1fcf7f328 100644 --- a/Code/GraphMol/Fingerprints/FingerprintGenerator.h +++ b/Code/GraphMol/Fingerprints/FingerprintGenerator.h @@ -111,7 +111,7 @@ class RDKIT_FINGERPRINTS_EXPORT FingerprintArguments */ std::string commonArgumentsString() const; - virtual ~FingerprintArguments(){}; + virtual ~FingerprintArguments() {} }; /*! @@ -140,7 +140,7 @@ class RDKIT_FINGERPRINTS_EXPORT AtomEnvironment : private boost::noncopyable { const bool hashResults = false, const std::uint64_t fpSize = 0) const = 0; - virtual ~AtomEnvironment(){}; + virtual ~AtomEnvironment() {} }; /*! @@ -195,7 +195,7 @@ class RDKIT_FINGERPRINTS_EXPORT AtomEnvironmentGenerator */ virtual std::string infoString() const = 0; - virtual ~AtomEnvironmentGenerator(){}; + virtual ~AtomEnvironmentGenerator() {} }; /*! @@ -224,7 +224,7 @@ class RDKIT_FINGERPRINTS_EXPORT AtomInvariantsGenerator */ virtual std::string infoString() const = 0; - virtual ~AtomInvariantsGenerator(){}; + virtual ~AtomInvariantsGenerator() {} virtual AtomInvariantsGenerator *clone() const = 0; }; @@ -254,7 +254,7 @@ class RDKIT_FINGERPRINTS_EXPORT BondInvariantsGenerator */ virtual std::string infoString() const = 0; - virtual ~BondInvariantsGenerator(){}; + virtual ~BondInvariantsGenerator() {} virtual BondInvariantsGenerator *clone() const = 0; }; // namespace RDKit @@ -329,12 +329,12 @@ class RDKIT_FINGERPRINTS_EXPORT UnimplementedFPException : public std::exception { public: //! construct with an error message - UnimplementedFPException(const char *msg) : _msg(msg){}; + UnimplementedFPException(const char *msg) : _msg(msg) {} //! construct with an error message - UnimplementedFPException(const std::string &msg) : _msg(msg){}; + UnimplementedFPException(const std::string &msg) : _msg(msg) {} //! get the error message - const char *what() const noexcept override { return _msg.c_str(); }; - ~UnimplementedFPException() noexcept {}; + const char *what() const noexcept override { return _msg.c_str(); } + ~UnimplementedFPException() noexcept {} private: std::string _msg; diff --git a/Code/GraphMol/Fingerprints/FingerprintUtil.h b/Code/GraphMol/Fingerprints/FingerprintUtil.h index 77f7add7b..e3c52e6f6 100644 --- a/Code/GraphMol/Fingerprints/FingerprintUtil.h +++ b/Code/GraphMol/Fingerprints/FingerprintUtil.h @@ -88,7 +88,7 @@ class RDKIT_FINGERPRINTS_EXPORT ss_matcher { ss_matcher(); ss_matcher(const std::string &pattern); - // const RDKit::ROMOL_SPTR &getMatcher() const { return m_matcher; }; + // const RDKit::ROMOL_SPTR &getMatcher() const { return m_matcher; } const RDKit::ROMol *getMatcher() const; private: diff --git a/Code/GraphMol/Fingerprints/MHFP.h b/Code/GraphMol/Fingerprints/MHFP.h index 1bd632ffc..b7e8c7025 100644 --- a/Code/GraphMol/Fingerprints/MHFP.h +++ b/Code/GraphMol/Fingerprints/MHFP.h @@ -25,69 +25,67 @@ namespace MHFPFingerprints { const std::string mhfpFingerprintVersion = "1.0.0"; namespace FNV { - const uint32_t prime = 0x01000193; - const uint32_t seed = 0x811C9DC5; +const uint32_t prime = 0x01000193; +const uint32_t seed = 0x811C9DC5; - //! A simple implementation of the Fowler–Noll–Vo hash function. - inline uint32_t - hash(const std::string& str, uint32_t hash = seed) { - const unsigned char* ptr = (const unsigned char*)str.c_str(); - size_t len = str.length(); +//! A simple implementation of the Fowler–Noll–Vo hash function. +inline uint32_t hash(const std::string& str, uint32_t hash = seed) { + const unsigned char* ptr = (const unsigned char*)str.c_str(); + size_t len = str.length(); - while (len--) - hash = (*ptr++ ^ hash) * prime; - - return hash; - }; -} + while (len--) { + hash = (*ptr++ ^ hash) * prime; + } + + return hash; +}; +} // namespace FNV class RDKIT_FINGERPRINTS_EXPORT MHFPEncoder { -public: + public: //! Constructor /*! \brief Construct a MHFPEncoder - + The MHFPEncoder class is instantieted with a given number of permutations and a seed. Fingerprints / minhashes created with a different number of permutations or a different seed are not compatible. - - \param n_permutations the number of permutations used to create hash functions. - This will be the dimensionality of the resulting vector. - Default: 2048. + + \param n_permutations the number of permutations used to create hash + functions. This will be the dimensionality of the resulting vector. + Default: 2048. \param seed a random seed. Default: 42. */ - MHFPEncoder(unsigned int n_permutations = 2048, - unsigned int seed = 42); - + MHFPEncoder(unsigned int n_permutations = 2048, unsigned int seed = 42); + /*! \brief Creates a MinHash from a vector of strings. - - This method is exposed in order to enable advanced usage of this MHFP - implementation such as customizing the properties that are hashed in order - to create an MHFP instance. In theory, any number of values that can be - represented as strings can be minhashed. This method is called + + This method is exposed in order to enable advanced usage of this MHFP + implementation such as customizing the properties that are hashed in order + to create an MHFP instance. In theory, any number of values that can be + represented as strings can be minhashed. This method is called by MHFPEncoder::Encode. - - \param vec a vector containg strings (e.g. the smiles shingling of a molecule). + + \param vec a vector containg strings (e.g. the smiles shingling of a + molecule). \returns the MinHash of the input. */ - std::vector - FromStringArray(const std::vector& vec); + std::vector FromStringArray(const std::vector& vec); /*! \brief Creates a MinHash from a list of unsigned integers. - - This method is exposed in order to enable advanced usage of this MHFP + + This method is exposed in order to enable advanced usage of this MHFP implementation such as MinHashing a sparse array generated by another fingerprint (e.g. Morgan / ECFP). - + \param vec a vector containg unsigned integers. \returns the MinHash of the input. */ - std::vector - FromArray(const std::vector& vec); + std::vector FromArray(const std::vector& vec); /*! \brief Creates a molecular shingling based on circular substructures. @@ -98,37 +96,35 @@ public: generate 10 * 3 shingles when a radius of 3 is chosen. \param radius the maximum radius of the substructure that is generated at - each atom. Default: 3. + each atom. Default: 3. \param rings whether the rings (SSSR) are extrected from the molecule and added to the shingling. Given the molecule "C1CCCCCC1C(=O)C", "C1CCCCCC1" would be added to the shingling. Default: true. \param isomeric whether the SMILES added to the shingling are isomeric. - Default: false. + Default: false. \param kekulize whether the SMILES added to the shingling are kekulized. - Default: true. NOTE that this will throw an exception if - the molecule cannot be kekulized. + Default: true. NOTE that this will throw an exception if + the molecule cannot be kekulized. \param min_radius the minimum radius that is used to extract n-grams. - Default: 1. + Default: 1. \returns the shingling of a molecule. */ - std::vector - CreateShingling(const ROMol& mol, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1); + std::vector CreateShingling(const ROMol& mol, + unsigned char radius = 3, + bool rings = true, + bool isomeric = false, + bool kekulize = false, + unsigned char min_radius = 1); //! \overload - std::vector - CreateShingling(const std::string& smiles, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1); + std::vector CreateShingling(const std::string& smiles, + unsigned char radius = 3, + bool rings = true, + bool isomeric = false, + bool kekulize = false, + unsigned char min_radius = 1); /*! \brief Creates a MinHash vector from a molecule. @@ -139,161 +135,140 @@ public: a factor of the number of cores. \param radius the maximum radius of the substructure that is generated at - each atom. Default: 3. + each atom. Default: 3. \param rings whether the rings (SSSR) are extrected from the molecule and added to the shingling. Given the molecule "C1CCCCCC1C(=O)C", "C1CCCCCC1" would be added to the shingling. Default: true. \param isomeric whether the SMILES added to the shingling are isomeric. - Default: false. + Default: false. \param kekulize whether the SMILES added to the shingling are kekulized. - Default: true. NOTE that this will throw an exception if - the molecule cannot be kekulized. + Default: true. NOTE that this will throw an exception if + the molecule cannot be kekulized. \param min_radius the minimum radius that is used to extract n-grams. - Default: 1. + Default: 1. \returns the MHFP fingerprint. */ - std::vector - Encode(ROMol& mol, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1); + std::vector Encode(ROMol& mol, unsigned char radius = 3, + bool rings = true, bool isomeric = false, + bool kekulize = false, + unsigned char min_radius = 1); //! \overload - std::vector> - Encode(std::vector& mols, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1); + std::vector> Encode(std::vector& mols, + unsigned char radius = 3, + bool rings = true, + bool isomeric = false, + bool kekulize = false, + unsigned char min_radius = 1); //! \overload - std::vector - Encode(std::string& smiles, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1); + std::vector Encode(std::string& smiles, unsigned char radius = 3, + bool rings = true, bool isomeric = false, + bool kekulize = false, + unsigned char min_radius = 1); //! \overload - std::vector> - Encode(std::vector& smiles, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1); - + std::vector> Encode(std::vector& smiles, + unsigned char radius = 3, + bool rings = true, + bool isomeric = false, + bool kekulize = false, + unsigned char min_radius = 1); /*! \brief Creates a binary fingerprint based on circular sub-SMILES. - + Creates a binary fingerprint similar to ECFP. However, instead of using a Morgan-style hashing, circular n-grams (sub-SMILES) are created, hashed directly and folded. - + \param radius the maximum radius of the substructure that is generated at - each atom. Default: 3. + each atom. Default: 3. \param rings whether the rings (SSSR) are extrected from the molecule and - added to the shingling. Given the molecule + added to the shingling. Given the molecule "C1CCCCCC1C(=O)C", "C1CCCCCC1" would be added to the shingling. Default: true. \param isomeric whether the SMILES added to the shingling are isomeric. - Default: false. + Default: false. \param kekulize whether the SMILES added to the shingling are kekulized. - Default: true. NOTE that this will throw an exception if - the molecule cannot be kekulized. + Default: true. NOTE that this will throw an exception if + the molecule cannot be kekulized. \param min_radius the minimum radius that is used to extract n-grams. - Default: 1. + Default: 1. \param length the length into which the fingerprint is folded. - Default: 2048. + Default: 2048. \returns the SECFP fingerprint. */ - ExplicitBitVect - EncodeSECFP(ROMol& mol, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1, - size_t length = 2048); + ExplicitBitVect EncodeSECFP(ROMol& mol, unsigned char radius = 3, + bool rings = true, bool isomeric = false, + bool kekulize = false, + unsigned char min_radius = 1, + size_t length = 2048); //! \overload - std::vector - EncodeSECFP(std::vector& mols, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1, - size_t length = 2048); + std::vector EncodeSECFP( + std::vector& mols, unsigned char radius = 3, bool rings = true, + bool isomeric = false, bool kekulize = false, + unsigned char min_radius = 1, size_t length = 2048); //! \overload - ExplicitBitVect - EncodeSECFP(std::string& smiles, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1, - size_t length = 2048); + ExplicitBitVect EncodeSECFP(std::string& smiles, unsigned char radius = 3, + bool rings = true, bool isomeric = false, + bool kekulize = false, + unsigned char min_radius = 1, + size_t length = 2048); //! \overload - std::vector - EncodeSECFP(std::vector& smiles, - unsigned char radius = 3, - bool rings = true, - bool isomeric = false, - bool kekulize = false, - unsigned char min_radius = 1, - size_t length = 2048); + std::vector EncodeSECFP( + std::vector& smiles, unsigned char radius = 3, + bool rings = true, bool isomeric = false, bool kekulize = false, + unsigned char min_radius = 1, size_t length = 2048); /*! - \brief Calculates the Jaccard / Tanimoto distance between two MHFP fingerprints. - + \brief Calculates the Jaccard / Tanimoto distance between two MHFP + fingerprints. + \param a an MHFP fingerprint vector. \param b an MHFP fingerprint vector. \returns the Jaccard / Tanimoto distance between the two fingerprints. */ - static double - Distance(const std::vector& a, - const std::vector& b) { + static double Distance(const std::vector& a, + const std::vector& b) { size_t matches = 0; - for (size_t i = 0; i < a.size(); i++) - if (a[i] == b[i]) + for (size_t i = 0; i < a.size(); i++) { + if (a[i] == b[i]) { matches++; + } + } return matches / (double)a.size(); } -private: - //! The fastest mod implementation. - uint64_t - FastMod(const uint64_t input, const uint64_t ceil) { + private: + //! The fastest mod implementation. + uint64_t FastMod(const uint64_t input, const uint64_t ceil) { return input >= ceil ? input % ceil : input; } - ExplicitBitVect - Fold(const std::vector& vec, uint32_t length = 2048) { + ExplicitBitVect Fold(const std::vector& vec, + uint32_t length = 2048) { ExplicitBitVect ebv(length); - for (size_t i = 0; i < vec.size(); i++) + for (size_t i = 0; i < vec.size(); i++) { ebv.setBit(vec[i] % length); + } return ebv; } - std::vector - HashShingling(std::vector vec) { + std::vector HashShingling(std::vector vec) { std::vector result(vec.size()); - for (size_t i = 0; i < vec.size(); i++) + for (size_t i = 0; i < vec.size(); i++) { result[i] = FNV::hash(vec[i]); + } return result; } diff --git a/Code/GraphMol/Fingerprints/MorganGenerator.h b/Code/GraphMol/Fingerprints/MorganGenerator.h index bbdcb158a..82d3ee0e2 100644 --- a/Code/GraphMol/Fingerprints/MorganGenerator.h +++ b/Code/GraphMol/Fingerprints/MorganGenerator.h @@ -94,7 +94,7 @@ class RDKIT_FINGERPRINTS_EXPORT MorganBondInvGenerator std::string infoString() const; MorganBondInvGenerator *clone() const; - ~MorganBondInvGenerator(){}; + ~MorganBondInvGenerator() {} }; /** diff --git a/Code/GraphMol/Fingerprints/RDKitFPGenerator.h b/Code/GraphMol/Fingerprints/RDKitFPGenerator.h index de15a0e3e..337872e3a 100644 --- a/Code/GraphMol/Fingerprints/RDKitFPGenerator.h +++ b/Code/GraphMol/Fingerprints/RDKitFPGenerator.h @@ -93,7 +93,7 @@ class RDKIT_FINGERPRINTS_EXPORT RDKitFPAtomEnv INT_VECT bondPath) : d_bitId(bitId), d_atomsInPath(std::move(atomsInPath)), - d_bondPath(std::move(bondPath)){}; + d_bondPath(std::move(bondPath)) {} }; template @@ -158,4 +158,4 @@ RDKIT_FINGERPRINTS_EXPORT FingerprintGenerator *getRDKitFPGenerator( } // namespace RDKitFP } // namespace RDKit -#endif \ No newline at end of file +#endif diff --git a/Code/GraphMol/Fingerprints/TopologicalTorsionGenerator.h b/Code/GraphMol/Fingerprints/TopologicalTorsionGenerator.h index d00d55799..db38812a3 100644 --- a/Code/GraphMol/Fingerprints/TopologicalTorsionGenerator.h +++ b/Code/GraphMol/Fingerprints/TopologicalTorsionGenerator.h @@ -67,7 +67,7 @@ class RDKIT_FINGERPRINTS_EXPORT TopologicalTorsionAtomEnv \param bitId bitId generated for this environment */ TopologicalTorsionAtomEnv(OutputType bitId, INT_VECT atomPath) - : d_bitId(bitId), d_atomPath(std::move(atomPath)){}; + : d_bitId(bitId), d_atomPath(std::move(atomPath)) {} }; template diff --git a/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h b/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h index 7e0a2bc23..3f1d46a74 100644 --- a/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h +++ b/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h @@ -33,8 +33,7 @@ namespace CrystalFF { class RDKIT_FORCEFIELDHELPERS_EXPORT TorsionAngleContribM6 : public ForceFields::ForceFieldContrib { public: - TorsionAngleContribM6() - {}; + TorsionAngleContribM6() {} //! Constructor /*! The torsion is between atom1 - atom2 - atom3 - atom4 @@ -56,7 +55,7 @@ class RDKIT_FORCEFIELDHELPERS_EXPORT TorsionAngleContribM6 void getGrad(double *pos, double *grad) const; virtual TorsionAngleContribM6 *copy() const { return new TorsionAngleContribM6(*this); - }; + } private: int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1}, d_at4Idx{-1}; diff --git a/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionPreferences.h b/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionPreferences.h index 3ae0902cb..7ab3c8a37 100644 --- a/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionPreferences.h +++ b/Code/GraphMol/ForceFieldHelpers/CrystalFF/TorsionPreferences.h @@ -31,9 +31,8 @@ struct CrystalFFDetails { //! Get the experimental torsional angles in a molecule RDKIT_FORCEFIELDHELPERS_EXPORT void getExperimentalTorsions( const RDKit::ROMol &mol, CrystalFFDetails &details, - bool useExpTorsions = false, - bool useSmallRingTorsions = false, bool useMacrocycleTorsions = false, - bool useBasicKnowledge = false, + bool useExpTorsions = false, bool useSmallRingTorsions = false, + bool useMacrocycleTorsions = false, bool useBasicKnowledge = false, unsigned int version = 1, bool verbose = false); } // namespace CrystalFF } // namespace ForceFields diff --git a/Code/GraphMol/ForceFieldHelpers/FFConvenience.h b/Code/GraphMol/ForceFieldHelpers/FFConvenience.h index b06b4f199..52950bdcf 100644 --- a/Code/GraphMol/ForceFieldHelpers/FFConvenience.h +++ b/Code/GraphMol/ForceFieldHelpers/FFConvenience.h @@ -19,12 +19,13 @@ namespace ForceFieldsHelper { namespace detail { #ifdef RDK_THREADSAFE_SSS void OptimizeMoleculeConfsHelper_(ForceFields::ForceField ff, ROMol *mol, - std::vector> *res, - unsigned int threadIdx, - unsigned int numThreads, int maxIters) { + std::vector> *res, + unsigned int threadIdx, + unsigned int numThreads, int maxIters) { PRECONDITION(mol, "mol must not be nullptr"); PRECONDITION(res, "res must not be nullptr"); - PRECONDITION(res->size() >= mol->getNumConformers(), "res->size() must be >= mol->getNumConformers()"); + PRECONDITION(res->size() >= mol->getNumConformers(), + "res->size() must be >= mol->getNumConformers()"); unsigned int i = 0; ff.positions().resize(mol->getNumAtoms()); for (ROMol::ConformerIterator cit = mol->beginConformers(); @@ -41,12 +42,12 @@ void OptimizeMoleculeConfsHelper_(ForceFields::ForceField ff, ROMol *mol, } void OptimizeMoleculeConfsMT(ROMol &mol, const ForceFields::ForceField &ff, - std::vector> &res, - int numThreads, int maxIters) { + std::vector> &res, + int numThreads, int maxIters) { std::vector tg; for (int ti = 0; ti < numThreads; ++ti) { - tg.emplace_back(std::thread(detail::OptimizeMoleculeConfsHelper_, - ff, &mol, &res, ti, numThreads, maxIters)); + tg.emplace_back(std::thread(detail::OptimizeMoleculeConfsHelper_, ff, &mol, + &res, ti, numThreads, maxIters)); } for (auto &thread : tg) { if (thread.joinable()) thread.join(); @@ -55,9 +56,10 @@ void OptimizeMoleculeConfsMT(ROMol &mol, const ForceFields::ForceField &ff, #endif void OptimizeMoleculeConfsST(ROMol &mol, ForceFields::ForceField &ff, - std::vector> &res, - int maxIters) { - PRECONDITION(res.size() >= mol.getNumConformers(), "res.size() must be >= mol.getNumConformers()"); + std::vector> &res, + int maxIters) { + PRECONDITION(res.size() >= mol.getNumConformers(), + "res.size() must be >= mol.getNumConformers()"); unsigned int i = 0; for (ROMol::ConformerIterator cit = mol.beginConformers(); cit != mol.endConformers(); ++cit, ++i) { @@ -70,9 +72,10 @@ void OptimizeMoleculeConfsST(ROMol &mol, ForceFields::ForceField &ff, res[i] = std::make_pair(needsMore, e); } } -} // end of detail namespace +} // namespace detail -//! Convenience function for optimizing a molecule using a pre-generated force-field +//! Convenience function for optimizing a molecule using a pre-generated +//! force-field /* \param ff the force-field \param res vector of (needsMore,energy) pairs @@ -83,7 +86,8 @@ void OptimizeMoleculeConfsST(ROMol &mol, ForceFields::ForceField &ff, more iterations are required. second: the energy */ -std::pair OptimizeMolecule(ForceFields::ForceField &ff, int maxIters = 1000) { +std::pair OptimizeMolecule(ForceFields::ForceField &ff, + int maxIters = 1000) { ff.initialize(); int res = ff.minimize(maxIters); double e = ff.calcEnergy(); @@ -104,8 +108,8 @@ std::pair OptimizeMolecule(ForceFields::ForceField &ff, int maxIter */ void OptimizeMoleculeConfs(ROMol &mol, ForceFields::ForceField &ff, - std::vector> &res, - int numThreads = 1, int maxIters = 1000) { + std::vector> &res, + int numThreads = 1, int maxIters = 1000) { res.resize(mol.getNumConformers()); numThreads = getNumThreadsToUse(numThreads); if (numThreads == 1) { diff --git a/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h b/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h index a14e21b5b..71ff2fa3a 100644 --- a/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h +++ b/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h @@ -26,29 +26,39 @@ class Atom; class Bond; namespace MMFF { - + namespace DefaultParameters { -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFPropCollection *getMMFFProp(); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFAromCollection *getMMFFArom(); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFDefCollection *getMMFFDef(); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFHerschbachLaurieCollection * - getMMFFHerschbachLaurie(); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFPBCICollection *getMMFFPBCI(); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFAngleCollection *getMMFFAngle(); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFStbnCollection *getMMFFStbn(); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFDfsbCollection *getMMFFDfsb(); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFTorCollection *getMMFFTor(const bool isMMFFs); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFOopCollection *getMMFFOop(const bool isMMFFs); -RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFVdWCollection *getMMFFVdW(); -} - +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFPropCollection * +getMMFFProp(); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFAromCollection * +getMMFFArom(); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFDefCollection * +getMMFFDef(); +RDKIT_FORCEFIELDHELPERS_EXPORT const + ForceFields::MMFF::MMFFHerschbachLaurieCollection * + getMMFFHerschbachLaurie(); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFPBCICollection * +getMMFFPBCI(); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFAngleCollection * +getMMFFAngle(); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFStbnCollection * +getMMFFStbn(); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFDfsbCollection * +getMMFFDfsb(); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFTorCollection * +getMMFFTor(const bool isMMFFs); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFOopCollection * +getMMFFOop(const bool isMMFFs); +RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFVdWCollection * +getMMFFVdW(); +} // namespace DefaultParameters + class RingMembershipSize; using namespace ForceFields::MMFF; class RDKIT_FORCEFIELDHELPERS_EXPORT MMFFAtomProperties { public: - MMFFAtomProperties() - {}; - ~MMFFAtomProperties(){}; + MMFFAtomProperties() {} + ~MMFFAtomProperties() {} std::uint8_t mmffAtomType{0}; double mmffFormalCharge{0.0}; double mmffPartialCharge{0.0}; @@ -66,7 +76,7 @@ class RDKIT_FORCEFIELDHELPERS_EXPORT MMFFMolProperties { MMFFMolProperties(ROMol &mol, const std::string &mmffVariant = "MMFF94", std::uint8_t verbosity = MMFF_VERBOSITY_NONE, std::ostream &oStream = std::cout); - ~MMFFMolProperties(){}; + ~MMFFMolProperties() {} unsigned int getMMFFBondType(const Bond *bond); unsigned int getMMFFAngleType(const ROMol &mol, const unsigned int idx1, const unsigned int idx2, @@ -83,64 +93,63 @@ class RDKIT_FORCEFIELDHELPERS_EXPORT MMFFMolProperties { URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size()); return this->d_MMFFAtomPropertiesPtrVect[idx]->mmffAtomType; - }; + } double getMMFFFormalCharge(const unsigned int idx) { URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size()); return this->d_MMFFAtomPropertiesPtrVect[idx]->mmffFormalCharge; - }; + } double getMMFFPartialCharge(const unsigned int idx) { URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size()); return this->d_MMFFAtomPropertiesPtrVect[idx]->mmffPartialCharge; - }; - void setMMFFBondTerm(const bool state) { this->d_bondTerm = state; }; - bool getMMFFBondTerm() { return this->d_bondTerm; }; - void setMMFFAngleTerm(const bool state) { this->d_angleTerm = state; }; - bool getMMFFAngleTerm() { return this->d_angleTerm; }; + } + void setMMFFBondTerm(const bool state) { this->d_bondTerm = state; } + bool getMMFFBondTerm() { return this->d_bondTerm; } + void setMMFFAngleTerm(const bool state) { this->d_angleTerm = state; } + bool getMMFFAngleTerm() { return this->d_angleTerm; } void setMMFFStretchBendTerm(const bool state) { this->d_stretchBendTerm = state; - }; - bool getMMFFStretchBendTerm() { return this->d_stretchBendTerm; }; - void setMMFFOopTerm(const bool state) { this->d_oopTerm = state; }; - bool getMMFFOopTerm() { return this->d_oopTerm; }; - void setMMFFTorsionTerm(const bool state) { this->d_torsionTerm = state; }; - bool getMMFFTorsionTerm() { return this->d_torsionTerm; }; - void setMMFFVdWTerm(const bool state) { this->d_vdWTerm = state; }; - bool getMMFFVdWTerm() { return this->d_vdWTerm; }; - void setMMFFEleTerm(const bool state) { this->d_eleTerm = state; }; - bool getMMFFEleTerm() { return this->d_eleTerm; }; + } + bool getMMFFStretchBendTerm() { return this->d_stretchBendTerm; } + void setMMFFOopTerm(const bool state) { this->d_oopTerm = state; } + bool getMMFFOopTerm() { return this->d_oopTerm; } + void setMMFFTorsionTerm(const bool state) { this->d_torsionTerm = state; } + bool getMMFFTorsionTerm() { return this->d_torsionTerm; } + void setMMFFVdWTerm(const bool state) { this->d_vdWTerm = state; } + bool getMMFFVdWTerm() { return this->d_vdWTerm; } + void setMMFFEleTerm(const bool state) { this->d_eleTerm = state; } + bool getMMFFEleTerm() { return this->d_eleTerm; } void setMMFFVariant(const std::string &mmffVariant) { PRECONDITION((mmffVariant == "MMFF94") || (mmffVariant == "MMFF94s"), "bad MMFF variant"); this->d_mmffs = ((mmffVariant == "MMFF94s") ? true : false); - }; + } const std::string getMMFFVariant() { return (this->d_mmffs ? "MMFF94s" : "MMFF94"); - }; + } void setMMFFDielectricConstant(const double dielConst) { PRECONDITION(dielConst > 0.0, "bad dielectric constant"); this->d_dielConst = dielConst; - }; - double getMMFFDielectricConstant() { return this->d_dielConst; }; + } + double getMMFFDielectricConstant() { return this->d_dielConst; } void setMMFFDielectricModel(std::uint8_t dielModel) { this->d_dielModel = dielModel; - }; - std::uint8_t getMMFFDielectricModel() { return this->d_dielModel; }; + } + std::uint8_t getMMFFDielectricModel() { return this->d_dielModel; } void setMMFFVerbosity(std::uint8_t verbosity) { this->d_verbosity = verbosity; - }; - std::uint8_t getMMFFVerbosity() { return this->d_verbosity; }; - void setMMFFOStream(std::ostream *oStream) { this->d_oStream = oStream; }; - std::ostream &getMMFFOStream() { return *(this->d_oStream); }; - bool isValid() { return d_valid; }; + } + std::uint8_t getMMFFVerbosity() { return this->d_verbosity; } + void setMMFFOStream(std::ostream *oStream) { this->d_oStream = oStream; } + std::ostream &getMMFFOStream() { return *(this->d_oStream); } + bool isValid() { return d_valid; } bool getMMFFBondStretchParams(const ROMol &mol, const unsigned int idx1, const unsigned int idx2, unsigned int &bondType, MMFFBond &mmffBondStretchParams); - bool getMMFFAngleBendParams(const ROMol &mol, - const unsigned int idx1, + bool getMMFFAngleBendParams(const ROMol &mol, const unsigned int idx1, const unsigned int idx2, const unsigned int idx3, unsigned int &angleType, MMFFAngle &mmffAngleBendParams); @@ -169,12 +178,12 @@ class RDKIT_FORCEFIELDHELPERS_EXPORT MMFFMolProperties { URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size()); this->d_MMFFAtomPropertiesPtrVect[idx]->mmffFormalCharge = fChg; - }; + } void setMMFFPartialCharge(const unsigned int idx, const double pChg) { URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size()); this->d_MMFFAtomPropertiesPtrVect[idx]->mmffPartialCharge = pChg; - }; + } bool d_valid; bool d_mmffs; bool d_bondTerm; diff --git a/Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h b/Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h index 2c2bd3578..8fcaab437 100644 --- a/Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h +++ b/Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h @@ -87,9 +87,11 @@ void MMFFOptimizeMoleculeConfs(ROMol &mol, bool ignoreInterfragInteractions = true) { MMFF::MMFFMolProperties mmffMolProperties(mol, mmffVariant); if (mmffMolProperties.isValid()) { - ForceFields::ForceField *ff = MMFF::constructForceField( - mol, &mmffMolProperties, nonBondedThresh, -1, ignoreInterfragInteractions); - ForceFieldsHelper::OptimizeMoleculeConfs(mol, *ff, res, numThreads, maxIters); + ForceFields::ForceField *ff = + MMFF::constructForceField(mol, &mmffMolProperties, nonBondedThresh, -1, + ignoreInterfragInteractions); + ForceFieldsHelper::OptimizeMoleculeConfs(mol, *ff, res, numThreads, + maxIters); delete ff; } else { res.resize(mol.getNumConformers()); diff --git a/Code/GraphMol/ForceFieldHelpers/UFF/UFF.h b/Code/GraphMol/ForceFieldHelpers/UFF/UFF.h index 210465813..8349df294 100644 --- a/Code/GraphMol/ForceFieldHelpers/UFF/UFF.h +++ b/Code/GraphMol/ForceFieldHelpers/UFF/UFF.h @@ -42,7 +42,8 @@ std::pair UFFOptimizeMolecule( bool ignoreInterfragInteractions = true) { ForceFields::ForceField *ff = UFF::constructForceField( mol, vdwThresh, confId, ignoreInterfragInteractions); - std::pair res = ForceFieldsHelper::OptimizeMolecule(*ff, maxIters); + std::pair res = + ForceFieldsHelper::OptimizeMolecule(*ff, maxIters); delete ff; return res; } @@ -71,8 +72,8 @@ void UFFOptimizeMoleculeConfs(ROMol &mol, int numThreads = 1, int maxIters = 1000, double vdwThresh = 10.0, bool ignoreInterfragInteractions = true) { - ForceFields::ForceField *ff = UFF::constructForceField( - mol, vdwThresh, -1, ignoreInterfragInteractions); + ForceFields::ForceField *ff = + UFF::constructForceField(mol, vdwThresh, -1, ignoreInterfragInteractions); ForceFieldsHelper::OptimizeMoleculeConfs(mol, *ff, res, numThreads, maxIters); delete ff; } diff --git a/Code/GraphMol/FragCatalog/FragCatalogEntry.h b/Code/GraphMol/FragCatalog/FragCatalogEntry.h index 6e317b1da..32ac2a34d 100644 --- a/Code/GraphMol/FragCatalog/FragCatalogEntry.h +++ b/Code/GraphMol/FragCatalog/FragCatalogEntry.h @@ -27,7 +27,7 @@ namespace RDKit { class RDKIT_FRAGCATALOG_EXPORT FragCatalogEntry : public RDCatalog::CatalogEntry { public: - FragCatalogEntry() : d_descrip("") { + FragCatalogEntry() : d_descrip("") { dp_props = new Dict(); setBitId(-1); } diff --git a/Code/GraphMol/MolAlign/AlignMolecules.h b/Code/GraphMol/MolAlign/AlignMolecules.h index df080cb0b..7256aa4ca 100644 --- a/Code/GraphMol/MolAlign/AlignMolecules.h +++ b/Code/GraphMol/MolAlign/AlignMolecules.h @@ -24,12 +24,12 @@ namespace MolAlign { class RDKIT_MOLALIGN_EXPORT MolAlignException : public std::exception { public: //! construct with an error message - MolAlignException(const char *msg) : _msg(msg){}; + MolAlignException(const char *msg) : _msg(msg) {} //! construct with an error message - MolAlignException(const std::string msg) : _msg(msg){}; + MolAlignException(const std::string msg) : _msg(msg) {} //! get the error message - const char *what() const noexcept override { return _msg.c_str(); }; - ~MolAlignException() noexcept {}; + const char *what() const noexcept override { return _msg.c_str(); } + ~MolAlignException() noexcept {} private: std::string _msg; diff --git a/Code/GraphMol/MolAlign/O3AAlignMolecules.h b/Code/GraphMol/MolAlign/O3AAlignMolecules.h index 5774cf77f..11da4a702 100644 --- a/Code/GraphMol/MolAlign/O3AAlignMolecules.h +++ b/Code/GraphMol/MolAlign/O3AAlignMolecules.h @@ -68,8 +68,8 @@ class RDKIT_MOLALIGN_EXPORT O3AConstraint { //! they were appended. class RDKIT_MOLALIGN_EXPORT O3AConstraintVect { public: - O3AConstraintVect() {}; - ~O3AConstraintVect(){}; + O3AConstraintVect() {} + ~O3AConstraintVect() {} void append(unsigned int prbIdx, unsigned int refIdx, double weight) { O3AConstraint *o3aConstraint = new O3AConstraint(); o3aConstraint->d_idx = d_count; @@ -100,7 +100,7 @@ class RDKIT_MOLALIGN_EXPORT O3AConstraintVect { ? (a->d_refIdx < b->d_refIdx) : ((a->d_weight != b->d_weight) ? (a->d_weight > b->d_weight) : (a->d_idx < b->d_idx)))); - }; + } }; const int O3_DUMMY_COST = 100000; @@ -131,7 +131,7 @@ enum { class RDKIT_MOLALIGN_EXPORT MolHistogram { public: MolHistogram(const ROMol &mol, const double *dmat, bool cleanupDmat = false); - ~MolHistogram(){}; + ~MolHistogram() {} inline int get(const unsigned int y, const unsigned int x) const { PRECONDITION(y < d_h.shape()[0], "Invalid index on MolHistogram"); PRECONDITION(x < d_h.shape()[1], "Invalid index on MolHistogram"); @@ -153,8 +153,8 @@ class RDKIT_MOLALIGN_EXPORT LAP { d_d(dim), d_v(dim), d_pred(dim), - d_cost(boost::extents[dim][dim]){}; - ~LAP(){}; + d_cost(boost::extents[dim][dim]) {} + ~LAP() {} int getCost(const unsigned int i, const unsigned int j) { PRECONDITION(i < d_cost.shape()[0], "Invalid index on LAP.cost"); PRECONDITION(j < d_cost.shape()[1], "Invalid index on LAP.cost"); @@ -191,7 +191,7 @@ class RDKIT_MOLALIGN_EXPORT SDM { O3AConstraintVect *o3aConstraintVect = nullptr) : d_prbConf(prbConf), d_refConf(refConf), - d_o3aConstraintVect(o3aConstraintVect){}; + d_o3aConstraintVect(o3aConstraintVect) {} // copy constructor SDM(const SDM &other) : d_prbConf(other.d_prbConf), @@ -203,7 +203,7 @@ class RDKIT_MOLALIGN_EXPORT SDM { memcpy(d_SDMPtrVect[i].get(), other.d_SDMPtrVect[i].get(), sizeof(SDMElement)); } - }; + } // assignment operator SDM &operator=(const SDM &other) { if (this == &other) return *this; @@ -218,9 +218,9 @@ class RDKIT_MOLALIGN_EXPORT SDM { } return *this; - }; + } // destructor - ~SDM(){}; + ~SDM() {} void fillFromDist(double threshold, const boost::dynamic_bitset<> &refHvyAtoms, const boost::dynamic_bitset<> &prbHvyAtoms); @@ -255,7 +255,7 @@ class RDKIT_MOLALIGN_EXPORT SDM { ? (a->cost < b->cost) : ((a->idx[0] != b->idx[0]) ? (a->idx[0] < b->idx[0]) : (a->idx[1] < b->idx[1])))); - }; + } static bool compareSDMDist(boost::shared_ptr a, boost::shared_ptr b) { double aWeight = (a->o3aConstraint ? a->o3aConstraint->getWeight() : 0.0); @@ -266,7 +266,7 @@ class RDKIT_MOLALIGN_EXPORT SDM { ? (a->sqDist < b->sqDist) : ((a->idx[0] != b->idx[0]) ? (a->idx[0] < b->idx[0]) : (a->idx[1] < b->idx[1])))); - }; + } }; class RDKIT_MOLALIGN_EXPORT O3A { @@ -298,12 +298,12 @@ class RDKIT_MOLALIGN_EXPORT O3A { if (d_o3aWeights) { delete d_o3aWeights; } - }; + } double align(); double trans(RDGeom::Transform3D &trans); - double score() { return d_o3aScore; }; - const RDKit::MatchVectType *matches() { return d_o3aMatchVect; }; - const RDNumeric::DoubleVector *weights() { return d_o3aWeights; }; + double score() { return d_o3aScore; } + const RDKit::MatchVectType *matches() { return d_o3aMatchVect; } + const RDNumeric::DoubleVector *weights() { return d_o3aWeights; } private: ROMol *d_prbMol; diff --git a/Code/GraphMol/MolBundle.h b/Code/GraphMol/MolBundle.h index c2c3e0547..ae0517666 100644 --- a/Code/GraphMol/MolBundle.h +++ b/Code/GraphMol/MolBundle.h @@ -38,18 +38,18 @@ class ROMol; */ class MolBundle : public RDProps { public: - MolBundle() : RDProps(){}; + MolBundle() : RDProps() {} //! copy constructor - MolBundle(const MolBundle &other) : RDProps(other) { d_mols = other.d_mols; }; + MolBundle(const MolBundle &other) : RDProps(other) { d_mols = other.d_mols; } // FIX: need serialization/deserialization - virtual ~MolBundle(){}; + virtual ~MolBundle() {} //! returns our molecules virtual const std::vector> &getMols() const { return d_mols; - }; + } //! adds a new molecule and returns the total number of molecules virtual size_t addMol(boost::shared_ptr nmol) { @@ -58,16 +58,16 @@ class MolBundle : public RDProps { return (d_mols.size()); } //! returns the number of molecules from the bundle - virtual size_t size() const { return d_mols.size(); }; + virtual size_t size() const { return d_mols.size(); } //! returns a particular molecule in the bundle virtual const boost::shared_ptr getMol(size_t idx) const { if (idx >= d_mols.size()) throw IndexErrorException(static_cast(idx)); return d_mols[idx]; - }; + } //! returns a particular molecule from the bundle virtual const boost::shared_ptr operator[](size_t idx) const { return getMol(idx); - }; + } protected: std::vector> d_mols; @@ -86,13 +86,13 @@ class MolBundle : public RDProps { */ class FixedMolSizeMolBundle : public MolBundle { public: - FixedMolSizeMolBundle() : MolBundle(){}; + FixedMolSizeMolBundle() : MolBundle() {} //! copy constructor FixedMolSizeMolBundle(const FixedMolSizeMolBundle &other) - : MolBundle(other){}; + : MolBundle(other) {} - ~FixedMolSizeMolBundle() override{}; + ~FixedMolSizeMolBundle() override {} //! adds a new molecule and returns the total number of molecules //! enforces that the new molecule has the same number of atoms and bonds diff --git a/Code/GraphMol/MolCatalog/MolCatalogEntry.h b/Code/GraphMol/MolCatalog/MolCatalogEntry.h index fd46986fd..2c83c9567 100644 --- a/Code/GraphMol/MolCatalog/MolCatalogEntry.h +++ b/Code/GraphMol/MolCatalog/MolCatalogEntry.h @@ -16,7 +16,7 @@ class ROMol; //! This class is used to store ROMol objects in a MolCatalog class RDKIT_MOLCATALOG_EXPORT MolCatalogEntry : public RDCatalog::CatalogEntry { public: - MolCatalogEntry() : d_descrip("") { + MolCatalogEntry() : d_descrip("") { dp_props = new Dict(); setBitId(-1); } @@ -39,10 +39,10 @@ class RDKIT_MOLCATALOG_EXPORT MolCatalogEntry : public RDCatalog::CatalogEntry { void setDescription(std::string val) { d_descrip = val; } - unsigned int getOrder() const { return d_order; }; - void setOrder(unsigned int order) { d_order = order; }; + unsigned int getOrder() const { return d_order; } + void setOrder(unsigned int order) { d_order = order; } - const ROMol *getMol() const { return dp_mol; }; + const ROMol *getMol() const { return dp_mol; } //! hold the provided ROMol /*! The MolCatalogEntry takes ownership of the pointer. diff --git a/Code/GraphMol/MolChemicalFeatures/FeatureParser.h b/Code/GraphMol/MolChemicalFeatures/FeatureParser.h index f9b57f8d0..3743c0ef8 100644 --- a/Code/GraphMol/MolChemicalFeatures/FeatureParser.h +++ b/Code/GraphMol/MolChemicalFeatures/FeatureParser.h @@ -24,11 +24,11 @@ class RDKIT_MOLCHEMICALFEATURES_EXPORT FeatureFileParseException public: FeatureFileParseException(unsigned int lineNo, std::string line, std::string msg) - : d_lineNo(lineNo), d_line(line), d_msg(msg){}; - unsigned int lineNo() const { return d_lineNo; }; - std::string line() const { return d_line; }; - const char *what() const noexcept override { return d_msg.c_str(); }; - ~FeatureFileParseException() noexcept {}; + : d_lineNo(lineNo), d_line(line), d_msg(msg) {} + unsigned int lineNo() const { return d_lineNo; } + std::string line() const { return d_line; } + const char *what() const noexcept override { return d_msg.c_str(); } + ~FeatureFileParseException() noexcept {} private: unsigned int d_lineNo; diff --git a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeature.h b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeature.h index 79be245a4..c649d2ea4 100644 --- a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeature.h +++ b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeature.h @@ -38,7 +38,7 @@ class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeature dp_factory(factory), dp_def(fdef), d_id(id), - d_activeConf(-1){}; + d_activeConf(-1) {} ~MolChemicalFeature() {} @@ -54,14 +54,14 @@ class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeature //! from the requested conformation from the associated molecule) RDGeom::Point3D getPos(int confId) const; //! \brief return a pointer to our feature factory - const MolChemicalFeatureFactory *getFactory() const { return dp_factory; }; + const MolChemicalFeatureFactory *getFactory() const { return dp_factory; } //! \brief return a pointer to our associated molecule - const ROMol *getMol() const { return dp_mol; }; + const ROMol *getMol() const { return dp_mol; } //! \brief return a pointer to our feature definition - const MolChemicalFeatureDef *getFeatDef() const { return dp_def; }; + const MolChemicalFeatureDef *getFeatDef() const { return dp_def; } //! \brief returns the active conformer (in the associated molecule) - int getId() const { return d_id; }; + int getId() const { return d_id; } //! \brief returns the number of atoms defining the feature inline unsigned int getNumAtoms() const { return d_atoms.size(); } @@ -70,17 +70,17 @@ class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeature void setActiveConformer(int confId); //! \brief returns the active conformer (in the associated molecule) - int getActiveConformer() const { return d_activeConf; }; + int getActiveConformer() const { return d_activeConf; } //! \brief clears out the internal position cache - void clearCache() { d_locs.clear(); }; + void clearCache() { d_locs.clear(); } //! \brief returns our atom container of const AtomPtrContainer &getAtoms() const { return d_atoms; } AtomPtrContainer::const_iterator beginAtoms() const { return d_atoms.begin(); - }; - AtomPtrContainer::const_iterator endAtoms() const { return d_atoms.end(); }; + } + AtomPtrContainer::const_iterator endAtoms() const { return d_atoms.end(); } private: typedef std::map PointCacheType; diff --git a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h index 2a3c378ed..41a95eea4 100644 --- a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h +++ b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h @@ -26,20 +26,20 @@ class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeatureDef { public: typedef std::list> CollectionType; - MolChemicalFeatureDef() : d_family(""), d_type(""), d_smarts(""){}; + MolChemicalFeatureDef() : d_family(""), d_type(""), d_smarts("") {} MolChemicalFeatureDef(const std::string &smarts, std::string family, std::string type); - unsigned int getNumWeights() const { return d_weights.size(); }; - std::vector::iterator beginWeights() { return d_weights.begin(); }; - std::vector::iterator endWeights() { return d_weights.end(); }; + unsigned int getNumWeights() const { return d_weights.size(); } + std::vector::iterator beginWeights() { return d_weights.begin(); } + std::vector::iterator endWeights() { return d_weights.end(); } std::vector::const_iterator beginWeights() const { return d_weights.begin(); - }; + } std::vector::const_iterator endWeights() const { return d_weights.end(); - }; + } void setWeights(const std::vector &weights) { d_weights.insert(d_weights.begin(), weights.begin(), weights.end()); @@ -49,13 +49,13 @@ class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeatureDef { } } - const std::string &getFamily() const { return d_family; }; - const std::string &getType() const { return d_type; }; - const std::string &getSmarts() const { return d_smarts; }; + const std::string &getFamily() const { return d_family; } + const std::string &getType() const { return d_type; } + const std::string &getSmarts() const { return d_smarts; } void normalizeWeights(); - const ROMol *getPattern() const { return dp_pattern.get(); }; + const ROMol *getPattern() const { return dp_pattern.get(); } private: std::string d_family; diff --git a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureFactory.h b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureFactory.h index dbfa2427f..e0aced301 100644 --- a/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureFactory.h +++ b/Code/GraphMol/MolChemicalFeatures/MolChemicalFeatureFactory.h @@ -25,26 +25,26 @@ typedef FeatSPtrList::iterator FeatSPtrList_I; class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeatureFactory { public: //! returns the number of feature definitions - int getNumFeatureDefs() const { return d_featDefs.size(); }; + int getNumFeatureDefs() const { return d_featDefs.size(); } //! returns an iterator referring to the first feature definition MolChemicalFeatureDef::CollectionType::iterator beginFeatureDefs() { return d_featDefs.begin(); - }; + } //! returns an iterator referring to the end of the feature definitions MolChemicalFeatureDef::CollectionType::iterator endFeatureDefs() { return d_featDefs.end(); - }; + } //! returns a const_iterator referring to the first feature definition MolChemicalFeatureDef::CollectionType::const_iterator beginFeatureDefs() const { return d_featDefs.begin(); - }; + } //! returns a const_iterator referring to the end of the feature definitions MolChemicalFeatureDef::CollectionType::const_iterator endFeatureDefs() const { return d_featDefs.end(); - }; + } //! appends a feature definition to the collection of features defs. void addFeatureDef( diff --git a/Code/GraphMol/MolDraw2D/MolDraw2D.h b/Code/GraphMol/MolDraw2D/MolDraw2D.h index 75845256f..9503b141c 100644 --- a/Code/GraphMol/MolDraw2D/MolDraw2D.h +++ b/Code/GraphMol/MolDraw2D/MolDraw2D.h @@ -46,7 +46,7 @@ struct DrawColour { double r = 0.0, g = 0.0, b = 0.0, a = 1.0; DrawColour() = default; DrawColour(double r, double g, double b, double a = 1.0) - : r(r), g(g), b(b), a(a){}; + : r(r), g(g), b(b), a(a) {} bool operator==(const DrawColour &other) const { return r == other.r && g == other.g && b == other.b && a == other.a; } @@ -55,7 +55,7 @@ struct DrawColour { return fabs(r - other.r) <= tol && fabs(g - other.g) <= tol && fabs(b - other.b) <= tol && (ignoreAlpha || fabs(a - other.a) <= tol); - }; + } DrawColour operator+(const DrawColour &other) const { return {r + other.r, g + other.g, b + other.b, a + other.a}; } @@ -307,9 +307,10 @@ struct RDKIT_MOLDRAW2D_EXPORT MolDrawOptions { false; // if all specified stereocenters are in a single StereoGroup, // show a molecule-level annotation instead of the individual // labels - bool singleColourWedgeBonds = false; // if true wedged and dashed bonds are drawn - // using symbolColour rather than inheriting - // their colour from the atoms + bool singleColourWedgeBonds = + false; // if true wedged and dashed bonds are drawn + // using symbolColour rather than inheriting + // their colour from the atoms MolDrawOptions() { highlightColourPalette.emplace_back( @@ -329,7 +330,7 @@ struct RDKIT_MOLDRAW2D_EXPORT MolDrawOptions { DrawColour(.56, .93, .56)); // light green highlightColourPalette.emplace_back(DrawColour(.20, .63, .79)); // peacock assignDefaultPalette(atomColourPalette); - }; + } }; //! MolDraw2D is the base class for doing 2D renderings of molecules @@ -634,7 +635,7 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2D { const DrawColour &col1, const DrawColour &col2); //! adds additional information about the atoms to the output. Does not make //! sense for all renderers. - virtual void tagAtoms(const ROMol &mol) { RDUNUSED_PARAM(mol); }; + virtual void tagAtoms(const ROMol &mol) { RDUNUSED_PARAM(mol); } //! set whether or not polygons are being filled virtual bool fillPolys() const { return fill_polys_; } //! returns either or not polygons should be filled @@ -650,12 +651,12 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2D { const std::vector &atomCoords() const { PRECONDITION(activeMolIdx_ >= 0, "no index"); return at_cds_[activeMolIdx_]; - }; + } //! returns the atomic symbols of the current molecule const std::vector> &atomSyms() const { PRECONDITION(activeMolIdx_ >= 0, "no index"); return atom_syms_[activeMolIdx_]; - }; + } //! Draw an arrow with either lines or a filled head (when asPolygon is true) virtual void drawArrow(const Point2D &cds1, const Point2D &cds2, bool asPolygon = false, double frac = 0.05, @@ -860,10 +861,10 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2D { virtual void updateMetadata(const ROMol &mol, int confId) { RDUNUSED_PARAM(mol); RDUNUSED_PARAM(confId); - }; + } virtual void updateMetadata(const ChemicalReaction &rxn) { RDUNUSED_PARAM(rxn); - }; + } protected: std::vector> d_metadata; diff --git a/Code/GraphMol/MolDraw2D/MolDraw2DCairo.h b/Code/GraphMol/MolDraw2D/MolDraw2DCairo.h index 285688599..9f0fe0e76 100644 --- a/Code/GraphMol/MolDraw2D/MolDraw2DCairo.h +++ b/Code/GraphMol/MolDraw2D/MolDraw2DCairo.h @@ -34,7 +34,7 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2DCairo : public MolDraw2D { cairo_reference(dp_cr); initDrawing(); initTextDrawer(noFreetype); - }; + } MolDraw2DCairo(int width, int height, int panelWidth = -1, int panelHeight = -1, bool noFreetype = false) : MolDraw2D(width, height, panelWidth, panelHeight) { @@ -44,7 +44,7 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2DCairo : public MolDraw2D { cairo_surface_destroy(surf); // dp_cr has a reference to this now; initDrawing(); initTextDrawer(noFreetype); - }; + } ~MolDraw2DCairo() { if (dp_cr) { if (cairo_get_reference_count(dp_cr) > 0) { diff --git a/Code/GraphMol/MolDraw2D/MolDraw2DJS.h b/Code/GraphMol/MolDraw2D/MolDraw2DJS.h index 4237381ed..3644ed5c7 100644 --- a/Code/GraphMol/MolDraw2D/MolDraw2DJS.h +++ b/Code/GraphMol/MolDraw2D/MolDraw2DJS.h @@ -37,7 +37,7 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2DJS : public MolDraw2D { : MolDraw2D(width, height, panelWidth, panelHeight), d_context(context) { initDrawing(); initTextDrawer(noFreetype); - }; + } void drawLine(const Point2D &cds1, const Point2D &cds2) override; void drawPolygon(const std::vector &cds) override; diff --git a/Code/GraphMol/MolDraw2D/MolDraw2DSVG.h b/Code/GraphMol/MolDraw2D/MolDraw2DSVG.h index c6472e485..ac85e9664 100644 --- a/Code/GraphMol/MolDraw2D/MolDraw2DSVG.h +++ b/Code/GraphMol/MolDraw2D/MolDraw2DSVG.h @@ -33,7 +33,7 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2DSVG : public MolDraw2D { : MolDraw2D(width, height, panelWidth, panelHeight), d_os(os) { initDrawing(); initTextDrawer(noFreetype); - }; + } // initialize to use the internal stringstream MolDraw2DSVG(int width, int height, int panelWidth = -1, int panelHeight = -1, @@ -41,7 +41,7 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2DSVG : public MolDraw2D { : MolDraw2D(width, height, panelWidth, panelHeight), d_os(d_ss) { initDrawing(); initTextDrawer(noFreetype); - }; + } void setColour(const DrawColour &col) override; @@ -61,7 +61,7 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2DSVG : public MolDraw2D { double vertOffset = 0.05) override; // this only makes sense if the object was initialized without a stream - std::string getDrawingText() const { return d_ss.str(); }; + std::string getDrawingText() const { return d_ss.str(); } // adds additional tags to the atoms and bonds in the SVG. This should be // invoked *after* the molecule has been drawn diff --git a/Code/GraphMol/MolDraw2D/MolDraw2Dwx.h b/Code/GraphMol/MolDraw2D/MolDraw2Dwx.h index 8fb864124..4ab9c9f4c 100644 --- a/Code/GraphMol/MolDraw2D/MolDraw2Dwx.h +++ b/Code/GraphMol/MolDraw2D/MolDraw2Dwx.h @@ -77,7 +77,7 @@ class RDKIT_MOLDRAW2D_EXPORT MolDraw2Dwx : public MolDraw2D { } // FIX: deal with toggling fills m_dc.DrawPolygon(cds.size(), lines); - }; + } void clearDrawing() { const wxBrush &brush = m_dc.GetBrush(); diff --git a/Code/GraphMol/MolEnumerator/MolEnumerator.h b/Code/GraphMol/MolEnumerator/MolEnumerator.h index bc22b9064..f8a151abd 100644 --- a/Code/GraphMol/MolEnumerator/MolEnumerator.h +++ b/Code/GraphMol/MolEnumerator/MolEnumerator.h @@ -32,8 +32,8 @@ void removeOrigIndices(ROMol &mol); //! abstract base class for the a molecule enumeration operation class RDKIT_MOLENUMERATOR_EXPORT MolEnumeratorOp { public: - MolEnumeratorOp(){}; - virtual ~MolEnumeratorOp(){}; + MolEnumeratorOp() {} + virtual ~MolEnumeratorOp() {} //! returns a vector of the number of possible variations at variability point //! covered by this operation virtual std::vector getVariationCounts() const = 0; @@ -55,16 +55,16 @@ class RDKIT_MOLENUMERATOR_EXPORT MolEnumeratorOp { */ class RDKIT_MOLENUMERATOR_EXPORT PositionVariationOp : public MolEnumeratorOp { public: - PositionVariationOp(){}; + PositionVariationOp() {} PositionVariationOp(const std::shared_ptr mol) : dp_mol(mol) { PRECONDITION(mol, "bad molecule"); initFromMol(); - }; + } PositionVariationOp(const ROMol &mol) : dp_mol(new ROMol(mol)) { initFromMol(); - }; + } PositionVariationOp(const PositionVariationOp &other) - : dp_mol(other.dp_mol), d_variationPoints(other.d_variationPoints){}; + : dp_mol(other.dp_mol), d_variationPoints(other.d_variationPoints) {} PositionVariationOp &operator=(const PositionVariationOp &other) { if (&other == this) { return *this; @@ -72,7 +72,7 @@ class RDKIT_MOLENUMERATOR_EXPORT PositionVariationOp : public MolEnumeratorOp { dp_mol = other.dp_mol; d_variationPoints = other.d_variationPoints; return *this; - }; + } //! \override std::vector getVariationCounts() const override; @@ -101,12 +101,12 @@ class RDKIT_MOLENUMERATOR_EXPORT PositionVariationOp : public MolEnumeratorOp { */ class RDKIT_MOLENUMERATOR_EXPORT LinkNodeOp : public MolEnumeratorOp { public: - LinkNodeOp(){}; + LinkNodeOp() {} LinkNodeOp(const std::shared_ptr mol) : dp_mol(mol) { PRECONDITION(mol, "bad molecule"); initFromMol(); - }; - LinkNodeOp(const ROMol &mol) : dp_mol(new ROMol(mol)) { initFromMol(); }; + } + LinkNodeOp(const ROMol &mol) : dp_mol(new ROMol(mol)) { initFromMol(); } LinkNodeOp(const LinkNodeOp &other) : dp_mol(other.dp_mol), dp_frame(other.dp_frame), @@ -114,7 +114,7 @@ class RDKIT_MOLENUMERATOR_EXPORT LinkNodeOp : public MolEnumeratorOp { d_variations(other.d_variations), d_pointRanges(other.d_pointRanges), d_isotopeMap(other.d_isotopeMap), - d_atomMap(other.d_atomMap){}; + d_atomMap(other.d_atomMap) {} LinkNodeOp &operator=(const LinkNodeOp &other) { if (&other == this) { return *this; @@ -127,7 +127,7 @@ class RDKIT_MOLENUMERATOR_EXPORT LinkNodeOp : public MolEnumeratorOp { d_isotopeMap = other.d_isotopeMap; d_atomMap = other.d_atomMap; return *this; - }; + } //! \override std::vector getVariationCounts() const override; diff --git a/Code/GraphMol/MolHash/mf.h b/Code/GraphMol/MolHash/mf.h index 33a65fe74..be868afab 100644 --- a/Code/GraphMol/MolHash/mf.h +++ b/Code/GraphMol/MolHash/mf.h @@ -12,252 +12,251 @@ #define NMS_MOLFORMULA_H static unsigned char OrganicHillOrder[119] = { - 6, /* C */ - 1, /* H */ - 89, /* Ac */ - 47, /* Ag */ - 13, /* Al */ - 95, /* Am */ - 18, /* Ar */ - 33, /* As */ - 85, /* At */ - 79, /* Au */ - 5, /* B */ - 56, /* Ba */ - 4, /* Be */ - 107, /* Bh */ - 83, /* Bi */ - 97, /* Bk */ - 35, /* Br */ - 20, /* Ca */ - 48, /* Cd */ - 58, /* Ce */ - 98, /* Cf */ - 17, /* Cl */ - 96, /* Cm */ - 112, /* Cn */ - 27, /* Co */ - 24, /* Cr */ - 55, /* Cs */ - 29, /* Cu */ - 105, /* Db */ - 110, /* Ds */ - 66, /* Dy */ - 68, /* Er */ - 99, /* Es */ - 63, /* Eu */ - 9, /* F */ - 26, /* Fe */ - 114, /* Fl */ - 100, /* Fm */ - 87, /* Fr */ - 31, /* Ga */ - 64, /* Gd */ - 32, /* Ge */ - 2, /* He */ - 72, /* Hf */ - 80, /* Hg */ - 67, /* Ho */ - 108, /* Hs */ - 53, /* I */ - 49, /* In */ - 77, /* Ir */ - 19, /* K */ - 36, /* Kr */ - 57, /* La */ - 3, /* Li */ - 103, /* Lr */ - 71, /* Lu */ - 116, /* Lv */ - 115, /* Mc */ - 101, /* Md */ - 12, /* Mg */ - 25, /* Mn */ - 42, /* Mo */ - 109, /* Mt */ - 7, /* N */ - 11, /* Na */ - 41, /* Nb */ - 60, /* Nd */ - 10, /* Ne */ - 113, /* Nh */ - 28, /* Ni */ - 102, /* No */ - 93, /* Np */ - 8, /* O */ - 118, /* Og */ - 76, /* Os */ - 15, /* P */ - 91, /* Pa */ - 82, /* Pb */ - 46, /* Pd */ - 61, /* Pm */ - 84, /* Po */ - 59, /* Pr */ - 78, /* Pt */ - 94, /* Pu */ - 88, /* Ra */ - 37, /* Rb */ - 75, /* Re */ - 104, /* Rf */ - 111, /* Rg */ - 45, /* Rh */ - 86, /* Rn */ - 44, /* Ru */ - 16, /* S */ - 51, /* Sb */ - 21, /* Sc */ - 34, /* Se */ - 106, /* Sg */ - 14, /* Si */ - 62, /* Sm */ - 50, /* Sn */ - 38, /* Sr */ - 73, /* Ta */ - 65, /* Tb */ - 43, /* Tc */ - 52, /* Te */ - 90, /* Th */ - 22, /* Ti */ - 81, /* Tl */ - 69, /* Tm */ - 117, /* Ts */ - 92, /* U */ - 23, /* V */ - 74, /* W */ - 0, /* X */ - 54, /* Xe */ - 39, /* Y */ - 70, /* Yb */ - 30, /* Zn */ - 40 /* Zr */ - }; + 6, /* C */ + 1, /* H */ + 89, /* Ac */ + 47, /* Ag */ + 13, /* Al */ + 95, /* Am */ + 18, /* Ar */ + 33, /* As */ + 85, /* At */ + 79, /* Au */ + 5, /* B */ + 56, /* Ba */ + 4, /* Be */ + 107, /* Bh */ + 83, /* Bi */ + 97, /* Bk */ + 35, /* Br */ + 20, /* Ca */ + 48, /* Cd */ + 58, /* Ce */ + 98, /* Cf */ + 17, /* Cl */ + 96, /* Cm */ + 112, /* Cn */ + 27, /* Co */ + 24, /* Cr */ + 55, /* Cs */ + 29, /* Cu */ + 105, /* Db */ + 110, /* Ds */ + 66, /* Dy */ + 68, /* Er */ + 99, /* Es */ + 63, /* Eu */ + 9, /* F */ + 26, /* Fe */ + 114, /* Fl */ + 100, /* Fm */ + 87, /* Fr */ + 31, /* Ga */ + 64, /* Gd */ + 32, /* Ge */ + 2, /* He */ + 72, /* Hf */ + 80, /* Hg */ + 67, /* Ho */ + 108, /* Hs */ + 53, /* I */ + 49, /* In */ + 77, /* Ir */ + 19, /* K */ + 36, /* Kr */ + 57, /* La */ + 3, /* Li */ + 103, /* Lr */ + 71, /* Lu */ + 116, /* Lv */ + 115, /* Mc */ + 101, /* Md */ + 12, /* Mg */ + 25, /* Mn */ + 42, /* Mo */ + 109, /* Mt */ + 7, /* N */ + 11, /* Na */ + 41, /* Nb */ + 60, /* Nd */ + 10, /* Ne */ + 113, /* Nh */ + 28, /* Ni */ + 102, /* No */ + 93, /* Np */ + 8, /* O */ + 118, /* Og */ + 76, /* Os */ + 15, /* P */ + 91, /* Pa */ + 82, /* Pb */ + 46, /* Pd */ + 61, /* Pm */ + 84, /* Po */ + 59, /* Pr */ + 78, /* Pt */ + 94, /* Pu */ + 88, /* Ra */ + 37, /* Rb */ + 75, /* Re */ + 104, /* Rf */ + 111, /* Rg */ + 45, /* Rh */ + 86, /* Rn */ + 44, /* Ru */ + 16, /* S */ + 51, /* Sb */ + 21, /* Sc */ + 34, /* Se */ + 106, /* Sg */ + 14, /* Si */ + 62, /* Sm */ + 50, /* Sn */ + 38, /* Sr */ + 73, /* Ta */ + 65, /* Tb */ + 43, /* Tc */ + 52, /* Te */ + 90, /* Th */ + 22, /* Ti */ + 81, /* Tl */ + 69, /* Tm */ + 117, /* Ts */ + 92, /* U */ + 23, /* V */ + 74, /* W */ + 0, /* X */ + 54, /* Xe */ + 39, /* Y */ + 70, /* Yb */ + 30, /* Zn */ + 40 /* Zr */ +}; static unsigned char InorganicHillOrder[119] = { - 89, /* Ac */ - 47, /* Ag */ - 13, /* Al */ - 95, /* Am */ - 18, /* Ar */ - 33, /* As */ - 85, /* At */ - 79, /* Au */ - 5, /* B */ - 56, /* Ba */ - 4, /* Be */ - 107, /* Bh */ - 83, /* Bi */ - 97, /* Bk */ - 35, /* Br */ - 6, /* C */ - 20, /* Ca */ - 48, /* Cd */ - 58, /* Ce */ - 98, /* Cf */ - 17, /* Cl */ - 96, /* Cm */ - 112, /* Cn */ - 27, /* Co */ - 24, /* Cr */ - 55, /* Cs */ - 29, /* Cu */ - 105, /* Db */ - 110, /* Ds */ - 66, /* Dy */ - 68, /* Er */ - 99, /* Es */ - 63, /* Eu */ - 9, /* F */ - 26, /* Fe */ - 114, /* Fl */ - 100, /* Fm */ - 87, /* Fr */ - 31, /* Ga */ - 64, /* Gd */ - 32, /* Ge */ - 1, /* H */ - 2, /* He */ - 72, /* Hf */ - 80, /* Hg */ - 67, /* Ho */ - 108, /* Hs */ - 53, /* I */ - 49, /* In */ - 77, /* Ir */ - 19, /* K */ - 36, /* Kr */ - 57, /* La */ - 3, /* Li */ - 103, /* Lr */ - 71, /* Lu */ - 116, /* Lv */ - 115, /* Mc */ - 101, /* Md */ - 12, /* Mg */ - 25, /* Mn */ - 42, /* Mo */ - 109, /* Mt */ - 7, /* N */ - 11, /* Na */ - 41, /* Nb */ - 60, /* Nd */ - 10, /* Ne */ - 113, /* Nh */ - 28, /* Ni */ - 102, /* No */ - 93, /* Np */ - 8, /* O */ - 118, /* Og */ - 76, /* Os */ - 15, /* P */ - 91, /* Pa */ - 82, /* Pb */ - 46, /* Pd */ - 61, /* Pm */ - 84, /* Po */ - 59, /* Pr */ - 78, /* Pt */ - 94, /* Pu */ - 88, /* Ra */ - 37, /* Rb */ - 75, /* Re */ - 104, /* Rf */ - 111, /* Rg */ - 45, /* Rh */ - 86, /* Rn */ - 44, /* Ru */ - 16, /* S */ - 51, /* Sb */ - 21, /* Sc */ - 34, /* Se */ - 106, /* Sg */ - 14, /* Si */ - 62, /* Sm */ - 50, /* Sn */ - 38, /* Sr */ - 73, /* Ta */ - 65, /* Tb */ - 43, /* Tc */ - 52, /* Te */ - 90, /* Th */ - 22, /* Ti */ - 81, /* Tl */ - 69, /* Tm */ - 117, /* Ts */ - 92, /* U */ - 23, /* V */ - 74, /* W */ - 0, /* X */ - 54, /* Xe */ - 39, /* Y */ - 70, /* Yb */ - 30, /* Zn */ - 40 /* Zr */ - }; + 89, /* Ac */ + 47, /* Ag */ + 13, /* Al */ + 95, /* Am */ + 18, /* Ar */ + 33, /* As */ + 85, /* At */ + 79, /* Au */ + 5, /* B */ + 56, /* Ba */ + 4, /* Be */ + 107, /* Bh */ + 83, /* Bi */ + 97, /* Bk */ + 35, /* Br */ + 6, /* C */ + 20, /* Ca */ + 48, /* Cd */ + 58, /* Ce */ + 98, /* Cf */ + 17, /* Cl */ + 96, /* Cm */ + 112, /* Cn */ + 27, /* Co */ + 24, /* Cr */ + 55, /* Cs */ + 29, /* Cu */ + 105, /* Db */ + 110, /* Ds */ + 66, /* Dy */ + 68, /* Er */ + 99, /* Es */ + 63, /* Eu */ + 9, /* F */ + 26, /* Fe */ + 114, /* Fl */ + 100, /* Fm */ + 87, /* Fr */ + 31, /* Ga */ + 64, /* Gd */ + 32, /* Ge */ + 1, /* H */ + 2, /* He */ + 72, /* Hf */ + 80, /* Hg */ + 67, /* Ho */ + 108, /* Hs */ + 53, /* I */ + 49, /* In */ + 77, /* Ir */ + 19, /* K */ + 36, /* Kr */ + 57, /* La */ + 3, /* Li */ + 103, /* Lr */ + 71, /* Lu */ + 116, /* Lv */ + 115, /* Mc */ + 101, /* Md */ + 12, /* Mg */ + 25, /* Mn */ + 42, /* Mo */ + 109, /* Mt */ + 7, /* N */ + 11, /* Na */ + 41, /* Nb */ + 60, /* Nd */ + 10, /* Ne */ + 113, /* Nh */ + 28, /* Ni */ + 102, /* No */ + 93, /* Np */ + 8, /* O */ + 118, /* Og */ + 76, /* Os */ + 15, /* P */ + 91, /* Pa */ + 82, /* Pb */ + 46, /* Pd */ + 61, /* Pm */ + 84, /* Po */ + 59, /* Pr */ + 78, /* Pt */ + 94, /* Pu */ + 88, /* Ra */ + 37, /* Rb */ + 75, /* Re */ + 104, /* Rf */ + 111, /* Rg */ + 45, /* Rh */ + 86, /* Rn */ + 44, /* Ru */ + 16, /* S */ + 51, /* Sb */ + 21, /* Sc */ + 34, /* Se */ + 106, /* Sg */ + 14, /* Si */ + 62, /* Sm */ + 50, /* Sn */ + 38, /* Sr */ + 73, /* Ta */ + 65, /* Tb */ + 43, /* Tc */ + 52, /* Te */ + 90, /* Th */ + 22, /* Ti */ + 81, /* Tl */ + 69, /* Tm */ + 117, /* Ts */ + 92, /* U */ + 23, /* V */ + 74, /* W */ + 0, /* X */ + 54, /* Xe */ + 39, /* Y */ + 70, /* Yb */ + 30, /* Zn */ + 40 /* Zr */ +}; - -static const char *symbol[119] = { // x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 +static const char *symbol[119] = { "X", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", // x "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", // 1x "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", // 2x @@ -269,7 +268,6 @@ static const char *symbol[119] = { "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", // 8x "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", // 9x "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", // 10x - "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og" }; - -#endif // NMS_MOLFORMULA_H + "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; +#endif // NMS_MOLFORMULA_H diff --git a/Code/GraphMol/MolPickler.h b/Code/GraphMol/MolPickler.h index 72f09d83b..b869c2da6 100644 --- a/Code/GraphMol/MolPickler.h +++ b/Code/GraphMol/MolPickler.h @@ -38,10 +38,10 @@ class RingInfo; //! used to indicate exceptions whilst pickling (serializing) molecules class RDKIT_GRAPHMOL_EXPORT MolPicklerException : public std::exception { public: - MolPicklerException(const char *msg) : _msg(msg){}; - MolPicklerException(const std::string msg) : _msg(msg){}; - const char *what() const noexcept override { return _msg.c_str(); }; - ~MolPicklerException() noexcept {}; + MolPicklerException(const char *msg) : _msg(msg) {} + MolPicklerException(const std::string msg) : _msg(msg) {} + const char *what() const noexcept override { return _msg.c_str(); } + ~MolPicklerException() noexcept {} private: std::string _msg; @@ -163,7 +163,7 @@ class RDKIT_GRAPHMOL_EXPORT MolPickler { static void pickleMol(const ROMol &mol, std::ostream &ss, unsigned int propertyFlags) { MolPickler::pickleMol(&mol, ss, propertyFlags); - }; + } //! pickles a molecule and adds the results to string \c res static void pickleMol(const ROMol *mol, std::string &res); @@ -173,7 +173,7 @@ class RDKIT_GRAPHMOL_EXPORT MolPickler { static void pickleMol(const ROMol &mol, std::string &res, unsigned int propertyFlags) { MolPickler::pickleMol(&mol, res, propertyFlags); - }; + } //! constructs a molecule from a pickle stored in a string static void molFromPickle(const std::string &pickle, ROMol *mol, @@ -181,13 +181,13 @@ class RDKIT_GRAPHMOL_EXPORT MolPickler { static void molFromPickle(const std::string &pickle, ROMol &mol, unsigned int propertyFlags) { MolPickler::molFromPickle(pickle, &mol, propertyFlags); - }; + } static void molFromPickle(const std::string &pickle, ROMol *mol) { MolPickler::molFromPickle(pickle, mol, PicklerOps::AllProps); - }; + } static void molFromPickle(const std::string &pickle, ROMol &mol) { MolPickler::molFromPickle(pickle, &mol, PicklerOps::AllProps); - }; + } //! constructs a molecule from a pickle stored in a stream static void molFromPickle(std::istream &ss, ROMol *mol, @@ -195,13 +195,13 @@ class RDKIT_GRAPHMOL_EXPORT MolPickler { static void molFromPickle(std::istream &ss, ROMol &mol, unsigned int propertyFlags) { MolPickler::molFromPickle(ss, &mol, propertyFlags); - }; + } static void molFromPickle(std::istream &ss, ROMol *mol) { MolPickler::molFromPickle(ss, mol, PicklerOps::AllProps); - }; + } static void molFromPickle(std::istream &ss, ROMol &mol) { MolPickler::molFromPickle(ss, &mol, PicklerOps::AllProps); - }; + } private: //! Pickle nonquery atom data diff --git a/Code/GraphMol/MolStandardize/Charge.h b/Code/GraphMol/MolStandardize/Charge.h index 5c988fee1..061f86d77 100644 --- a/Code/GraphMol/MolStandardize/Charge.h +++ b/Code/GraphMol/MolStandardize/Charge.h @@ -125,7 +125,7 @@ class RDKIT_MOLSTANDARDIZE_EXPORT Uncharger { Uncharger(); Uncharger(bool canonicalOrdering) : Uncharger() { df_canonicalOrdering = canonicalOrdering; - }; + } Uncharger(const Uncharger &other); ~Uncharger(); diff --git a/Code/GraphMol/MolStandardize/Fragment.h b/Code/GraphMol/MolStandardize/Fragment.h index fd9d0fdbc..4e6167023 100644 --- a/Code/GraphMol/MolStandardize/Fragment.h +++ b/Code/GraphMol/MolStandardize/Fragment.h @@ -72,11 +72,11 @@ inline FragmentRemover *fragmentRemoverFromParams( class RDKIT_MOLSTANDARDIZE_EXPORT LargestFragmentChooser { public: - // LargestFragmentChooser(){}; + // LargestFragmentChooser() {} LargestFragmentChooser(bool prefer_organic = false) - : PREFER_ORGANIC(prefer_organic){}; + : PREFER_ORGANIC(prefer_organic) {} LargestFragmentChooser(const LargestFragmentChooser &other); - ~LargestFragmentChooser(){}; + ~LargestFragmentChooser() {} ROMol *choose(const ROMol &mol); struct Largest { diff --git a/Code/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogEntry.h b/Code/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogEntry.h index c0ea0609b..6dcf14b46 100644 --- a/Code/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogEntry.h +++ b/Code/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogEntry.h @@ -23,7 +23,7 @@ namespace MolStandardize { class RDKIT_MOLSTANDARDIZE_EXPORT FragmentCatalogEntry : public RDCatalog::CatalogEntry { public: - FragmentCatalogEntry() : d_descrip("") { + FragmentCatalogEntry() : d_descrip("") { dp_props = new Dict(); setBitId(-1); } diff --git a/Code/GraphMol/MolStandardize/Tautomer.h b/Code/GraphMol/MolStandardize/Tautomer.h index 7e7fc6fec..30042982f 100644 --- a/Code/GraphMol/MolStandardize/Tautomer.h +++ b/Code/GraphMol/MolStandardize/Tautomer.h @@ -322,9 +322,9 @@ class RDKIT_MOLSTANDARDIZE_EXPORT TautomerEnumerator { //! Deprecated, please use the form returning a \c TautomerEnumeratorResult //! instead - [ - [deprecated("please use the form returning a TautomerEnumeratorResult " - "instead")]] std::vector + [[deprecated( + "please use the form returning a TautomerEnumeratorResult " + "instead")]] std::vector enumerate(const ROMol &mol, boost::dynamic_bitset<> *modifiedAtoms, boost::dynamic_bitset<> *modifiedBonds = nullptr) const; diff --git a/Code/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h b/Code/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h index 6b11a4c54..50c8d1baf 100644 --- a/Code/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h +++ b/Code/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h @@ -54,7 +54,7 @@ class RDKIT_MOLSTANDARDIZE_EXPORT TautomerTransform { Charges = other.Charges; } return *this; - }; + } ~TautomerTransform() { delete Mol; } }; diff --git a/Code/GraphMol/MolStandardize/TransformCatalog/TransformCatalogEntry.h b/Code/GraphMol/MolStandardize/TransformCatalog/TransformCatalogEntry.h index 20b7217b4..d3b9114e4 100644 --- a/Code/GraphMol/MolStandardize/TransformCatalog/TransformCatalogEntry.h +++ b/Code/GraphMol/MolStandardize/TransformCatalog/TransformCatalogEntry.h @@ -24,7 +24,7 @@ namespace MolStandardize { class RDKIT_MOLSTANDARDIZE_EXPORT TransformCatalogEntry : public RDCatalog::CatalogEntry { public: - TransformCatalogEntry() : d_descrip("") { + TransformCatalogEntry() : d_descrip("") { dp_props = new Dict(); setBitId(-1); } diff --git a/Code/GraphMol/MolStandardize/Validate.h b/Code/GraphMol/MolStandardize/Validate.h index af7d23b7f..9abbc4af8 100644 --- a/Code/GraphMol/MolStandardize/Validate.h +++ b/Code/GraphMol/MolStandardize/Validate.h @@ -38,9 +38,9 @@ class RDKIT_MOLSTANDARDIZE_EXPORT ValidationErrorInfo : public std::exception { public: ValidationErrorInfo(const std::string &msg) : d_msg(msg) { BOOST_LOG(rdInfoLog) << d_msg << std::endl; - }; - const char *what() const noexcept override { return d_msg.c_str(); }; - ~ValidationErrorInfo() noexcept {}; + } + const char *what() const noexcept override { return d_msg.c_str(); } + ~ValidationErrorInfo() noexcept {} private: std::string d_msg; @@ -96,7 +96,7 @@ class RDKIT_MOLSTANDARDIZE_EXPORT NoAtomValidation final //! pointer to it virtual boost::shared_ptr copy() const override { return boost::make_shared(*this); - }; + } }; //! The FragmentValidation class logs if certain fragments are present. @@ -109,7 +109,7 @@ class RDKIT_MOLSTANDARDIZE_EXPORT FragmentValidation final //! pointer to it virtual boost::shared_ptr copy() const override { return boost::make_shared(*this); - }; + } }; //! The NeutralValidation class logs if not an overall neutral system. @@ -122,7 +122,7 @@ class RDKIT_MOLSTANDARDIZE_EXPORT NeutralValidation final //! pointer to it virtual boost::shared_ptr copy() const override { return boost::make_shared(*this); - }; + } }; //! The IsotopeValidation class logs if molecule contains isotopes. @@ -135,7 +135,7 @@ class RDKIT_MOLSTANDARDIZE_EXPORT IsotopeValidation final //! pointer to it virtual boost::shared_ptr copy() const override { return boost::make_shared(*this); - }; + } }; //////////////////////////////// @@ -165,7 +165,7 @@ class RDKIT_MOLSTANDARDIZE_EXPORT AllowedAtomsValidation : public ValidationMethod { public: AllowedAtomsValidation(const std::vector> &atoms) - : d_allowedList(atoms){}; + : d_allowedList(atoms) {} std::vector validate( const ROMol &mol, bool reportAllFailures) const override; @@ -180,7 +180,7 @@ class RDKIT_MOLSTANDARDIZE_EXPORT DisallowedAtomsValidation : public ValidationMethod { public: DisallowedAtomsValidation(const std::vector> &atoms) - : d_disallowedList(atoms){}; + : d_disallowedList(atoms) {} std::vector validate( const ROMol &mol, bool reportAllFailures) const override; diff --git a/Code/GraphMol/MonomerInfo.h b/Code/GraphMol/MonomerInfo.h index 4d8817b4a..913bc2ef9 100644 --- a/Code/GraphMol/MonomerInfo.h +++ b/Code/GraphMol/MonomerInfo.h @@ -26,18 +26,18 @@ class RDKIT_GRAPHMOL_EXPORT AtomMonomerInfo { public: typedef enum { UNKNOWN = 0, PDBRESIDUE, OTHER } AtomMonomerType; - virtual ~AtomMonomerInfo(){}; + virtual ~AtomMonomerInfo() {} - AtomMonomerInfo() : d_name(""){}; + AtomMonomerInfo() : d_name("") {} AtomMonomerInfo(AtomMonomerType typ, const std::string &nm = "") - : d_monomerType(typ), d_name(nm){}; + : d_monomerType(typ), d_name(nm) {} AtomMonomerInfo(const AtomMonomerInfo &other) - : d_monomerType(other.d_monomerType), d_name(other.d_name){}; + : d_monomerType(other.d_monomerType), d_name(other.d_name) {} - const std::string &getName() const { return d_name; }; - void setName(const std::string &nm) { d_name = nm; }; - AtomMonomerType getMonomerType() const { return d_monomerType; }; - void setMonomerType(AtomMonomerType typ) { d_monomerType = typ; }; + const std::string &getName() const { return d_name; } + void setName(const std::string &nm) { d_name = nm; } + AtomMonomerType getMonomerType() const { return d_monomerType; } + void setMonomerType(AtomMonomerType typ) { d_monomerType = typ; } virtual AtomMonomerInfo *copy() const { return new AtomMonomerInfo(*this); } @@ -49,7 +49,7 @@ class RDKIT_GRAPHMOL_EXPORT AtomMonomerInfo { //! Captures atom-level information about peptide residues class RDKIT_GRAPHMOL_EXPORT AtomPDBResidueInfo : public AtomMonomerInfo { public: - AtomPDBResidueInfo() : AtomMonomerInfo(PDBRESIDUE){}; + AtomPDBResidueInfo() : AtomMonomerInfo(PDBRESIDUE) {} AtomPDBResidueInfo(const AtomPDBResidueInfo &other) : AtomMonomerInfo(other), d_serialNumber(other.d_serialNumber), @@ -62,7 +62,7 @@ class RDKIT_GRAPHMOL_EXPORT AtomPDBResidueInfo : public AtomMonomerInfo { d_tempFactor(other.d_tempFactor), df_heteroAtom(other.df_heteroAtom), d_secondaryStructure(other.d_secondaryStructure), - d_segmentNumber(other.d_segmentNumber){}; + d_segmentNumber(other.d_segmentNumber) {} AtomPDBResidueInfo(const std::string &atomName, int serialNumber = 0, const std::string &altLoc = "", @@ -84,30 +84,30 @@ class RDKIT_GRAPHMOL_EXPORT AtomPDBResidueInfo : public AtomMonomerInfo { d_tempFactor(tempFactor), df_heteroAtom(isHeteroAtom), d_secondaryStructure(secondaryStructure), - d_segmentNumber(segmentNumber){}; + d_segmentNumber(segmentNumber) {} - int getSerialNumber() const { return d_serialNumber; }; - void setSerialNumber(int val) { d_serialNumber = val; }; - const std::string &getAltLoc() const { return d_altLoc; }; - void setAltLoc(const std::string &val) { d_altLoc = val; }; - const std::string &getResidueName() const { return d_residueName; }; - void setResidueName(const std::string &val) { d_residueName = val; }; - int getResidueNumber() const { return d_residueNumber; }; - void setResidueNumber(int val) { d_residueNumber = val; }; - const std::string &getChainId() const { return d_chainId; }; - void setChainId(const std::string &val) { d_chainId = val; }; - const std::string &getInsertionCode() const { return d_insertionCode; }; - void setInsertionCode(const std::string &val) { d_insertionCode = val; }; - double getOccupancy() const { return d_occupancy; }; - void setOccupancy(double val) { d_occupancy = val; }; - double getTempFactor() const { return d_tempFactor; }; - void setTempFactor(double val) { d_tempFactor = val; }; - bool getIsHeteroAtom() const { return df_heteroAtom; }; - void setIsHeteroAtom(bool val) { df_heteroAtom = val; }; - unsigned int getSecondaryStructure() const { return d_secondaryStructure; }; - void setSecondaryStructure(unsigned int val) { d_secondaryStructure = val; }; - unsigned int getSegmentNumber() const { return d_segmentNumber; }; - void setSegmentNumber(unsigned int val) { d_segmentNumber = val; }; + int getSerialNumber() const { return d_serialNumber; } + void setSerialNumber(int val) { d_serialNumber = val; } + const std::string &getAltLoc() const { return d_altLoc; } + void setAltLoc(const std::string &val) { d_altLoc = val; } + const std::string &getResidueName() const { return d_residueName; } + void setResidueName(const std::string &val) { d_residueName = val; } + int getResidueNumber() const { return d_residueNumber; } + void setResidueNumber(int val) { d_residueNumber = val; } + const std::string &getChainId() const { return d_chainId; } + void setChainId(const std::string &val) { d_chainId = val; } + const std::string &getInsertionCode() const { return d_insertionCode; } + void setInsertionCode(const std::string &val) { d_insertionCode = val; } + double getOccupancy() const { return d_occupancy; } + void setOccupancy(double val) { d_occupancy = val; } + double getTempFactor() const { return d_tempFactor; } + void setTempFactor(double val) { d_tempFactor = val; } + bool getIsHeteroAtom() const { return df_heteroAtom; } + void setIsHeteroAtom(bool val) { df_heteroAtom = val; } + unsigned int getSecondaryStructure() const { return d_secondaryStructure; } + void setSecondaryStructure(unsigned int val) { d_secondaryStructure = val; } + unsigned int getSegmentNumber() const { return d_segmentNumber; } + void setSegmentNumber(unsigned int val) { d_segmentNumber = val; } AtomMonomerInfo *copy() const { return static_cast(new AtomPDBResidueInfo(*this)); diff --git a/Code/GraphMol/PeriodicTable.h b/Code/GraphMol/PeriodicTable.h index 92b47720c..36d9c85e9 100644 --- a/Code/GraphMol/PeriodicTable.h +++ b/Code/GraphMol/PeriodicTable.h @@ -47,7 +47,7 @@ class RDKIT_GRAPHMOL_EXPORT PeriodicTable { ~PeriodicTable() { byanum.clear(); byname.clear(); - }; + } //! returns the atomic weight double getAtomicWeight(UINT atomicNumber) const { diff --git a/Code/GraphMol/QueryAtom.h b/Code/GraphMol/QueryAtom.h index c8d8e1517..b71d23049 100644 --- a/Code/GraphMol/QueryAtom.h +++ b/Code/GraphMol/QueryAtom.h @@ -28,8 +28,8 @@ class RDKIT_GRAPHMOL_EXPORT QueryAtom : public Atom { public: typedef Queries::Query QUERYATOM_QUERY; - QueryAtom() : Atom(){}; - explicit QueryAtom(int num) : Atom(num), dp_query(makeAtomNumQuery(num)){}; + QueryAtom() : Atom() {} + explicit QueryAtom(int num) : Atom(num), dp_query(makeAtomNumQuery(num)) {} explicit QueryAtom(const Atom &other) : Atom(other), dp_query(makeAtomNumQuery(other.getAtomicNum())) { if (other.getIsotope()) { @@ -45,14 +45,14 @@ class RDKIT_GRAPHMOL_EXPORT QueryAtom : public Atom { makeAtomNumRadicalElectronsQuery(other.getNumRadicalElectrons()), Queries::CompositeQueryType::COMPOSITE_AND); } - }; + } QueryAtom(const QueryAtom &other) : Atom(other) { if (other.dp_query) { dp_query = other.dp_query->copy(); } else { dp_query = nullptr; } - }; + } QueryAtom &operator=(const QueryAtom &other) { if (this == &other) return *this; Atom::operator=(other); @@ -70,7 +70,7 @@ class RDKIT_GRAPHMOL_EXPORT QueryAtom : public Atom { Atom *copy() const; // This method can be used to distinguish query atoms from standard atoms: - bool hasQuery() const { return dp_query != nullptr; }; + bool hasQuery() const { return dp_query != nullptr; } //! replaces our current query with the value passed in void setQuery(QUERYATOM_QUERY *what) { @@ -78,7 +78,7 @@ class RDKIT_GRAPHMOL_EXPORT QueryAtom : public Atom { dp_query = what; } //! returns our current query - QUERYATOM_QUERY *getQuery() const { return dp_query; }; + QUERYATOM_QUERY *getQuery() const { return dp_query; } //! expands our current query /*! diff --git a/Code/GraphMol/QueryBond.h b/Code/GraphMol/QueryBond.h index 2fd17c3ee..529fd5308 100644 --- a/Code/GraphMol/QueryBond.h +++ b/Code/GraphMol/QueryBond.h @@ -29,19 +29,19 @@ class RDKIT_GRAPHMOL_EXPORT QueryBond : public Bond { public: typedef Queries::Query QUERYBOND_QUERY; - QueryBond() : Bond(){}; + QueryBond() : Bond() {} //! initialize with a particular bond order explicit QueryBond(BondType bT); //! initialize from a bond explicit QueryBond(const Bond &other) - : Bond(other), dp_query(makeBondOrderEqualsQuery(other.getBondType())){}; + : Bond(other), dp_query(makeBondOrderEqualsQuery(other.getBondType())) {} QueryBond(const QueryBond &other) : Bond(other) { if (other.dp_query) { dp_query = other.dp_query->copy(); } else { dp_query = nullptr; } - }; + } ~QueryBond(); //! returns a copy of this query, owned by the caller @@ -61,16 +61,16 @@ class RDKIT_GRAPHMOL_EXPORT QueryBond : public Bond { bool QueryMatch(QueryBond const *what) const; // This method can be used to distinguish query bonds from standard bonds - bool hasQuery() const { return dp_query != nullptr; }; + bool hasQuery() const { return dp_query != nullptr; } //! returns our current query - QUERYBOND_QUERY *getQuery() const { return dp_query; }; + QUERYBOND_QUERY *getQuery() const { return dp_query; } //! replaces our current query with the value passed in void setQuery(QUERYBOND_QUERY *what) { // free up any existing query (Issue255): delete dp_query; dp_query = what; - }; + } //! expands our current query /*! diff --git a/Code/GraphMol/QueryOps.h b/Code/GraphMol/QueryOps.h index 1b6ee1aef..5388e7c2a 100644 --- a/Code/GraphMol/QueryOps.h +++ b/Code/GraphMol/QueryOps.h @@ -127,7 +127,7 @@ static inline int queryAtomTotalValence(Atom const *at) { static inline int queryAtomUnsaturated(Atom const *at) { return at->getTotalDegree() < at->getTotalValence(); }; -static inline int queryAtomNum(Atom const *at) { return at->getAtomicNum(); }; +static inline int queryAtomNum(Atom const *at) { return at->getAtomicNum(); } static inline int makeAtomType(int atomic_num, bool aromatic) { return atomic_num + 1000 * static_cast(aromatic); } @@ -704,13 +704,13 @@ class RDKIT_GRAPHMOL_EXPORT AtomRingQuery // default is to just do a number of rings query: this->setDescription("AtomInNRings"); this->setDataFunc(queryAtomRingMembership); - }; + } explicit AtomRingQuery(int v) : Queries::EqualityQuery(v) { // default is to just do a number of rings query: this->setDescription("AtomInNRings"); this->setDataFunc(queryAtomRingMembership); - }; + } virtual bool Match(const ConstAtomPtr what) const { int v = this->TypeConvert(what, Queries::Int2Type()); @@ -744,7 +744,7 @@ class RDKIT_GRAPHMOL_EXPORT RecursiveStructureQuery RecursiveStructureQuery() : Queries::SetQuery() { setDataFunc(getAtIdx); setDescription("RecursiveStructure"); - }; + } //! initialize from an ROMol pointer /*! Notes @@ -756,12 +756,12 @@ class RDKIT_GRAPHMOL_EXPORT RecursiveStructureQuery setQueryMol(query); setDataFunc(getAtIdx); setDescription("RecursiveStructure"); - }; + } //! returns the index of an atom static inline int getAtIdx(Atom const *at) { PRECONDITION(at, "bad atom argument"); return at->getIdx(); - }; + } //! sets the molecule we'll use recursively /*! @@ -770,7 +770,7 @@ class RDKIT_GRAPHMOL_EXPORT RecursiveStructureQuery */ void setQueryMol(ROMol const *query) { dp_queryMol.reset(query); } //! returns a pointer to our query molecule - ROMol const *getQueryMol() const { return dp_queryMol.get(); }; + ROMol const *getQueryMol() const { return dp_queryMol.get(); } //! returns a copy of this query Queries::Query *copy() const { @@ -786,7 +786,7 @@ class RDKIT_GRAPHMOL_EXPORT RecursiveStructureQuery res->d_serialNumber = d_serialNumber; return res; } - unsigned int getSerialNumber() const { return d_serialNumber; }; + unsigned int getSerialNumber() const { return d_serialNumber; } #ifdef RDK_THREADSAFE_SSS std::mutex d_mutex; @@ -817,13 +817,13 @@ class HasPropQuery : public Queries::EqualityQuery { // default is to just do a number of rings query: this->setDescription("AtomHasProp"); this->setDataFunc(0); - }; + } explicit HasPropQuery(const std::string &v) : Queries::EqualityQuery(), propname(v) { // default is to just do a number of rings query: this->setDescription("AtomHasProp"); this->setDataFunc(nullptr); - }; + } virtual bool Match(const TargetPtr what) const { bool res = what->hasProp(propname); @@ -866,7 +866,7 @@ class HasPropWithValueQuery // default is to just do a number of rings query: this->setDescription("HasPropWithValue"); this->setDataFunc(0); - }; + } explicit HasPropWithValueQuery(const std::string &prop, const T &v, const T &tol = 0.0) : Queries::EqualityQuery(), @@ -876,7 +876,7 @@ class HasPropWithValueQuery // default is to just do a number of rings query: this->setDescription("HasPropWithValue"); this->setDataFunc(nullptr); - }; + } virtual bool Match(const TargetPtr what) const { bool res = what->hasProp(propname); @@ -932,7 +932,7 @@ class HasPropWithValueQuery // default is to just do a number of rings query: this->setDescription("HasPropWithValue"); this->setDataFunc(0); - }; + } explicit HasPropWithValueQuery(const std::string &prop, const std::string &v, const std::string &tol = "") : Queries::EqualityQuery(), propname(prop), val(v) { @@ -940,7 +940,7 @@ class HasPropWithValueQuery // default is to just do a number of rings query: this->setDescription("HasPropWithValue"); this->setDataFunc(nullptr); - }; + } virtual bool Match(const TargetPtr what) const { bool res = what->hasProp(propname); @@ -997,7 +997,7 @@ class HasPropWithValueQuery : Queries::EqualityQuery(), propname(), val() { this->setDescription("HasPropWithValue"); this->setDataFunc(0); - }; + } explicit HasPropWithValueQuery(const std::string &prop, const ExplicitBitVect &v, float tol = 0.0) @@ -1007,7 +1007,7 @@ class HasPropWithValueQuery tol(tol) { this->setDescription("HasPropWithValue"); this->setDataFunc(nullptr); - }; + } virtual bool Match(const TargetPtr what) const { bool res = what->hasProp(propname); diff --git a/Code/GraphMol/RGroupDecomposition/RGroupCore.h b/Code/GraphMol/RGroupDecomposition/RGroupCore.h index 2e27eb524..bf11af7c8 100644 --- a/Code/GraphMol/RGroupDecomposition/RGroupCore.h +++ b/Code/GraphMol/RGroupDecomposition/RGroupCore.h @@ -30,7 +30,7 @@ struct RCore { boost::dynamic_bitset<> core_atoms_with_user_labels; // Number of user labelled rgroups in the core size_t numberUserRGroups = 0; - RCore(){}; + RCore() {} RCore(const RWMol &c) : core(new RWMol(c)) { init(); } void init(); diff --git a/Code/GraphMol/RGroupDecomposition/RGroupData.h b/Code/GraphMol/RGroupDecomposition/RGroupData.h index d82bde1bd..e3e9d59aa 100644 --- a/Code/GraphMol/RGroupDecomposition/RGroupData.h +++ b/Code/GraphMol/RGroupDecomposition/RGroupData.h @@ -112,9 +112,10 @@ struct RGroupData { std::string toString() const { auto attachmentString = std::accumulate( - attachments.cbegin(), attachments.cend(), - std::string(), [](std::string s, int a) { - return s.empty() ? std::to_string(a) : std::move(s) + ',' + std::to_string(a); + attachments.cbegin(), attachments.cend(), std::string(), + [](std::string s, int a) { + return s.empty() ? std::to_string(a) + : std::move(s) + ',' + std::to_string(a); }); std::stringstream ss; ss << "RG " << attachmentString << " " << getSmiles(); diff --git a/Code/GraphMol/RGroupDecomposition/RGroupFingerprintScore.h b/Code/GraphMol/RGroupDecomposition/RGroupFingerprintScore.h index 65766ff53..de8ac3123 100644 --- a/Code/GraphMol/RGroupDecomposition/RGroupFingerprintScore.h +++ b/Code/GraphMol/RGroupDecomposition/RGroupFingerprintScore.h @@ -62,10 +62,9 @@ struct FingerprintVarianceScoreData { void clear(); private: - void modifyVarianceData( - int matchNumber, int permutationNumber, - const std::vector> &matches, - const std::set &labels, bool add); + void modifyVarianceData(int matchNumber, int permutationNumber, + const std::vector> &matches, + const std::set &labels, bool add); }; // The arithmetic mean of the mean fingerprint bit variances for the diff --git a/Code/GraphMol/RGroupDecomposition/RGroupGa.h b/Code/GraphMol/RGroupDecomposition/RGroupGa.h old mode 100755 new mode 100644 index 4281b98b4..5765faa8f --- a/Code/GraphMol/RGroupDecomposition/RGroupGa.h +++ b/Code/GraphMol/RGroupDecomposition/RGroupGa.h @@ -65,13 +65,13 @@ class RGroupDecompositionChromosome : public IntegerStringChromosome { void copyGene(const StringChromosomeBase& other) override; - FingerprintVarianceScoreData & getFingerprintVarianceScoreData() { + FingerprintVarianceScoreData& getFingerprintVarianceScoreData() { return fingerprintVarianceScoreData; } const vector& getPermutation() const { return permutation; } - const RGroupGa& getRGroupGA() const { return rGroupGa; }; + const RGroupGa& getRGroupGA() const { return rGroupGa; } private: RGroupDecompositionChromosome(const RGroupDecompositionChromosome& other) = @@ -91,11 +91,11 @@ struct GaResult { vector> permutations; GaResult(const double score, const vector>& permutations) - : score(score), permutations(permutations){}; + : score(score), permutations(permutations) {} GaResult(const GaResult& other) - : score(other.score), permutations(other.permutations){}; + : score(other.score), permutations(other.permutations) {} - GaResult(){}; + GaResult() {} // Copy constructor required by MSVC for future GaResult& operator=(const GaResult& other); @@ -120,7 +120,7 @@ class RDKIT_RGROUPDECOMPOSITION_EXPORT RGroupGa : public GaBase { shared_ptr createChromosome(); - const RGroupDecompData& getRGroupData() const { return rGroupData; }; + const RGroupDecompData& getRGroupData() const { return rGroupData; } const vector>> getOperations() const; diff --git a/Code/GraphMol/RGroupDecomposition/RGroupScore.h b/Code/GraphMol/RGroupDecomposition/RGroupScore.h index 5d6fed90c..d6760d68b 100644 --- a/Code/GraphMol/RGroupDecomposition/RGroupScore.h +++ b/Code/GraphMol/RGroupDecomposition/RGroupScore.h @@ -67,9 +67,10 @@ struct CartesianProduct { } }; -RDKIT_RGROUPDECOMPOSITION_EXPORT double matchScore(const std::vector &permutation, - const std::vector> &matches, - const std::set &labels); +RDKIT_RGROUPDECOMPOSITION_EXPORT double matchScore( + const std::vector &permutation, + const std::vector> &matches, + const std::set &labels); } // namespace RDKit #endif diff --git a/Code/GraphMol/ROMol.h b/Code/GraphMol/ROMol.h index 8869aba79..191513261 100644 --- a/Code/GraphMol/ROMol.h +++ b/Code/GraphMol/ROMol.h @@ -286,13 +286,13 @@ class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps { dp_ringInfo = nullptr; initFromOther(other, quickCopy, confId); numBonds = rdcast(boost::num_edges(d_graph)); - }; + } //! construct a molecule from a pickle string ROMol(const std::string &binStr); //! construct a molecule from a pickle string ROMol(const std::string &binStr, unsigned int propertyFlags); - virtual ~ROMol() { destroy(); }; + virtual ~ROMol() { destroy(); } //@} //! \name Atoms @@ -301,7 +301,7 @@ class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps { //! returns our number of atoms inline unsigned int getNumAtoms() const { return rdcast(boost::num_vertices(d_graph)); - }; + } unsigned int getNumAtoms(bool onlyExplicit) const; //! returns our number of heavy atoms (atomic number > 1) unsigned int getNumHeavyAtoms() const; @@ -367,12 +367,12 @@ class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps { //! associates an Atom pointer with a bookmark void setAtomBookmark(Atom *at, int mark) { d_atomBookmarks[mark].push_back(at); - }; + } //! associates an Atom pointer with a bookmark void replaceAtomBookmark(Atom *at, int mark) { d_atomBookmarks[mark].clear(); d_atomBookmarks[mark].push_back(at); - }; + } //! returns the first Atom associated with the \c bookmark provided Atom *getAtomWithBookmark(int mark); //! returns the Atom associated with the \c bookmark provided @@ -386,16 +386,16 @@ class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps { void clearAtomBookmark(int mark, const Atom *atom); //! blows out all atomic \c bookmarks - void clearAllAtomBookmarks() { d_atomBookmarks.clear(); }; + void clearAllAtomBookmarks() { d_atomBookmarks.clear(); } //! queries whether or not any atoms are associated with a \c bookmark - bool hasAtomBookmark(int mark) const { return d_atomBookmarks.count(mark); }; + bool hasAtomBookmark(int mark) const { return d_atomBookmarks.count(mark); } //! returns a pointer to all of our atom \c bookmarks - ATOM_BOOKMARK_MAP *getAtomBookmarks() { return &d_atomBookmarks; }; + ATOM_BOOKMARK_MAP *getAtomBookmarks() { return &d_atomBookmarks; } //! associates a Bond pointer with a bookmark void setBondBookmark(Bond *bond, int mark) { d_bondBookmarks[mark].push_back(bond); - }; + } //! returns the first Bond associated with the \c bookmark provided Bond *getBondWithBookmark(int mark); //! returns the Bond associated with the \c bookmark provided @@ -409,11 +409,11 @@ class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps { void clearBondBookmark(int mark, const Bond *bond); //! blows out all bond \c bookmarks - void clearAllBondBookmarks() { d_bondBookmarks.clear(); }; + void clearAllBondBookmarks() { d_bondBookmarks.clear(); } //! queries whether or not any bonds are associated with a \c bookmark - bool hasBondBookmark(int mark) const { return d_bondBookmarks.count(mark); }; + bool hasBondBookmark(int mark) const { return d_bondBookmarks.count(mark); } //! returns a pointer to all of our bond \c bookmarks - BOND_BOOKMARK_MAP *getBondBookmarks() { return &d_bondBookmarks; }; + BOND_BOOKMARK_MAP *getBondBookmarks() { return &d_bondBookmarks; } //@} @@ -455,7 +455,7 @@ class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps { //! returns a pointer to our RingInfo structure //! Note: the client should not delete this. - RingInfo *getRingInfo() const { return dp_ringInfo; }; + RingInfo *getRingInfo() const { return dp_ringInfo; } //! provides access to all neighbors around an Atom /*! @@ -558,7 +558,7 @@ class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps { int res = boost::connected_components(G_p,&mapping[0]); \endcode */ - MolGraph const &getTopology() const { return d_graph; }; + MolGraph const &getTopology() const { return d_graph; } //@} //! \name Iterators @@ -652,13 +652,13 @@ class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps { void debugMol(std::ostream &str) const; //@} - Atom *operator[](const vertex_descriptor &v) { return d_graph[v]; }; + Atom *operator[](const vertex_descriptor &v) { return d_graph[v]; } const Atom *operator[](const vertex_descriptor &v) const { return d_graph[v]; - }; + } - Bond *operator[](const edge_descriptor &e) { return d_graph[e]; }; - const Bond *operator[](const edge_descriptor &e) const { return d_graph[e]; }; + Bond *operator[](const edge_descriptor &e) { return d_graph[e]; } + const Bond *operator[](const edge_descriptor &e) const { return d_graph[e]; } //! Gets a reference to the groups of atoms with relative stereochemistry /*! diff --git a/Code/GraphMol/RWMol.h b/Code/GraphMol/RWMol.h index 114e129d3..4a8d68630 100644 --- a/Code/GraphMol/RWMol.h +++ b/Code/GraphMol/RWMol.h @@ -31,7 +31,7 @@ namespace RDKit { */ class RDKIT_GRAPHMOL_EXPORT RWMol : public ROMol { public: - RWMol() : ROMol() {}; + RWMol() : ROMol() {} //! copy constructor with a twist /*! \param other the molecule to be copied @@ -43,8 +43,8 @@ class RDKIT_GRAPHMOL_EXPORT RWMol : public ROMol { the specified conformer from \c other. */ RWMol(const ROMol &other, bool quickCopy = false, int confId = -1) - : ROMol(other, quickCopy, confId) {}; - RWMol(const RWMol &other) : ROMol(other) {}; + : ROMol(other, quickCopy, confId) {} + RWMol(const RWMol &other) : ROMol(other) {} RWMol &operator=(const RWMol &); //! insert the atoms and bonds from \c other into this molecule @@ -77,7 +77,7 @@ class RDKIT_GRAPHMOL_EXPORT RWMol : public ROMol { unsigned int addAtom(Atom *atom, bool updateLabel = true, bool takeOwnership = false) { return ROMol::addAtom(atom, updateLabel, takeOwnership); - }; + } //! adds an Atom to our collection @@ -93,7 +93,7 @@ class RDKIT_GRAPHMOL_EXPORT RWMol : public ROMol { void replaceAtom(unsigned int idx, Atom *atom, bool updateLabel = false, bool preserveProps = false); //! returns a pointer to the highest-numbered Atom - Atom *getLastAtom() { return getAtomWithIdx(getNumAtoms() - 1); }; + Atom *getLastAtom() { return getAtomWithIdx(getNumAtoms() - 1); } //! returns a pointer to the "active" Atom /*! If we have an \c activeAtom, it will be returned, @@ -135,7 +135,7 @@ class RDKIT_GRAPHMOL_EXPORT RWMol : public ROMol { */ unsigned int addBond(Bond *bond, bool takeOwnership = false) { return ROMol::addBond(bond, takeOwnership); - }; + } //! starts a Bond and sets its beginAtomIdx /*! @@ -199,7 +199,7 @@ class RDKIT_GRAPHMOL_EXPORT RWMol : public ROMol { */ void setStereoGroups(std::vector &&stereo_groups) { return ROMol::setStereoGroups(std::move(stereo_groups)); - }; + } //! removes all atoms, bonds, properties, bookmarks, etc. void clear() { @@ -207,15 +207,14 @@ class RDKIT_GRAPHMOL_EXPORT RWMol : public ROMol { d_confs.clear(); ROMol::initMol(); // make sure we have a "fresh" ready to go copy numBonds = 0; - }; + } void beginBatchEdit(); - void rollbackBatchEdit(){ + void rollbackBatchEdit() { dp_delAtoms.reset(); dp_delBonds.reset(); - }; + } void commitBatchEdit(); - }; typedef boost::shared_ptr RWMOL_SPTR; diff --git a/Code/GraphMol/RingInfo.h b/Code/GraphMol/RingInfo.h index f5aa488f6..5dadd07f5 100644 --- a/Code/GraphMol/RingInfo.h +++ b/Code/GraphMol/RingInfo.h @@ -34,7 +34,7 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo { typedef std::vector INT_VECT; typedef std::vector VECT_INT_VECT; - RingInfo() {}; + RingInfo() {} RingInfo(const RingInfo &other) : df_init(other.df_init), d_atomMembers(other.d_atomMembers), @@ -44,12 +44,14 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo { d_atomRingFamilies(other.d_atomRingFamilies), d_bondRingFamilies(other.d_bondRingFamilies) #ifdef RDK_USE_URF - ,dp_urfData(other.dp_urfData) + , + dp_urfData(other.dp_urfData) #endif - {}; + { + } //! checks to see if we've been properly initialized - bool isInitialized() const { return df_init; }; + bool isInitialized() const { return df_init; } //! does initialization void initialize(); @@ -74,7 +76,8 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo { //! \name Atom information //@{ - //! returns a vector with sizes of the rings that atom with index \c idx is in. + //! returns a vector with sizes of the rings that atom with index \c idx is + //! in. /*! Notes: - the object must be initialized before calling this @@ -104,14 +107,15 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo { Notes: - the object must be initialized before calling this */ - const VECT_INT_VECT &atomRings() const { return d_atomRings; }; + const VECT_INT_VECT &atomRings() const { return d_atomRings; } //@} //! \name Bond information //@{ - //! returns a vector with sizes of the rings that bond with index \c idx is in. + //! returns a vector with sizes of the rings that bond with index \c idx is + //! in. /*! Notes: - the object must be initialized before calling this @@ -150,7 +154,7 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo { Notes: - the object must be initialized before calling this */ - const VECT_INT_VECT &bondRings() const { return d_bondRings; }; + const VECT_INT_VECT &bondRings() const { return d_bondRings; } #ifdef RDK_USE_URF //! adds a ring family to our data @@ -188,14 +192,14 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo { Notes: - the object must be initialized before calling this */ - const VECT_INT_VECT &atomRingFamilies() const { return d_atomRingFamilies; }; + const VECT_INT_VECT &atomRingFamilies() const { return d_atomRingFamilies; } //! returns our bond ring family vectors /*! Notes: - the object must be initialized before calling this */ - const VECT_INT_VECT &bondRingFamilies() const { return d_bondRingFamilies; }; + const VECT_INT_VECT &bondRingFamilies() const { return d_bondRingFamilies; } //! check if the ring families have been initialized bool areRingFamiliesInitialized() const { return dp_urfData != nullptr; } diff --git a/Code/GraphMol/SLNParse/SLNAttribs.h b/Code/GraphMol/SLNParse/SLNAttribs.h index fd0ad559c..600d200d9 100644 --- a/Code/GraphMol/SLNParse/SLNAttribs.h +++ b/Code/GraphMol/SLNParse/SLNAttribs.h @@ -53,8 +53,7 @@ typedef enum { class RDKIT_SLNPARSE_EXPORT AttribType { public: - AttribType() - : first(""), second(""), op("") {}; + AttribType() : first(""), second(""), op("") {} std::string first; std::string second; std::string op; diff --git a/Code/GraphMol/SLNParse/SLNParse.h b/Code/GraphMol/SLNParse/SLNParse.h index 11250e005..0a514f726 100644 --- a/Code/GraphMol/SLNParse/SLNParse.h +++ b/Code/GraphMol/SLNParse/SLNParse.h @@ -56,10 +56,10 @@ RDKIT_SLNPARSE_EXPORT RWMol *SLNQueryToMol(const std::string &smi, class RDKIT_SLNPARSE_EXPORT SLNParseException : public std::exception { public: - SLNParseException(const char *msg) : _msg(msg){}; - SLNParseException(const std::string &msg) : _msg(msg){}; - const char *what() const noexcept override { return _msg.c_str(); }; - ~SLNParseException() noexcept {}; + SLNParseException(const char *msg) : _msg(msg) {} + SLNParseException(const std::string &msg) : _msg(msg) {} + const char *what() const noexcept override { return _msg.c_str(); } + ~SLNParseException() noexcept {} private: std::string _msg; diff --git a/Code/GraphMol/SanitException.h b/Code/GraphMol/SanitException.h index 3db22ce34..4058f6f62 100644 --- a/Code/GraphMol/SanitException.h +++ b/Code/GraphMol/SanitException.h @@ -26,16 +26,16 @@ namespace RDKit { //! class for flagging sanitization errors class RDKIT_GRAPHMOL_EXPORT MolSanitizeException : public std::exception { public: - MolSanitizeException(const char *msg) : d_msg(msg){}; - MolSanitizeException(const std::string &msg) : d_msg(msg){}; + MolSanitizeException(const char *msg) : d_msg(msg) {} + MolSanitizeException(const std::string &msg) : d_msg(msg) {} MolSanitizeException(const MolSanitizeException &other) - : d_msg(other.d_msg){}; - virtual const char *what() const noexcept override { return d_msg.c_str(); }; - virtual ~MolSanitizeException() noexcept {}; + : d_msg(other.d_msg) {} + virtual const char *what() const noexcept override { return d_msg.c_str(); } + virtual ~MolSanitizeException() noexcept {} virtual MolSanitizeException *copy() const { return new MolSanitizeException(*this); - }; - virtual std::string getType() const { return "MolSanitizeException"; }; + } + virtual std::string getType() const { return "MolSanitizeException"; } protected: std::string d_msg; @@ -45,17 +45,17 @@ class RDKIT_GRAPHMOL_EXPORT AtomSanitizeException : public MolSanitizeException { public: AtomSanitizeException(const char *msg, unsigned int atomIdx) - : MolSanitizeException(msg), d_atomIdx(atomIdx){}; + : MolSanitizeException(msg), d_atomIdx(atomIdx) {} AtomSanitizeException(const std::string &msg, unsigned int atomIdx) - : MolSanitizeException(msg), d_atomIdx(atomIdx){}; + : MolSanitizeException(msg), d_atomIdx(atomIdx) {} AtomSanitizeException(const AtomSanitizeException &other) - : MolSanitizeException(other), d_atomIdx(other.d_atomIdx){}; - unsigned int getAtomIdx() const { return d_atomIdx; }; - virtual ~AtomSanitizeException() noexcept {}; + : MolSanitizeException(other), d_atomIdx(other.d_atomIdx) {} + unsigned int getAtomIdx() const { return d_atomIdx; } + virtual ~AtomSanitizeException() noexcept {} virtual MolSanitizeException *copy() const { return new AtomSanitizeException(*this); - }; - virtual std::string getType() const { return "AtomSanitizeException"; }; + } + virtual std::string getType() const { return "AtomSanitizeException"; } protected: unsigned int d_atomIdx; @@ -65,49 +65,47 @@ class RDKIT_GRAPHMOL_EXPORT AtomValenceException : public AtomSanitizeException { public: AtomValenceException(const char *msg, unsigned int atomIdx) - : AtomSanitizeException(msg, atomIdx){}; + : AtomSanitizeException(msg, atomIdx) {} AtomValenceException(const std::string &msg, unsigned int atomIdx) - : AtomSanitizeException(msg, atomIdx){}; + : AtomSanitizeException(msg, atomIdx) {} AtomValenceException(const AtomValenceException &other) - : AtomSanitizeException(other){}; - virtual ~AtomValenceException() noexcept {}; - MolSanitizeException *copy() const { - return new AtomValenceException(*this); - }; - std::string getType() const { return "AtomValenceException"; }; + : AtomSanitizeException(other) {} + virtual ~AtomValenceException() noexcept {} + MolSanitizeException *copy() const { return new AtomValenceException(*this); } + std::string getType() const { return "AtomValenceException"; } }; class RDKIT_GRAPHMOL_EXPORT AtomKekulizeException : public AtomSanitizeException { public: AtomKekulizeException(const char *msg, unsigned int atomIdx) - : AtomSanitizeException(msg, atomIdx){}; + : AtomSanitizeException(msg, atomIdx) {} AtomKekulizeException(const std::string &msg, unsigned int atomIdx) - : AtomSanitizeException(msg, atomIdx){}; + : AtomSanitizeException(msg, atomIdx) {} AtomKekulizeException(const AtomKekulizeException &other) - : AtomSanitizeException(other){}; - virtual ~AtomKekulizeException() noexcept {}; + : AtomSanitizeException(other) {} + virtual ~AtomKekulizeException() noexcept {} MolSanitizeException *copy() const { return new AtomKekulizeException(*this); - }; - std::string getType() const { return "AtomKekulizeException"; }; + } + std::string getType() const { return "AtomKekulizeException"; } }; class RDKIT_GRAPHMOL_EXPORT KekulizeException : public MolSanitizeException { public: KekulizeException(const char *msg, const std::vector &indices) - : MolSanitizeException(msg), d_atomIndices(indices){}; + : MolSanitizeException(msg), d_atomIndices(indices) {} KekulizeException(const std::string &msg, const std::vector &indices) - : MolSanitizeException(msg), d_atomIndices(indices){}; + : MolSanitizeException(msg), d_atomIndices(indices) {} KekulizeException(const KekulizeException &other) - : MolSanitizeException(other), d_atomIndices(other.d_atomIndices){}; + : MolSanitizeException(other), d_atomIndices(other.d_atomIndices) {} const std::vector &getAtomIndices() const { return d_atomIndices; - }; - virtual ~KekulizeException() noexcept {}; - MolSanitizeException *copy() const { return new KekulizeException(*this); }; - std::string getType() const { return "KekulizeException"; }; + } + virtual ~KekulizeException() noexcept {} + MolSanitizeException *copy() const { return new KekulizeException(*this); } + std::string getType() const { return "KekulizeException"; } protected: std::vector d_atomIndices; diff --git a/Code/GraphMol/ScaffoldNetwork/ScaffoldNetwork.h b/Code/GraphMol/ScaffoldNetwork/ScaffoldNetwork.h index 19063f99b..e3f04ef80 100644 --- a/Code/GraphMol/ScaffoldNetwork/ScaffoldNetwork.h +++ b/Code/GraphMol/ScaffoldNetwork/ScaffoldNetwork.h @@ -60,8 +60,7 @@ struct RDKIT_SCAFFOLDNETWORK_EXPORT ScaffoldNetworkParams { bondBreakersRxns; ///< the reaction(s) used to fragment. Should expect a ///< single reactant and produce two products ScaffoldNetworkParams() - : ScaffoldNetworkParams{ - {"[!#0;R:1]-!@[!#0:2]>>[*:1]-[#0].[#0]-[*:2]"}} {}; + : ScaffoldNetworkParams{{"[!#0;R:1]-!@[!#0:2]>>[*:1]-[#0].[#0]-[*:2]"}} {} ScaffoldNetworkParams(const std::vector &bondBreakersSmarts); }; @@ -77,9 +76,9 @@ struct RDKIT_SCAFFOLDNETWORK_EXPORT NetworkEdge { size_t beginIdx; size_t endIdx; EdgeType type; - NetworkEdge() : beginIdx(0), endIdx(0), type(EdgeType::Initialize){}; + NetworkEdge() : beginIdx(0), endIdx(0), type(EdgeType::Initialize) {} NetworkEdge(size_t bi, size_t ei, EdgeType typ) - : beginIdx(bi), endIdx(ei), type(typ){}; + : beginIdx(bi), endIdx(ei), type(typ) {} bool operator==(const RDKit::ScaffoldNetwork::NetworkEdge &o) const { return (beginIdx == o.beginIdx) && (endIdx == o.endIdx) && (type == o.type); } @@ -106,7 +105,7 @@ struct RDKIT_SCAFFOLDNETWORK_EXPORT ScaffoldNetwork { std::vector molCounts; ///< number of molecules each scaffold was found in std::vector edges; ///< edges in the network - ScaffoldNetwork(){}; + ScaffoldNetwork() {} #ifdef RDK_USE_BOOST_SERIALIZATION ScaffoldNetwork(const std::string &pkl) { std::stringstream iss(pkl); diff --git a/Code/GraphMol/ScaffoldNetwork/detail.h b/Code/GraphMol/ScaffoldNetwork/detail.h index 7479193ec..ce4d7671b 100644 --- a/Code/GraphMol/ScaffoldNetwork/detail.h +++ b/Code/GraphMol/ScaffoldNetwork/detail.h @@ -8,7 +8,6 @@ // of the RDKit source tree. // - #include #include @@ -16,15 +15,20 @@ namespace RDKit { namespace ScaffoldNetwork { namespace detail { -RDKIT_SCAFFOLDNETWORK_EXPORT std::vector> getMolFragments( +RDKIT_SCAFFOLDNETWORK_EXPORT std::vector> +getMolFragments(const ROMol &mol, const ScaffoldNetworkParams ¶ms); +RDKIT_SCAFFOLDNETWORK_EXPORT ROMol *makeScaffoldGeneric(const ROMol &mol, + bool doAtoms, + bool doBonds); +RDKIT_SCAFFOLDNETWORK_EXPORT ROMol *removeAttachmentPoints( const ROMol &mol, const ScaffoldNetworkParams ¶ms); -RDKIT_SCAFFOLDNETWORK_EXPORT ROMol *makeScaffoldGeneric(const ROMol &mol, bool doAtoms, bool doBonds); -RDKIT_SCAFFOLDNETWORK_EXPORT ROMol *removeAttachmentPoints(const ROMol &mol, - const ScaffoldNetworkParams ¶ms); -RDKIT_SCAFFOLDNETWORK_EXPORT ROMol *pruneMol(const ROMol &mol, const ScaffoldNetworkParams ¶ms); -RDKIT_SCAFFOLDNETWORK_EXPORT ROMol *flattenMol(const ROMol &mol, const ScaffoldNetworkParams ¶ms); -RDKIT_SCAFFOLDNETWORK_EXPORT void addMolToNetwork(const ROMol &mol, ScaffoldNetwork &network, - const ScaffoldNetworkParams ¶ms); +RDKIT_SCAFFOLDNETWORK_EXPORT ROMol *pruneMol( + const ROMol &mol, const ScaffoldNetworkParams ¶ms); +RDKIT_SCAFFOLDNETWORK_EXPORT ROMol *flattenMol( + const ROMol &mol, const ScaffoldNetworkParams ¶ms); +RDKIT_SCAFFOLDNETWORK_EXPORT void addMolToNetwork( + const ROMol &mol, ScaffoldNetwork &network, + const ScaffoldNetworkParams ¶ms); } // namespace detail } // namespace ScaffoldNetwork } // namespace RDKit diff --git a/Code/GraphMol/SmilesParse/SmilesParse.h b/Code/GraphMol/SmilesParse/SmilesParse.h index 05b18f293..5ea64e343 100644 --- a/Code/GraphMol/SmilesParse/SmilesParse.h +++ b/Code/GraphMol/SmilesParse/SmilesParse.h @@ -102,10 +102,10 @@ RDKIT_SMILESPARSE_EXPORT Bond *SmartsToBond(const std::string &sma); class RDKIT_SMILESPARSE_EXPORT SmilesParseException : public std::exception { public: - SmilesParseException(const char *msg) : _msg(msg){}; - SmilesParseException(const std::string msg) : _msg(msg){}; - const char *what() const noexcept override { return _msg.c_str(); }; - ~SmilesParseException() noexcept {}; + SmilesParseException(const char *msg) : _msg(msg) {} + SmilesParseException(const std::string msg) : _msg(msg) {} + const char *what() const noexcept override { return _msg.c_str(); } + ~SmilesParseException() noexcept {} private: std::string _msg; diff --git a/Code/GraphMol/StereoGroup.h b/Code/GraphMol/StereoGroup.h index 53bc31041..6d5e2bc61 100644 --- a/Code/GraphMol/StereoGroup.h +++ b/Code/GraphMol/StereoGroup.h @@ -44,7 +44,7 @@ class RDKIT_GRAPHMOL_EXPORT StereoGroup { std::vector d_atoms; public: - StereoGroup() : d_atoms(0u){}; + StereoGroup() : d_atoms(0u) {} // Takes control of atoms if possible. StereoGroup(StereoGroupType grouptype, std::vector&& atoms); StereoGroup(StereoGroupType grouptype, const std::vector& atoms); @@ -54,10 +54,10 @@ class RDKIT_GRAPHMOL_EXPORT StereoGroup { // won't build bool operator==(const StereoGroup& other) const { return (d_grouptype == other.d_grouptype) && (d_atoms == other.d_atoms); - }; + } bool operator!=(const StereoGroup& other) const { return (d_grouptype != other.d_grouptype) || (d_atoms != other.d_atoms); - }; + } }; RDKIT_GRAPHMOL_EXPORT void removeGroupsWithAtom( const Atom* atom, std::vector& groups); diff --git a/Code/GraphMol/SubstanceGroup.h b/Code/GraphMol/SubstanceGroup.h index dfc4c87cd..9a1b999b6 100644 --- a/Code/GraphMol/SubstanceGroup.h +++ b/Code/GraphMol/SubstanceGroup.h @@ -35,9 +35,9 @@ class RDKIT_GRAPHMOL_EXPORT SubstanceGroupException : public std::runtime_error { public: //! construct with an error message - SubstanceGroupException(const char *msg) : std::runtime_error(msg){}; + SubstanceGroupException(const char *msg) : std::runtime_error(msg) {} //! construct with an error message - SubstanceGroupException(const std::string &msg) : std::runtime_error(msg){}; + SubstanceGroupException(const std::string &msg) : std::runtime_error(msg) {} }; //! The class for representing SubstanceGroups @@ -101,10 +101,10 @@ class RDKIT_GRAPHMOL_EXPORT SubstanceGroup : public RDProps { SubstanceGroup &operator=(SubstanceGroup &&other) = default; //! Destructor - ~SubstanceGroup(){}; + ~SubstanceGroup() {} //! returns whether or not this belongs to a molecule - bool hasOwningMol() const { return dp_mol != nullptr; }; + bool hasOwningMol() const { return dp_mol != nullptr; } //! Get the molecule that owns this instance ROMol &getOwningMol() const { @@ -142,7 +142,9 @@ class RDKIT_GRAPHMOL_EXPORT SubstanceGroup : public RDProps { const std::vector &getBonds() const { return d_bonds; } void setAtoms(std::vector atoms) { d_atoms = std::move(atoms); } - void setParentAtoms(std::vector patoms) { d_patoms = std::move(patoms); } + void setParentAtoms(std::vector patoms) { + d_patoms = std::move(patoms); + } void setBonds(std::vector bonds) { d_bonds = std::move(bonds); } const std::vector &getBrackets() const { return d_brackets; } @@ -153,9 +155,9 @@ class RDKIT_GRAPHMOL_EXPORT SubstanceGroup : public RDProps { std::vector &getCStates() { return d_cstates; } std::vector &getAttachPoints() { return d_saps; } - void clearBrackets() { d_brackets.clear(); }; - void clearCStates() { d_cstates.clear(); }; - void clearAttachPoints() { d_saps.clear(); }; + void clearBrackets() { d_brackets.clear(); } + void clearCStates() { d_cstates.clear(); } + void clearAttachPoints() { d_saps.clear(); } //! adjusts our atom IDs to reflect that an atom has been removed from the //! parent molecule diff --git a/Code/GraphMol/Substruct/SubstructMatch.h b/Code/GraphMol/Substruct/SubstructMatch.h index a0408cb21..cd0912985 100644 --- a/Code/GraphMol/Substruct/SubstructMatch.h +++ b/Code/GraphMol/Substruct/SubstructMatch.h @@ -52,7 +52,7 @@ struct RDKIT_SUBSTRUCTMATCH_EXPORT SubstructMatchParameters { extraFinalCheck; //!< a function to be called at the end to validate a //!< match - SubstructMatchParameters(){}; + SubstructMatchParameters() {} }; RDKIT_SUBSTRUCTMATCH_EXPORT void updateSubstructMatchParamsFromJSON( @@ -209,15 +209,14 @@ inline unsigned int SubstructMatch(ResonanceMolSupplier &resMolSupplier, return matchVect.size(); }; -//! Class used as a final step to confirm whether or not a given atom->atom mapping is a valid -//! substructure match. +//! Class used as a final step to confirm whether or not a given atom->atom +//! mapping is a valid substructure match. class RDKIT_SUBSTRUCTMATCH_EXPORT MolMatchFinalCheckFunctor { public: MolMatchFinalCheckFunctor(const ROMol &query, const ROMol &mol, const SubstructMatchParameters &ps); - bool operator()(const std::uint32_t q_c[], - const std::uint32_t m_c[]) const; + bool operator()(const std::uint32_t q_c[], const std::uint32_t m_c[]) const; private: const ROMol &d_query; diff --git a/Code/GraphMol/Substruct/ullmann.hpp b/Code/GraphMol/Substruct/ullmann.hpp index dbf89b492..2476c54a5 100644 --- a/Code/GraphMol/Substruct/ullmann.hpp +++ b/Code/GraphMol/Substruct/ullmann.hpp @@ -1,5 +1,5 @@ // morpho/cdl/bgl_expansions/algorithms/ullmann.hpp header file// -// Copyright (c) 2003-2008 Vladimir J. Sykora +// Copyright (c) 2003-2008 Vladimir J. Sykora // Copyright (c) 2007-2008 Vladimir J. Sykora and NCU Studies Ltd // Modifications by Greg Landrum, January 2009 // @@ -10,14 +10,14 @@ // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: -// +// // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT @@ -41,204 +41,224 @@ #include #include // -------- std -#include // for std::pair<> +#include // for std::pair<> #include namespace boost { - namespace detail { +namespace detail { - template - bool forward_checking(const Graph& g1, const Graph& g2, - UblasMatrix& M, size_t count, BackInsertionSequence& F, size_t num_vert_g1, - size_t num_vert_g2, EdgeLabeling& edge_labeling){ - typedef std::pair::edge_descriptor,bool> edge_presence; - typename BackInsertionSequence::iterator fi, fi_end=F.end(); - for (size_t k=count+1; kfirst,g1); - if(ep1.second) { - flag1_1=true; - edge_presence ep2=edge(l,fi->second,g2); - if(ep2.second) flag1=edge_labeling(ep1.first,ep2.first); - } - if(flag1_1 && flag1) { - M(k,l)=1; - ++fi; - continue; - } - edge_presence ep2=edge(l,fi->second,g2); - if(ep2.second) { - flag2_1=true; - ep1=edge(k,fi->first,g1); - if(ep1.second){ - flag2=edge_labeling(ep1.first,ep2.first); - } else { - // ring closed in main structure, not closed in query. This should pass - flag2=true; - } - } - if(flag2_1 && flag2) { //if one edge exists, there must be a mapping - M(k,l)=1; - } - else if ( !flag1_1 && !flag2_1 ) { // or both edges are not present - M(k,l)=1; - } - else M(k,l)=0; // if not, there's no mapping - ++fi; - } +template +bool forward_checking(const Graph& g1, const Graph& g2, UblasMatrix& M, + size_t count, BackInsertionSequence& F, + size_t num_vert_g1, size_t num_vert_g2, + EdgeLabeling& edge_labeling) { + typedef std::pair::edge_descriptor, bool> + edge_presence; + typename BackInsertionSequence::iterator fi, fi_end = F.end(); + for (size_t k = count + 1; k < num_vert_g1; ++k) { + for (size_t l = 0; l < num_vert_g2; ++l) { + if (!M(k, l)) continue; + // check mapping: + fi = F.begin(); + while (fi != fi_end) { + bool flag1(0), flag1_1(0), flag2(0), flag2_1(0); + edge_presence ep1 = edge(k, fi->first, g1); + if (ep1.second) { + flag1_1 = true; + edge_presence ep2 = edge(l, fi->second, g2); + if (ep2.second) flag1 = edge_labeling(ep1.first, ep2.first); } - } - // TODO: change the data structure of the M matrix to sparse matrix. This wouldn't be necessary - size_t cero_row(0); - for (size_t k=0; k - bool backtrack(const Graph& g1, const Graph& g2, size_t count, - const UblasMatrix& M, BackInsertionSequence& F, const size_t num_vert_g1, - const size_t num_vert_g2, EdgeLabeling& edge_labeling){ - if(count==num_vert_g1) return true; - for (size_t i=0; i - void backtrack_all(const Graph& g1, const Graph& g2, size_t count, - const UblasMatrix& M, DoubleBackInsertionSequence& FF, const size_t num_vert_g1, - const size_t num_vert_g2, EdgeLabeling& edge_labeling) { - if(count==num_vert_g1) return; - DoubleBackInsertionSequence holdFF; - holdFF.insert(holdFF.begin(),FF.begin(),FF.end()); - FF.clear(); - for (size_t i=0; isecond, g2); + if (ep2.second) { + flag2_1 = true; + ep1 = edge(k, fi->first, g1); + if (ep1.second) { + flag2 = edge_labeling(ep1.first, ep2.first); } else { - typename DoubleBackInsertionSequence::value_type F; - F.push_back(std::make_pair(count,i)); - if (forward_checking(g1,g2,M_prime,count,F,num_vert_g1,num_vert_g2,edge_labeling)){ - tFF.push_back(F); - } + // ring closed in main structure, not closed in query. This should + // pass + flag2 = true; } - backtrack_all(g1,g2,count+1,M_prime,tFF,num_vert_g1,num_vert_g2,edge_labeling); - if(tFF.size()){ - for(typename DoubleBackInsertionSequence::const_iterator iter=tFF.begin(); - iter!=tFF.end();++iter){ - FF.push_back(*iter); - } + } + if (flag2_1 && flag2) { // if one edge exists, there must be a mapping + M(k, l) = 1; + } else if (!flag1_1 && !flag2_1) { // or both edges are not present + M(k, l) = 1; + } else + M(k, l) = 0; // if not, there's no mapping + ++fi; + } + } + } + // TODO: change the data structure of the M matrix to sparse matrix. This + // wouldn't be necessary + size_t cero_row(0); + for (size_t k = 0; k < num_vert_g1; ++k) { + for (size_t l = 0; l < num_vert_g2; ++l) { + if (M(k, l)) + break; + else + ++cero_row; + } + if (cero_row == num_vert_g2) return false; // if there is a cero row + cero_row = 0; + } + return true; +} + +template +bool backtrack(const Graph& g1, const Graph& g2, size_t count, + const UblasMatrix& M, BackInsertionSequence& F, + const size_t num_vert_g1, const size_t num_vert_g2, + EdgeLabeling& edge_labeling) { + if (count == num_vert_g1) return true; + for (size_t i = 0; i < num_vert_g2; ++i) { + if (M(count, i)) { + F.push_back(std::make_pair(count, i)); + UblasMatrix M_prime(M); + for (size_t m = count + 1; m < num_vert_g1; ++m) { + M_prime(m, i) = 0; + } + + if (forward_checking(g1, g2, M_prime, count, F, num_vert_g1, num_vert_g2, + edge_labeling)) { + if (backtrack(g1, g2, count + 1, M_prime, F, num_vert_g1, num_vert_g2, + edge_labeling)) { + return true; + } + } + F.erase(std::remove(F.begin(), F.end(), std::make_pair(count, i)), + F.end()); + } + } + return false; +} + +template +void backtrack_all(const Graph& g1, const Graph& g2, size_t count, + const UblasMatrix& M, DoubleBackInsertionSequence& FF, + const size_t num_vert_g1, const size_t num_vert_g2, + EdgeLabeling& edge_labeling) { + if (count == num_vert_g1) return; + DoubleBackInsertionSequence holdFF; + holdFF.insert(holdFF.begin(), FF.begin(), FF.end()); + FF.clear(); + for (size_t i = 0; i < num_vert_g2; ++i) { + if (M(count, i)) { + DoubleBackInsertionSequence tFF; + + UblasMatrix M_prime(M); + for (size_t m = count + 1; m < num_vert_g1; ++m) { + M_prime(m, i) = 0; + } + + if (holdFF.size()) { + for (typename DoubleBackInsertionSequence::const_iterator iter = + holdFF.begin(); + iter != holdFF.end(); ++iter) { + typename DoubleBackInsertionSequence::value_type F = *iter; + F.push_back(std::make_pair(count, i)); + if (forward_checking(g1, g2, M_prime, count, F, num_vert_g1, + num_vert_g2, edge_labeling)) { + tFF.push_back(F); } } + } else { + typename DoubleBackInsertionSequence::value_type F; + F.push_back(std::make_pair(count, i)); + if (forward_checking(g1, g2, M_prime, count, F, num_vert_g1, + num_vert_g2, edge_labeling)) { + tFF.push_back(F); + } + } + backtrack_all(g1, g2, count + 1, M_prime, tFF, num_vert_g1, num_vert_g2, + edge_labeling); + if (tFF.size()) { + for (typename DoubleBackInsertionSequence::const_iterator iter = + tFF.begin(); + iter != tFF.end(); ++iter) { + FF.push_back(*iter); + } } } + } +} - template < class Graph - , class VertexLabeling // binary predicate - , class UblasMatrix - > - void prepareM(const Graph& g1, const Graph& g2, - VertexLabeling& vertex_labeling,UblasMatrix &M){ - size_t rows(num_vertices(g1)); - size_t cols(num_vertices(g2)); - M.resize(rows,cols); - // initialize the matrix: - for (size_t i=0; i=out_degree(i,g1) && vertex_labeling(i,j)) { - M(i,j)=1; - } - else M(i,j)=0; - } - } +template +void prepareM(const Graph& g1, const Graph& g2, VertexLabeling& vertex_labeling, + UblasMatrix& M) { + size_t rows(num_vertices(g1)); + size_t cols(num_vertices(g2)); + M.resize(rows, cols); + // initialize the matrix: + for (size_t i = 0; i < rows; ++i) { + for (size_t j = 0; j < cols; ++j) { + if (out_degree(j, g2) >= out_degree(i, g1) && vertex_labeling(i, j)) { + M(i, j) = 1; + } else + M(i, j) = 0; } - } // namespace detail - - - // test if g1 is a subgraph of g2. mapped vertices are returned in F - // Mapping : first: g1 vertices, second : g2 vertices - // O( num_vertices(g1)! num_vertices(g1) ^ 3 ) - // This function doesnt Work with filtered graphs! - // The size of F doesn't indicate match! - template < class Graph - , class VertexLabeling // binary predicate - , class EdgeLabeling // binary predicate - , class BackInsertionSequence // contains std::pair - > - bool ullmann(const Graph& g1, const Graph& g2, - VertexLabeling& vertex_labeling, EdgeLabeling& edge_labeling, BackInsertionSequence& F) { - typedef ::boost::numeric::ublas::matrix matrix_t; - size_t rows(num_vertices(g1)); - size_t cols(num_vertices(g2)); - matrix_t M; - detail::prepareM(g1,g2,vertex_labeling,M); - size_t count(0); - return detail::backtrack(g1,g2,count,M,F,rows,cols,edge_labeling); } +} +} // namespace detail - // test if g1 is a subgraph of g2. - // F returns all mappings of g1 in g2. mapping in separate containers - template < class Graph - , class VertexLabeling // binary predicate - , class EdgeLabeling // binary predicate - , class DoubleBackInsertionSequence // contains a back insertion sequence - > - bool ullmann_all(const Graph& g1, const Graph& g2, - VertexLabeling& vertex_labeling, EdgeLabeling& edge_labeling, DoubleBackInsertionSequence& F) { - typedef ::boost::numeric::ublas::matrix matrix_t; - size_t rows(num_vertices(g1)); - size_t cols(num_vertices(g2)); - matrix_t M; - detail::prepareM(g1,g2,vertex_labeling,M); - size_t count(0); - detail::backtrack_all(g1,g2,count,M,F,rows,cols,edge_labeling); - return !F.empty(); - } +// test if g1 is a subgraph of g2. mapped vertices are returned in F +// Mapping : first: g1 vertices, second : g2 vertices +// O( num_vertices(g1)! num_vertices(g1) ^ 3 ) +// This function doesnt Work with filtered graphs! +// The size of F doesn't indicate match! +template < + class Graph, class VertexLabeling // binary predicate + , + class EdgeLabeling // binary predicate + , + class + BackInsertionSequence // contains + // std::pair + > +bool ullmann(const Graph& g1, const Graph& g2, VertexLabeling& vertex_labeling, + EdgeLabeling& edge_labeling, BackInsertionSequence& F) { + typedef ::boost::numeric::ublas::matrix matrix_t; + size_t rows(num_vertices(g1)); + size_t cols(num_vertices(g2)); + matrix_t M; + detail::prepareM(g1, g2, vertex_labeling, M); + size_t count(0); + return detail::backtrack(g1, g2, count, M, F, rows, cols, edge_labeling); +} + +// test if g1 is a subgraph of g2. +// F returns all mappings of g1 in g2. mapping in separate containers +template +bool ullmann_all(const Graph& g1, const Graph& g2, + VertexLabeling& vertex_labeling, EdgeLabeling& edge_labeling, + DoubleBackInsertionSequence& F) { + typedef ::boost::numeric::ublas::matrix matrix_t; + size_t rows(num_vertices(g1)); + size_t cols(num_vertices(g2)); + matrix_t M; + detail::prepareM(g1, g2, vertex_labeling, M); + size_t count(0); + detail::backtrack_all(g1, g2, count, M, F, rows, cols, edge_labeling); + return !F.empty(); +} } // namespace boost - -#endif // MORPHO_CDL_BGL_EXP_ULLMANN_HPP - - +#endif // MORPHO_CDL_BGL_EXP_ULLMANN_HPP diff --git a/Code/GraphMol/Substruct/vf2.hpp b/Code/GraphMol/Substruct/vf2.hpp index 4deec082c..fb6cf4797 100644 --- a/Code/GraphMol/Substruct/vf2.hpp +++ b/Code/GraphMol/Substruct/vf2.hpp @@ -190,7 +190,7 @@ class VF2SubState { // es_compared = new std::map(); *share_count = 1; - }; + } VF2SubState(const VF2SubState &state) : g1(state.g1), @@ -215,7 +215,7 @@ class VF2SubState { share_count = state.share_count; ++(*share_count); - }; + } ~VF2SubState() { if (--*share_count == 0) { @@ -228,13 +228,13 @@ class VF2SubState { // delete [] vs_compared; // delete es_compared; } - }; + } - bool IsGoal() { return core_len == n1; }; + bool IsGoal() { return core_len == n1; } bool MatchChecks(const node_id c1[], const node_id c2[]) { return mc(c1, c2); - }; - bool IsDead() { return n1 > n2 || t1_len > t2_len; }; + } + bool IsDead() { return n1 > n2 || t1_len > t2_len; } unsigned int CoreLen() { return core_len; } Graph *GetGraph1() { return g1; } Graph *GetGraph2() { return g2; } @@ -325,7 +325,7 @@ class VF2SubState { } } return pair.n1 < n1 && pair.n2 < n2; - }; + } bool IsFeasiblePair(node_id node1, node_id node2) { assert(node1 < n1); assert(node2 < n2); @@ -400,7 +400,7 @@ class VF2SubState { #else return true; #endif - }; + } void AddPair(node_id node1, node_id node2) { assert(node1 < n1); assert(node2 < n2); @@ -443,7 +443,7 @@ class VF2SubState { } ++bNbrs; } - }; + } void GetCoreSet(node_id c1[], node_id c2[]) { unsigned int i, j; for (i = 0, j = 0; i < n1; ++i) { @@ -453,8 +453,8 @@ class VF2SubState { ++j; } } - }; - VF2SubState *Clone() { return new VF2SubState(*this); }; + } + VF2SubState *Clone() { return new VF2SubState(*this); } void BackTrack(node_id node1, node_id node2) { if (term_1[node1] == core_len) { term_1[node1] = 0; @@ -490,7 +490,7 @@ class VF2SubState { core_1[node1] = NULL_NODE; core_2[node2] = NULL_NODE; --core_len; - }; + } bool Match(node_id c1[], node_id c2[]) { if (IsGoal()) { GetCoreSet(c1, c2); diff --git a/Code/GraphMol/SubstructLibrary/PatternFactory.h b/Code/GraphMol/SubstructLibrary/PatternFactory.h index ffead74d1..3d3c5ca1d 100644 --- a/Code/GraphMol/SubstructLibrary/PatternFactory.h +++ b/Code/GraphMol/SubstructLibrary/PatternFactory.h @@ -19,7 +19,8 @@ namespace RDKit { /* \param sslib The substructure library (without pattern fingerprints) \param patterns if supplied, use this pattern holder and take ownership - \param numThreads the number of threads to use, -1 for all threads [default 1] + \param numThreads the number of threads to use, -1 for all threads + [default 1] */ RDKIT_SUBSTRUCTLIBRARY_EXPORT void addPatterns( SubstructLibrary &sslib, boost::shared_ptr patterns, @@ -29,10 +30,11 @@ RDKIT_SUBSTRUCTLIBRARY_EXPORT void addPatterns( //! The substructure library must not already have fingerprints /* \param sslib The substructure library (without pattern fingerprints) - \param numThreads the number of threads to use, -1 for all threads [default 1] + \param numThreads the number of threads to use, -1 for all threads + [default 1] */ RDKIT_SUBSTRUCTLIBRARY_EXPORT void addPatterns(SubstructLibrary &sslib, -int numThreads = 1); + int numThreads = 1); } // namespace RDKit #endif diff --git a/Code/GraphMol/SubstructLibrary/SubstructLibrary.h b/Code/GraphMol/SubstructLibrary/SubstructLibrary.h index 8d26e3067..aa38b3536 100644 --- a/Code/GraphMol/SubstructLibrary/SubstructLibrary.h +++ b/Code/GraphMol/SubstructLibrary/SubstructLibrary.h @@ -482,22 +482,26 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { //! Get the matching indices for the query /*! \param query Query or Tautomer Query to match against molecules - \param recursionPossible flags whether or not recursive matches are allowed [ default true ] - \param useChirality use atomic CIP codes as part of the comparison [ default true ] - \param useQueryQueryMatches if set, the contents of atom and bond queries [ default false ] + \param recursionPossible flags whether or not recursive matches are allowed + [default true] + \param useChirality use atomic CIP codes as part of the comparison + [default true] + \param useQueryQueryMatches if set, the contents of atom and bond queries will be used as part of the matching + [default false] \param numThreads If -1 use all available processors [default -1] - \param maxResults Maximum results to return, -1 means return all [default -1] + \param maxResults Maximum results to return, -1 means return all + [default -1] */ - template + template std::vector getMatches(const Query &query, bool recursionPossible = true, bool useChirality = true, bool useQueryQueryMatches = false, int numThreads = -1, int maxResults = -1) const { - return getMatches(query, 0, size(), recursionPossible, useChirality, useQueryQueryMatches, - numThreads, maxResults); + return getMatches(query, 0, size(), recursionPossible, useChirality, + useQueryQueryMatches, numThreads, maxResults); } std::vector getMatches( const ROMol &query, unsigned int startIdx, unsigned int endIdx, @@ -509,12 +513,16 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { \param query Query to match against molecules \param startIdx Start index of the search \param endIdx Ending idx (non-inclusive) of the search. - \param recursionPossible flags whether or not recursive matches are allowed [default true ] - \param useChirality use atomic CIP codes as part of the comparison [default true ] + \param recursionPossible flags whether or not recursive matches are allowed + [default true] + \param useChirality use atomic CIP codes as part of the comparison + [default true] \param useQueryQueryMatches if set, the contents of atom and bond queries - will be used as part of the matching [default false ] + will be used as part of the matching + [default false] \param numThreads If -1 use all available processors [default -1] - \param maxResults Maximum results to return, -1 means return all [default -1] + \param maxResults Maximum results to return, -1 means return all + [default -1] */ std::vector getMatches( const TautomerQuery &query, unsigned int startIdx, unsigned int endIdx, @@ -524,18 +532,22 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { //! Return the number of matches for the query /*! \param query Molecule or Tautomer Query to match against molecules - \param recursionPossible flags whether or not recursive matches are allowed [ default true ] - \param useChirality use atomic CIP codes as part of the comparison [ default true ] - \param useQueryQueryMatches if set, the contents of atom and bond queries - will be used as part of the matching [ default false ] + \param recursionPossible flags whether or not recursive matches are allowed + [default true] + \param useChirality use atomic CIP codes as part of the comparison + [default true] + \param useQueryQueryMatches if set, the contents of atom and bond queries + will be used as part of the matching + [default false] \param numThreads If -1 use all available processors [default -1] */ - template + template unsigned int countMatches(const Query &query, bool recursionPossible = true, bool useChirality = true, bool useQueryQueryMatches = false, int numThreads = -1) const { - return countMatches(query, 0, size(), recursionPossible, useChirality, useQueryQueryMatches, numThreads); + return countMatches(query, 0, size(), recursionPossible, useChirality, + useQueryQueryMatches, numThreads); } //! Return the number of matches for the query @@ -544,10 +556,13 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { \param query Query to match against molecules \param startIdx Start index of the search \param endIdx Ending idx (non-inclusive) of the search. - \param recursionPossible flags whether or not recursive matches are allowed [ default true ] - \param useChirality use atomic CIP codes as part of the comparison [ default true ] - \param useQueryQueryMatches if set, the contents of atom and bond queries - will be used as part of the matching [ default false ] + \param recursionPossible flags whether or not recursive matches are allowed + [default true] + \param useChirality use atomic CIP codes as part of the comparison + [default true] + \param useQueryQueryMatches if set, the contents of atom and bond queries + will be used as part of the matching + [default false] \param numThreads If -1 use all available processors [default -1] */ unsigned int countMatches(const ROMol &query, unsigned int startIdx, @@ -560,10 +575,13 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { \param query TautomerQuery to match against molecules \param startIdx Start index of the search \param endIdx Ending idx (non-inclusive) of the search. - \param recursionPossible flags whether or not recursive matches are allowed [ default true ] - \param useChirality use atomic CIP codes as part of the comparison [ default true ] - \param useQueryQueryMatches if set, the contents of atom and bond queries - will be used as part of the matching [ default false ] + \param recursionPossible flags whether or not recursive matches are allowed + [default true] + \param useChirality use atomic CIP codes as part of the comparison + [default true] + \param useQueryQueryMatches if set, the contents of atom and bond queries + will be used as part of the matching + [default false] \param numThreads If -1 use all available processors [default -1] */ unsigned int countMatches(const TautomerQuery &query, unsigned int startIdx, @@ -574,17 +592,21 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { //! Returns true if any match exists for the query /*! \param query Molecule or Tautomer Query to match against molecules - \param recursionPossible flags whether or not recursive matches are allowed [ default true ] - \param useChirality use atomic CIP codes as part of the comparison [ default true ] - \param useQueryQueryMatches if set, the contents of atom and bond queries - will be used as part of the matching [ default false ] + \param recursionPossible flags whether or not recursive matches are allowed + [default true] + \param useChirality use atomic CIP codes as part of the comparison + [default true] + \param useQueryQueryMatches if set, the contents of atom and bond queries + will be used as part of the matching + [default false] \param numThreads If -1 use all available processors [default -1] */ - template + template bool hasMatch(const Query &query, bool recursionPossible = true, bool useChirality = true, bool useQueryQueryMatches = false, int numThreads = -1) const { - return hasMatch(query, 0, size(), recursionPossible, useChirality, useQueryQueryMatches, numThreads); + return hasMatch(query, 0, size(), recursionPossible, useChirality, + useQueryQueryMatches, numThreads); } //! Returns true if any match exists for the query between the specified //! indices @@ -592,10 +614,13 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { \param query Query to match against molecules \param startIdx Start index of the search \param endIdx Ending idx (inclusive) of the search. - \param recursionPossible flags whether or not recursive matches are allowed [ default true ] - \param useChirality use atomic CIP codes as part of the comparison [ default true ] - \param useQueryQueryMatches if set, the contents of atom and bond queries - will be used as part of the matching [ default false ] + \param recursionPossible flags whether or not recursive matches are allowed + [default true] + \param useChirality use atomic CIP codes as part of the comparison + [default true] + \param useQueryQueryMatches if set, the contents of atom and bond queries + will be used as part of the matching + [default false] \param numThreads If -1 use all available processors [default -1] */ bool hasMatch(const ROMol &query, unsigned int startIdx, unsigned int endIdx, @@ -607,10 +632,13 @@ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary { \param query TautomerQuery to match against molecules \param startIdx Start index of the search \param endIdx Ending idx (inclusive) of the search. - \param recursionPossible flags whether or not recursive matches are allowed [ default true ] - \param useChirality use atomic CIP codes as part of the comparison [ default true ] - \param useQueryQueryMatches if set, the contents of atom and bond queries - will be used as part of the matching [default false ] + \param recursionPossible flags whether or not recursive matches are + allowed [default true] + \param useChirality use atomic CIP codes as part of the comparison + [default true] + \param useQueryQueryMatches if set, the contents of atom and bond queries + will be used as part of the matching + [default false] \param numThreads If -1 use all available processors [default -1] */ bool hasMatch(const TautomerQuery &query, unsigned int startIdx, diff --git a/Code/GraphMol/TautomerQuery/TautomerQuery.h b/Code/GraphMol/TautomerQuery/TautomerQuery.h index fa2370ba5..c322e6a25 100644 --- a/Code/GraphMol/TautomerQuery/TautomerQuery.h +++ b/Code/GraphMol/TautomerQuery/TautomerQuery.h @@ -18,7 +18,6 @@ #include #include - namespace RDKit { class RWMol; @@ -45,17 +44,19 @@ class RDKIT_TAUTOMERQUERY_EXPORT TautomerQuery { const std::vector &modifiedBonds); //! Copy constructor performs a deep copy - TautomerQuery(const TautomerQuery &other) : - d_templateMolecule(other.d_templateMolecule ? new ROMol(*other.d_templateMolecule) : nullptr), - d_modifiedAtoms(other.d_modifiedAtoms), - d_modifiedBonds(other.d_modifiedBonds) { - PRECONDITION(other.d_templateMolecule != nullptr, "Null template"); - for(auto taut : other.d_tautomers) { - PRECONDITION(taut.get() != nullptr, "Null tautomer"); - d_tautomers.push_back(boost::make_shared(*taut)); - } - } - + TautomerQuery(const TautomerQuery &other) + : d_templateMolecule(other.d_templateMolecule + ? new ROMol(*other.d_templateMolecule) + : nullptr), + d_modifiedAtoms(other.d_modifiedAtoms), + d_modifiedBonds(other.d_modifiedBonds) { + PRECONDITION(other.d_templateMolecule != nullptr, "Null template"); + for (auto taut : other.d_tautomers) { + PRECONDITION(taut.get() != nullptr, "Null tautomer"); + d_tautomers.push_back(boost::make_shared(*taut)); + } + } + // Factory to build TautomerQuery // Caller owns the memory static TautomerQuery *fromMol( @@ -73,7 +74,8 @@ class RDKIT_TAUTOMERQUERY_EXPORT TautomerQuery { SubstructMatchParameters()); // Query fingerprint - ExplicitBitVect *patternFingerprintTemplate(unsigned int fpSize = 2048U) const; + ExplicitBitVect *patternFingerprintTemplate( + unsigned int fpSize = 2048U) const; // Static method to Fingerprint a target static ExplicitBitVect *patternFingerprintTarget(const ROMol &target, unsigned int fpSize = 2048U); @@ -81,7 +83,7 @@ class RDKIT_TAUTOMERQUERY_EXPORT TautomerQuery { // accessors // pointer is owned by TautomerQuery - const ROMol & getTemplateMolecule() const { return *d_templateMolecule; } + const ROMol &getTemplateMolecule() const { return *d_templateMolecule; } const std::vector getTautomers() const { return d_tautomers; } diff --git a/Code/GraphMol/Trajectory/Snapshot.h b/Code/GraphMol/Trajectory/Snapshot.h index 427c1d3ea..509016140 100644 --- a/Code/GraphMol/Trajectory/Snapshot.h +++ b/Code/GraphMol/Trajectory/Snapshot.h @@ -49,7 +49,7 @@ class RDKIT_TRAJECTORY_EXPORT Snapshot { RDGeom::Point3D getPoint3D(unsigned int pointNum) const; /*! \return the energy for this Snapshot */ - double getEnergy() const { return d_energy; }; + double getEnergy() const { return d_energy; } /*! \brief Sets the energy for this Snapshot \param energy the energy value assigned to this Snapshot */ diff --git a/Code/GraphMol/Trajectory/Trajectory.h b/Code/GraphMol/Trajectory/Trajectory.h index 601106e6b..623bc8d03 100644 --- a/Code/GraphMol/Trajectory/Trajectory.h +++ b/Code/GraphMol/Trajectory/Trajectory.h @@ -68,7 +68,7 @@ class RDKIT_TRAJECTORY_EXPORT Trajectory { */ unsigned int removeSnapshot(unsigned int snapshotNum); //! Clear all Snapshots from a Trajectory - void clear() { d_snapshotVect->clear(); }; + void clear() { d_snapshotVect->clear(); } //! Add conformations from the Trajectory to a molecule /*! \param mol - ROMol to which Conformers with coordinates from the Trajectory diff --git a/Code/GraphMol/Wrap/MolSupplier.h b/Code/GraphMol/Wrap/MolSupplier.h index d0ad0a697..150eab382 100644 --- a/Code/GraphMol/Wrap/MolSupplier.h +++ b/Code/GraphMol/Wrap/MolSupplier.h @@ -31,7 +31,7 @@ ROMol *MolForwardSupplNext(T *suppl) { if (!suppl->atEnd()) { try { res = suppl->next(); - } catch (const FileParseException&) { + } catch (const FileParseException &) { throw; } catch (...) { res = nullptr; @@ -53,7 +53,7 @@ ROMol *MolSupplNext(T *suppl) { if (!suppl->atEnd()) { try { res = suppl->next(); - } catch (const FileParseException&) { + } catch (const FileParseException &) { throw; } catch (...) { res = nullptr; diff --git a/Code/GraphMol/Wrap/seqs.hpp b/Code/GraphMol/Wrap/seqs.hpp index d41b005e5..5ee13d17a 100644 --- a/Code/GraphMol/Wrap/seqs.hpp +++ b/Code/GraphMol/Wrap/seqs.hpp @@ -18,24 +18,24 @@ class AtomCountFunctor { const ROMOL_SPTR _mol; public: - AtomCountFunctor(const ROMOL_SPTR &mol) : _mol(mol){}; - unsigned int operator()() const { return _mol->getNumAtoms(); }; + AtomCountFunctor(const ROMOL_SPTR &mol) : _mol(mol) {} + unsigned int operator()() const { return _mol->getNumAtoms(); } }; class BondCountFunctor { private: const ROMOL_SPTR _mol; public: - BondCountFunctor(const ROMOL_SPTR &mol) : _mol(mol){}; - unsigned int operator()() const { return _mol->getNumBonds(); }; + BondCountFunctor(const ROMOL_SPTR &mol) : _mol(mol) {} + unsigned int operator()() const { return _mol->getNumBonds(); } }; class ConformerCountFunctor { private: const ROMOL_SPTR _mol; public: - ConformerCountFunctor(const ROMOL_SPTR &mol) : _mol(mol){}; - unsigned int operator()() const { return _mol->getNumConformers(); }; + ConformerCountFunctor(const ROMOL_SPTR &mol) : _mol(mol) {} + unsigned int operator()() const { return _mol->getNumConformers(); } }; // Note: T1 should be some iterator type, @@ -125,6 +125,8 @@ typedef ReadOnlySeq AtomIterSeq; typedef ReadOnlySeq QueryAtomIterSeq; typedef ReadOnlySeq BondIterSeq; -typedef ReadOnlySeq ConformerIterSeq; -} +typedef ReadOnlySeq + ConformerIterSeq; +} // namespace RDKit #endif diff --git a/Code/GraphMol/atomic_data.h b/Code/GraphMol/atomic_data.h index be872f2e7..948ffec2b 100644 --- a/Code/GraphMol/atomic_data.h +++ b/Code/GraphMol/atomic_data.h @@ -31,17 +31,17 @@ RDKIT_GRAPHMOL_EXPORT extern const double electronMass; class RDKIT_GRAPHMOL_EXPORT atomicData { public: atomicData(const std::string &dataLine); - ~atomicData(){}; + ~atomicData() {} - int AtomicNum() const { return anum; }; + int AtomicNum() const { return anum; } - int DefaultValence() const { return valence.front(); }; + int DefaultValence() const { return valence.front(); } - int NumValence() const { return static_cast(valence.size()); }; + int NumValence() const { return static_cast(valence.size()); } - const INT_VECT &ValenceList() const { return valence; }; + const INT_VECT &ValenceList() const { return valence; } - double Mass() const { return mass; }; + double Mass() const { return mass; } std::string Symbol() const { return symb; } diff --git a/Code/GraphMol/new_canon.h b/Code/GraphMol/new_canon.h index c32865b71..c2df4ce3b 100644 --- a/Code/GraphMol/new_canon.h +++ b/Code/GraphMol/new_canon.h @@ -35,16 +35,16 @@ struct RDKIT_GRAPHMOL_EXPORT bondholder { unsigned int nbrIdx{0}; const std::string *p_symbol{ nullptr}; // if provided, this is used to order bonds - bondholder() : bondStereo(static_cast(Bond::STEREONONE)){}; + bondholder() : bondStereo(static_cast(Bond::STEREONONE)) {} bondholder(Bond::BondType bt, Bond::BondStereo bs, unsigned int ni, unsigned int nsc) : bondType(bt), bondStereo(static_cast(bs)), nbrSymClass(nsc), - nbrIdx(ni){}; + nbrIdx(ni) {} bondholder(Bond::BondType bt, unsigned int bs, unsigned int ni, unsigned int nsc) - : bondType(bt), bondStereo(bs), nbrSymClass(nsc), nbrIdx(ni){}; + : bondType(bt), bondStereo(bs), nbrSymClass(nsc), nbrIdx(ni) {} bool operator<(const bondholder &o) const { if (p_symbol && o.p_symbol) { return (*p_symbol) < (*o.p_symbol); @@ -107,7 +107,7 @@ class RDKIT_GRAPHMOL_EXPORT canon_atom { std::vector revistedNeighbors; std::vector bonds; - canon_atom(){}; + canon_atom() {} ~canon_atom() { free(nbrIds); } }; @@ -137,9 +137,7 @@ class RDKIT_GRAPHMOL_EXPORT SpecialChiralityAtomCompareFunctor { const boost::dynamic_bitset<> *dp_atomsInPlay{nullptr}, *dp_bondsInPlay{nullptr}; - SpecialChiralityAtomCompareFunctor() - - {}; + SpecialChiralityAtomCompareFunctor() {} SpecialChiralityAtomCompareFunctor( Canon::canon_atom *atoms, const ROMol &m, const boost::dynamic_bitset<> *atomsInPlay = nullptr, @@ -147,7 +145,7 @@ class RDKIT_GRAPHMOL_EXPORT SpecialChiralityAtomCompareFunctor { : dp_atoms(atoms), dp_mol(&m), dp_atomsInPlay(atomsInPlay), - dp_bondsInPlay(bondsInPlay){}; + dp_bondsInPlay(bondsInPlay) {} int operator()(int i, int j) const { PRECONDITION(dp_atoms, "no atoms"); PRECONDITION(dp_mol, "no molecule"); @@ -192,9 +190,7 @@ class RDKIT_GRAPHMOL_EXPORT SpecialSymmetryAtomCompareFunctor { const boost::dynamic_bitset<> *dp_atomsInPlay{nullptr}, *dp_bondsInPlay{nullptr}; - SpecialSymmetryAtomCompareFunctor() - - {}; + SpecialSymmetryAtomCompareFunctor() {} SpecialSymmetryAtomCompareFunctor( Canon::canon_atom *atoms, const ROMol &m, const boost::dynamic_bitset<> *atomsInPlay = nullptr, @@ -202,7 +198,7 @@ class RDKIT_GRAPHMOL_EXPORT SpecialSymmetryAtomCompareFunctor { : dp_atoms(atoms), dp_mol(&m), dp_atomsInPlay(atomsInPlay), - dp_bondsInPlay(bondsInPlay){}; + dp_bondsInPlay(bondsInPlay) {} int operator()(int i, int j) const { PRECONDITION(dp_atoms, "no atoms"); PRECONDITION(dp_mol, "no molecule"); @@ -392,9 +388,7 @@ class RDKIT_GRAPHMOL_EXPORT AtomCompareFunctor { bool df_useChirality{true}; bool df_useChiralityRings{true}; - AtomCompareFunctor() - - {}; + AtomCompareFunctor() {} AtomCompareFunctor(Canon::canon_atom *atoms, const ROMol &m, const boost::dynamic_bitset<> *atomsInPlay = nullptr, const boost::dynamic_bitset<> *bondsInPlay = nullptr) @@ -405,7 +399,7 @@ class RDKIT_GRAPHMOL_EXPORT AtomCompareFunctor { df_useNbrs(false), df_useIsotopes(true), df_useChirality(true), - df_useChiralityRings(true){}; + df_useChiralityRings(true) {} int operator()(int i, int j) const { PRECONDITION(dp_atoms, "no atoms"); PRECONDITION(dp_mol, "no molecule"); @@ -521,9 +515,9 @@ class RDKIT_GRAPHMOL_EXPORT ChiralAtomCompareFunctor { Canon::canon_atom *dp_atoms{nullptr}; const ROMol *dp_mol{nullptr}; bool df_useNbrs{false}; - ChiralAtomCompareFunctor(){}; + ChiralAtomCompareFunctor() {} ChiralAtomCompareFunctor(Canon::canon_atom *atoms, const ROMol &m) - : dp_atoms(atoms), dp_mol(&m), df_useNbrs(false){}; + : dp_atoms(atoms), dp_mol(&m), df_useNbrs(false) {} int operator()(int i, int j) const { PRECONDITION(dp_atoms, "no atoms"); PRECONDITION(dp_mol, "no molecule"); diff --git a/Code/JavaWrappers/GenericRDKitException.h b/Code/JavaWrappers/GenericRDKitException.h index 9b0d8c985..b0200d013 100644 --- a/Code/JavaWrappers/GenericRDKitException.h +++ b/Code/JavaWrappers/GenericRDKitException.h @@ -27,10 +27,10 @@ namespace RDKit { class RDKIT_JAVAWRAPPERS_EXPORT GenericRDKitException : public std::exception { public: - GenericRDKitException(const std::string &i) : _value(i){}; - GenericRDKitException(const char *msg) : _value(msg){}; - const char *what() const noexcept override { return _value.c_str(); }; - ~GenericRDKitException() noexcept {}; + GenericRDKitException(const std::string &i) : _value(i) {} + GenericRDKitException(const char *msg) : _value(msg) {} + const char *what() const noexcept override { return _value.c_str(); } + ~GenericRDKitException() noexcept {} private: std::string _value; diff --git a/Code/ML/InfoTheory/CorrMatGenerator.h b/Code/ML/InfoTheory/CorrMatGenerator.h index 956304d1c..c88d8031d 100644 --- a/Code/ML/InfoTheory/CorrMatGenerator.h +++ b/Code/ML/InfoTheory/CorrMatGenerator.h @@ -39,7 +39,7 @@ class BitCorrMatGenerator { * of the symmetric matrix */ public: - BitCorrMatGenerator() { this->initGenerator(); }; + BitCorrMatGenerator() { this->initGenerator(); } ~BitCorrMatGenerator() { delete[] dp_corrMat; } @@ -47,7 +47,7 @@ class BitCorrMatGenerator { dp_corrMat = nullptr; d_descs.resize(0); d_nExamples = 0; - }; + } /*! \brief Set the list bits that we are interested in correlating * @@ -65,18 +65,18 @@ class BitCorrMatGenerator { for (i = 0; i < nelem; i++) { dp_corrMat[i] = 0.0; } - }; + } //! \brief get the number of examples we used so far to compute the // correlation matrix - int getNumExamples() const { return d_nExamples; }; + int getNumExamples() const { return d_nExamples; } //! \brief Get the list of bits ID that are used to generate the correlation // matrix - RDKit::INT_VECT getCorrBitList() const { return d_descs; }; + RDKit::INT_VECT getCorrBitList() const { return d_descs; } //! \brief Gets a pointer to the correlation matrix - double *getCorrMat() { return dp_corrMat; }; + double *getCorrMat() { return dp_corrMat; } //! \brief For each pair of on bits (bi, bj) in fp increase the correlation // count @@ -103,7 +103,7 @@ class BitCorrMatGenerator { } } d_nExamples++; - }; + } private: RDKit::INT_VECT d_descs; diff --git a/Code/ML/InfoTheory/InfoBitRanker.h b/Code/ML/InfoTheory/InfoBitRanker.h index 4b5e8058d..29b53cc63 100644 --- a/Code/ML/InfoTheory/InfoBitRanker.h +++ b/Code/ML/InfoTheory/InfoBitRanker.h @@ -209,9 +209,8 @@ class RDKIT_INFOTHEORY_EXPORT InfoBitRanker { *computed * - the maximum of these fractions for classes that are not in the *biasList are computed - * - If this maximum is less than the fraction for at least one of the classes - *in the biaslist - * the bit is considered good + * - If this maximum is less than the fraction for at least one of the + * classes in the biaslist, the bit is considered good * ARGUMENTS: * - resMat : the result matrix, one dimensional matrix of dimension (2*(num *of classes)) diff --git a/Code/MinimalLib/minilib.h b/Code/MinimalLib/minilib.h index 30bd77e16..14cd9d78b 100644 --- a/Code/MinimalLib/minilib.h +++ b/Code/MinimalLib/minilib.h @@ -14,8 +14,8 @@ class JSMol { public: - JSMol() : d_mol(nullptr){}; - JSMol(RDKit::RWMol *mol) : d_mol(mol){}; + JSMol() : d_mol(nullptr) {} + JSMol(RDKit::RWMol *mol) : d_mol(mol) {} std::string get_smiles() const; std::string get_cxsmiles() const; std::string get_molblock() const; @@ -24,42 +24,46 @@ class JSMol { std::string get_svg(unsigned int width, unsigned int height) const; std::string get_svg() const { return get_svg(d_defaultWidth, d_defaultHeight); - }; + } std::string get_svg_with_highlights(const std::string &details) const; std::string get_substruct_match(const JSMol &q) const; std::string get_substruct_matches(const JSMol &q) const; std::string get_descriptors() const; std::string get_morgan_fp(unsigned int radius, unsigned int len) const; - std::string get_morgan_fp() const { return get_morgan_fp(2, 2048); }; + std::string get_morgan_fp() const { return get_morgan_fp(2, 2048); } std::string condense_abbreviations(double maxCoverage, bool useLinkers); std::string condense_abbreviations() { return condense_abbreviations(0.4, false); - }; + } std::string condense_abbreviations_from_defs(const std::string &definitions, double maxCoverage, bool areLinkers); std::string generate_aligned_coords(const JSMol &templateMol, - bool useCoordGen, bool allowOptionalAttachments, bool acceptFailure); + bool useCoordGen, + bool allowOptionalAttachments, + bool acceptFailure); std::string generate_aligned_coords(const JSMol &templateMol, - bool useCoordGen, bool allowOptionalAttachments) { - return generate_aligned_coords(templateMol, useCoordGen, allowOptionalAttachments, true); + bool useCoordGen, + bool allowOptionalAttachments) { + return generate_aligned_coords(templateMol, useCoordGen, + allowOptionalAttachments, true); }; std::string generate_aligned_coords(const JSMol &templateMol, bool useCoordGen) { return generate_aligned_coords(templateMol, useCoordGen, false, true); - }; + } std::string generate_aligned_coords(const JSMol &templateMol) { return generate_aligned_coords(templateMol, false, false, true); - }; + } - bool is_valid() const { return d_mol.get() != nullptr; }; + bool is_valid() const { return d_mol.get() != nullptr; } // functionality primarily useful in ketcher std::string get_stereo_tags() const; std::string get_aromatic_form() const; std::string get_kekule_form() const; std::string get_new_coords(bool useCoordGen) const; - std::string get_new_coords() const { return get_new_coords(false); }; + std::string get_new_coords() const { return get_new_coords(false); } std::string remove_hs() const; std::string add_hs() const; diff --git a/Code/Numerics/Conrec.h b/Code/Numerics/Conrec.h index e765584be..ef10ca014 100644 --- a/Code/Numerics/Conrec.h +++ b/Code/Numerics/Conrec.h @@ -16,10 +16,10 @@ struct ConrecSegment { RDGeom::Point2D p2; double isoVal; ConrecSegment(double x1, double y1, double x2, double y2, double isoVal) - : p1(x1, y1), p2(x2, y2), isoVal(isoVal){}; + : p1(x1, y1), p2(x2, y2), isoVal(isoVal) {} ConrecSegment(const RDGeom::Point2D &p1, const RDGeom::Point2D &p2, double isoVal) - : p1(p1), p2(p2), isoVal(isoVal){}; + : p1(p1), p2(p2), isoVal(isoVal) {} }; // adapted from conrec.c by Paul Bourke: // http://paulbourke.net/papers/conrec/conrec.c @@ -186,11 +186,11 @@ inline void Contour(const double *d, size_t ilb, size_t iub, size_t jlb, } /* Finally draw the line */ - res.emplace_back(RDGeom::Point2D(x1, y1), - RDGeom::Point2D(x2, y2), z[k]); + res.emplace_back(RDGeom::Point2D(x1, y1), RDGeom::Point2D(x2, y2), + z[k]); } /* m */ } /* k - contour */ } /* i */ } /* j */ } -} // namespace conrec \ No newline at end of file +} // namespace conrec diff --git a/Code/Numerics/Matrix.h b/Code/Numerics/Matrix.h index d17f6d286..1e8cd4c43 100644 --- a/Code/Numerics/Matrix.h +++ b/Code/Numerics/Matrix.h @@ -36,7 +36,7 @@ class Matrix { TYPE *data = new TYPE[d_dataSize]; memset(static_cast(data), 0, d_dataSize * sizeof(TYPE)); d_data.reset(data); - }; + } //! Initialize with a size and default value. Matrix(unsigned int nRows, unsigned int nCols, TYPE val) @@ -229,7 +229,7 @@ class Matrix { } protected: - Matrix() : d_data(){}; + Matrix() : d_data() {} unsigned int d_nRows{0}; unsigned int d_nCols{0}; unsigned int d_dataSize{0}; diff --git a/Code/Numerics/SquareMatrix.h b/Code/Numerics/SquareMatrix.h index fd5f9d611..032a42629 100644 --- a/Code/Numerics/SquareMatrix.h +++ b/Code/Numerics/SquareMatrix.h @@ -18,18 +18,18 @@ template class SquareMatrix : public Matrix { public: //! brief Square matrix of size N - SquareMatrix(){}; + SquareMatrix() {} - explicit SquareMatrix(unsigned int N) : Matrix(N, N){}; + explicit SquareMatrix(unsigned int N) : Matrix(N, N) {} - SquareMatrix(unsigned int N, TYPE val) : Matrix(N, N, val){}; + SquareMatrix(unsigned int N, TYPE val) : Matrix(N, N, val) {} SquareMatrix(unsigned int N, typename Matrix::DATA_SPTR data) - : Matrix(N, N, data){}; + : Matrix(N, N, data) {} // inline unsigned int size() const { // return d_nRows; - //}; + // } virtual SquareMatrix &operator*=(TYPE scale) { Matrix::operator*=(scale); diff --git a/Code/Numerics/SymmMatrix.h b/Code/Numerics/SymmMatrix.h index 201a9481d..72babd3ba 100644 --- a/Code/Numerics/SymmMatrix.h +++ b/Code/Numerics/SymmMatrix.h @@ -233,7 +233,7 @@ class SymmMatrix { } protected: - SymmMatrix() : d_data(0){}; + SymmMatrix() : d_data(0) {} unsigned int d_size{0}; unsigned int d_dataSize{0}; DATA_SPTR d_data; diff --git a/Code/Query/AndQuery.h b/Code/Query/AndQuery.h index c613a4cef..909de14a7 100644 --- a/Code/Query/AndQuery.h +++ b/Code/Query/AndQuery.h @@ -22,7 +22,7 @@ class RDKIT_QUERY_EXPORT AndQuery : public Query { public: typedef Query BASE; - AndQuery() { this->df_negate = false; }; + AndQuery() { this->df_negate = false; } bool Match(const DataFuncArgType what) const { bool res = true; @@ -36,7 +36,7 @@ class RDKIT_QUERY_EXPORT AndQuery } if (this->getNegation()) res = !res; return res; - }; + } Query *copy() const { AndQuery *res = new AndQuery(); @@ -48,7 +48,7 @@ class RDKIT_QUERY_EXPORT AndQuery res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } }; } // namespace Queries #endif diff --git a/Code/Query/EqualityQuery.h b/Code/Query/EqualityQuery.h index 42caa58b1..3f043cbf2 100644 --- a/Code/Query/EqualityQuery.h +++ b/Code/Query/EqualityQuery.h @@ -23,30 +23,30 @@ template { public: - EqualityQuery() { this->df_negate = false; }; + EqualityQuery() { this->df_negate = false; } //! constructs with our target value explicit EqualityQuery(MatchFuncArgType v) { this->d_val = v; this->df_negate = false; - }; + } //! constructs with our target value and a tolerance EqualityQuery(MatchFuncArgType v, MatchFuncArgType t) { this->d_val = v; this->d_tol = t; this->df_negate = false; - }; + } //! sets our target value - void setVal(MatchFuncArgType what) { this->d_val = what; }; + void setVal(MatchFuncArgType what) { this->d_val = what; } //! returns our target value - const MatchFuncArgType getVal() const { return this->d_val; }; + const MatchFuncArgType getVal() const { return this->d_val; } //! sets our tolerance - void setTol(MatchFuncArgType what) { this->d_tol = what; }; + void setTol(MatchFuncArgType what) { this->d_tol = what; } //! returns out tolerance - const MatchFuncArgType getTol() const { return this->d_tol; }; + const MatchFuncArgType getTol() const { return this->d_tol; } virtual bool Match(const DataFuncArgType what) const { MatchFuncArgType mfArg = @@ -64,7 +64,7 @@ class RDKIT_QUERY_EXPORT EqualityQuery return false; } } - }; + } virtual Query *copy() const { @@ -77,7 +77,7 @@ class RDKIT_QUERY_EXPORT EqualityQuery res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } std::string getFullDescription() const { std::ostringstream res; diff --git a/Code/Query/GreaterEqualQuery.h b/Code/Query/GreaterEqualQuery.h index fa537d5fb..5a6e8909d 100644 --- a/Code/Query/GreaterEqualQuery.h +++ b/Code/Query/GreaterEqualQuery.h @@ -21,19 +21,19 @@ template { public: - GreaterEqualQuery() { this->d_tol = 0; }; + GreaterEqualQuery() { this->d_tol = 0; } //! constructs with our target value explicit GreaterEqualQuery(DataFuncArgType what) { this->d_val = what; this->d_tol = 0; this->df_negate = false; - }; + } //! constructs with our target value and a tolerance GreaterEqualQuery(DataFuncArgType v, DataFuncArgType t) { this->d_val = v; this->d_tol = t; this->df_negate = false; - }; + } bool Match(const DataFuncArgType what) const { MatchFuncArgType mfArg = @@ -49,7 +49,7 @@ class RDKIT_QUERY_EXPORT GreaterEqualQuery else return false; } - }; + } Query *copy() const { GreaterEqualQuery *res = new GreaterEqualQueryd_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } std::string getFullDescription() const { std::ostringstream res; @@ -72,7 +72,7 @@ class RDKIT_QUERY_EXPORT GreaterEqualQuery else res << " >= "; return res.str(); - }; + } }; } // namespace Queries #endif diff --git a/Code/Query/GreaterQuery.h b/Code/Query/GreaterQuery.h index 3f34b172d..900098a82 100644 --- a/Code/Query/GreaterQuery.h +++ b/Code/Query/GreaterQuery.h @@ -21,19 +21,19 @@ template { public: - GreaterQuery() { this->d_tol = 0; }; + GreaterQuery() { this->d_tol = 0; } //! constructs with our target value explicit GreaterQuery(DataFuncArgType v) { this->d_val = v; this->d_tol = 0; this->df_negate = false; - }; + } //! constructs with our target value and a tolerance GreaterQuery(DataFuncArgType v, DataFuncArgType t) { this->d_val = v; this->d_tol = t; this->df_negate = false; - }; + } bool Match(const DataFuncArgType what) const { MatchFuncArgType mfArg = @@ -49,7 +49,7 @@ class RDKIT_QUERY_EXPORT GreaterQuery else return false; } - }; + } Query *copy() const { GreaterQuery *res = @@ -61,7 +61,7 @@ class RDKIT_QUERY_EXPORT GreaterQuery res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } std::string getFullDescription() const { std::ostringstream res; @@ -72,7 +72,7 @@ class RDKIT_QUERY_EXPORT GreaterQuery else res << " > "; return res.str(); - }; + } }; } // namespace Queries #endif diff --git a/Code/Query/LessEqualQuery.h b/Code/Query/LessEqualQuery.h index a61e3c38a..4bca19c40 100644 --- a/Code/Query/LessEqualQuery.h +++ b/Code/Query/LessEqualQuery.h @@ -21,19 +21,19 @@ template { public: - LessEqualQuery() { this->d_tol = 0; }; + LessEqualQuery() { this->d_tol = 0; } //! constructs with our target value explicit LessEqualQuery(DataFuncArgType what) { this->d_val = what; this->d_tol = 0; this->df_negate = false; - }; + } //! constructs with our target value and a tolerance LessEqualQuery(DataFuncArgType v, DataFuncArgType t) { this->d_val = v; this->d_tol = t; this->df_negate = false; - }; + } bool Match(const DataFuncArgType what) const { MatchFuncArgType mfArg = @@ -49,7 +49,7 @@ class RDKIT_QUERY_EXPORT LessEqualQuery else return false; } - }; + } Query *copy() const { LessEqualQuery *res = @@ -62,7 +62,7 @@ class RDKIT_QUERY_EXPORT LessEqualQuery res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } std::string getFullDescription() const { std::ostringstream res; @@ -73,7 +73,7 @@ class RDKIT_QUERY_EXPORT LessEqualQuery else res << " <= "; return res.str(); - }; + } }; } // namespace Queries #endif diff --git a/Code/Query/LessQuery.h b/Code/Query/LessQuery.h index a9ac24e6f..d04d5ffa1 100644 --- a/Code/Query/LessQuery.h +++ b/Code/Query/LessQuery.h @@ -21,19 +21,19 @@ template { public: - LessQuery() { this->d_tol = 0; }; + LessQuery() { this->d_tol = 0; } //! constructs with our target value explicit LessQuery(DataFuncArgType v) { this->d_val = v; this->d_tol = 0; this->df_negate = false; - }; + } //! constructs with our target value and a tolerance LessQuery(DataFuncArgType v, DataFuncArgType t) { this->d_val = v; this->d_tol = t; this->df_negate = false; - }; + } bool Match(const DataFuncArgType what) const { MatchFuncArgType mfArg = @@ -49,7 +49,7 @@ class RDKIT_QUERY_EXPORT LessQuery else return false; } - }; + } Query *copy() const { LessQuery *res = @@ -61,7 +61,7 @@ class RDKIT_QUERY_EXPORT LessQuery res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } std::string getFullDescription() const { std::ostringstream res; @@ -72,7 +72,7 @@ class RDKIT_QUERY_EXPORT LessQuery else res << " < "; return res.str(); - }; + } }; } // namespace Queries #endif diff --git a/Code/Query/OrQuery.h b/Code/Query/OrQuery.h index 1f546c351..41da99f75 100644 --- a/Code/Query/OrQuery.h +++ b/Code/Query/OrQuery.h @@ -21,7 +21,7 @@ class RDKIT_QUERY_EXPORT OrQuery : public Query { public: typedef Query BASE; - OrQuery() { this->df_negate = false; }; + OrQuery() { this->df_negate = false; } bool Match(const DataFuncArgType what) const { bool res = false; @@ -35,7 +35,7 @@ class RDKIT_QUERY_EXPORT OrQuery } if (this->getNegation()) res = !res; return res; - }; + } Query *copy() const { OrQuery *res = @@ -49,7 +49,7 @@ class RDKIT_QUERY_EXPORT OrQuery res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } }; } // namespace Queries #endif diff --git a/Code/Query/Query.h b/Code/Query/Query.h index e84bc11d3..b963474a9 100644 --- a/Code/Query/Query.h +++ b/Code/Query/Query.h @@ -52,24 +52,22 @@ class RDKIT_QUERY_EXPORT Query { using MATCH_FUNC_ARG_TYPE = MatchFuncArgType; using DATA_FUNC_ARG_TYPE = DataFuncArgType; - Query() : d_matchFunc(nullptr), d_dataFunc(nullptr){}; - virtual ~Query() { this->d_children.clear(); }; + Query() : d_matchFunc(nullptr), d_dataFunc(nullptr) {} + virtual ~Query() { this->d_children.clear(); } //! sets whether or not we are negated - void setNegation(bool what) { this->df_negate = what; }; + void setNegation(bool what) { this->df_negate = what; } //! returns whether or not we are negated - bool getNegation() const { return this->df_negate; }; + bool getNegation() const { return this->df_negate; } //! sets our text description - void setDescription(const std::string &descr) { - this->d_description = descr; - }; + void setDescription(const std::string &descr) { this->d_description = descr; } //! \overload void setDescription(const char *descr) { this->d_description = std::string(descr); - }; + } //! returns our text description - const std::string &getDescription() const { return this->d_description; }; + const std::string &getDescription() const { return this->d_description; } //! returns a fuller text description virtual std::string getFullDescription() const { if (!getNegation()) @@ -79,29 +77,29 @@ class RDKIT_QUERY_EXPORT Query { } //! sets our type label - void setTypeLabel(const std::string &typ) { this->d_queryType = typ; }; + void setTypeLabel(const std::string &typ) { this->d_queryType = typ; } //! \overload - void setTypeLabel(const char *typ) { this->d_queryType = std::string(typ); }; + void setTypeLabel(const char *typ) { this->d_queryType = std::string(typ); } //! returns our text label. - const std::string &getTypeLabel() const { return this->d_queryType; }; + const std::string &getTypeLabel() const { return this->d_queryType; } //! sets our match function void setMatchFunc(bool (*what)(MatchFuncArgType)) { this->d_matchFunc = what; - }; + } //! returns our match function: - bool (*getMatchFunc() const)(MatchFuncArgType) { return this->d_matchFunc; }; + bool (*getMatchFunc() const)(MatchFuncArgType) { return this->d_matchFunc; } //! sets our data function void setDataFunc(MatchFuncArgType (*what)(DataFuncArgType)) { this->d_dataFunc = what; - }; + } //! returns our data function: MatchFuncArgType (*getDataFunc() const)(DataFuncArgType) { return this->d_dataFunc; - }; + } //! adds a child to our list of children - void addChild(CHILD_TYPE child) { this->d_children.push_back(child); }; + void addChild(CHILD_TYPE child) { this->d_children.push_back(child); } //! returns an iterator for the beginning of our child vector CHILD_VECT_CI beginChildren() const { return this->d_children.begin(); } //! returns an iterator for the end of our child vector @@ -120,7 +118,7 @@ class RDKIT_QUERY_EXPORT Query { return !tRes; else return tRes; - }; + } //! returns a copy of this Query /*! @@ -143,7 +141,7 @@ class RDKIT_QUERY_EXPORT Query { res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } protected: MatchFuncArgType d_val = 0; diff --git a/Code/Query/RangeQuery.h b/Code/Query/RangeQuery.h index fa6c99749..ff36e88ab 100644 --- a/Code/Query/RangeQuery.h +++ b/Code/Query/RangeQuery.h @@ -27,36 +27,36 @@ template { public: - RangeQuery() : d_upper(0), d_lower(0) { this->df_negate = false; }; + RangeQuery() : d_upper(0), d_lower(0) { this->df_negate = false; } //! construct and set the lower and upper bounds RangeQuery(MatchFuncArgType lower, MatchFuncArgType upper) : d_upper(upper), d_lower(lower), df_upperOpen(true), df_lowerOpen(true) { this->df_negate = false; - }; + } //! sets our upper bound - void setUpper(MatchFuncArgType what) { this->d_upper = what; }; + void setUpper(MatchFuncArgType what) { this->d_upper = what; } //! returns our upper bound - const MatchFuncArgType getUpper() const { return this->d_upper; }; + const MatchFuncArgType getUpper() const { return this->d_upper; } //! sets our lower bound - void setLower(MatchFuncArgType what) { this->d_lower = what; }; + void setLower(MatchFuncArgType what) { this->d_lower = what; } //! returns our lower bound - const MatchFuncArgType getLower() const { return this->d_lower; }; + const MatchFuncArgType getLower() const { return this->d_lower; } //! sets whether or not the ends of the range are open void setEndsOpen(bool lower, bool upper) { this->df_lowerOpen = lower; this->df_upperOpen = upper; - }; + } //! returns the state of our ends (open or not) std::pair getEndsOpen() const { return std::make_pair(this->df_lowerOpen, this->df_upperOpen); - }; + } //! sets our tolerance - void setTol(MatchFuncArgType what) { this->d_tol = what; }; + void setTol(MatchFuncArgType what) { this->d_tol = what; } //! returns our tolerance - const MatchFuncArgType getTol() const { return this->d_tol; }; + const MatchFuncArgType getTol() const { return this->d_tol; } bool Match(const DataFuncArgType what) const { MatchFuncArgType mfArg = @@ -78,7 +78,7 @@ class RDKIT_QUERY_EXPORT RangeQuery return tempR; else return !tempR; - }; + } Query *copy() const { RangeQuery *res = @@ -92,7 +92,7 @@ class RDKIT_QUERY_EXPORT RangeQuery res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } std::string getFullDescription() const { std::ostringstream res; @@ -100,7 +100,7 @@ class RDKIT_QUERY_EXPORT RangeQuery if (this->getNegation()) res << " ! "; res << " " << this->d_lower << " val " << this->d_upper; return res.str(); - }; + } protected: MatchFuncArgType d_upper, d_lower; diff --git a/Code/Query/SetQuery.h b/Code/Query/SetQuery.h index d81c46f27..21ab59c76 100644 --- a/Code/Query/SetQuery.h +++ b/Code/Query/SetQuery.h @@ -27,7 +27,7 @@ class RDKIT_QUERY_EXPORT SetQuery public: typedef std::set CONTAINER_TYPE; - SetQuery() : Query(){}; + SetQuery() : Query() {} //! insert an entry into our \c set void insert(const MatchFuncArgType what) { @@ -41,7 +41,7 @@ class RDKIT_QUERY_EXPORT SetQuery MatchFuncArgType mfArg = this->TypeConvert(what, Int2Type()); return (this->d_set.find(mfArg) != this->d_set.end()) ^ this->getNegation(); - }; + } Query *copy() const { SetQuery *res = @@ -55,15 +55,13 @@ class RDKIT_QUERY_EXPORT SetQuery res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } typename CONTAINER_TYPE::const_iterator beginSet() const { return d_set.begin(); - }; - typename CONTAINER_TYPE::const_iterator endSet() const { - return d_set.end(); - }; - unsigned int size() const { return rdcast(d_set.size()); }; + } + typename CONTAINER_TYPE::const_iterator endSet() const { return d_set.end(); } + unsigned int size() const { return rdcast(d_set.size()); } std::string getFullDescription() const { std::ostringstream res; diff --git a/Code/Query/XOrQuery.h b/Code/Query/XOrQuery.h index 2bbad55bf..8442c7d2c 100644 --- a/Code/Query/XOrQuery.h +++ b/Code/Query/XOrQuery.h @@ -22,7 +22,7 @@ class RDKIT_QUERY_EXPORT XOrQuery : public Query { public: typedef Query BASE; - XOrQuery() { this->df_negate = false; }; + XOrQuery() { this->df_negate = false; } bool Match(const DataFuncArgType what) const { bool res = false; @@ -40,7 +40,7 @@ class RDKIT_QUERY_EXPORT XOrQuery } if (this->getNegation()) res = !res; return res; - }; + } Query *copy() const { XOrQuery *res = @@ -54,7 +54,7 @@ class RDKIT_QUERY_EXPORT XOrQuery res->d_description = this->d_description; res->d_queryType = this->d_queryType; return res; - }; + } }; } // namespace Queries #endif diff --git a/Code/RDBoost/PySequenceHolder.h b/Code/RDBoost/PySequenceHolder.h index e848e4d84..208a64b29 100644 --- a/Code/RDBoost/PySequenceHolder.h +++ b/Code/RDBoost/PySequenceHolder.h @@ -31,7 +31,7 @@ namespace python = boost::python; template class PySequenceHolder { public: - PySequenceHolder(python::object seq) { d_seq = seq; }; + PySequenceHolder(python::object seq) { d_seq = seq; } // -------------------------------------------------- //! \brief Returns the size of the contained sequence. @@ -46,7 +46,7 @@ class PySequenceHolder { throw_value_error("sequence does not support length query"); } return res; - }; + } // -------------------------------------------------- //! \brief Returns an element of the sequence @@ -73,7 +73,7 @@ class PySequenceHolder { POSTCONDITION(0, "cannot reach this point"); return static_cast(T()); - }; + } private: python::object d_seq; diff --git a/Code/RDBoost/list_indexing_suite.hpp b/Code/RDBoost/list_indexing_suite.hpp index 0cd8f2953..7d038ae50 100644 --- a/Code/RDBoost/list_indexing_suite.hpp +++ b/Code/RDBoost/list_indexing_suite.hpp @@ -7,191 +7,153 @@ // with no claim as to its suitability for any purpose. #ifndef LIST_INDEXING_SUITE_GL20042_HPP -# define LIST_INDEXING_SUITE_GL20042_HPP +#define LIST_INDEXING_SUITE_GL20042_HPP -# include -# include -# include -# include +#include +#include +#include +#include #include "pyint_api.h" -namespace boost { namespace python { - - // Forward declaration - template - class list_indexing_suite; - - namespace detail - { - template - class final_list_derived_policies - : public list_indexing_suite > {}; +namespace boost { +namespace python { + +// Forward declaration +template +class list_indexing_suite; + +namespace detail { +template +class final_list_derived_policies + : public list_indexing_suite< + Container, NoProxy, final_list_derived_policies> { +}; +} // namespace detail + +// The vector_indexing_suite class is a predefined indexing_suite derived +// class for wrapping std::vector (and std::vector like) classes. It provides +// all the policies required by the indexing_suite (see indexing_suite). +// Example usage: +// +// class X {...}; +// +// ... +// +// class_ >("XVec") +// .def(vector_indexing_suite >()) +// ; +// +// By default indexed elements are returned by proxy. This can be +// disabled by supplying *true* in the NoProxy template parameter. +// +template > +class list_indexing_suite + : public indexing_suite { + public: + typedef typename Container::value_type data_type; + typedef typename Container::value_type key_type; + typedef typename Container::size_type index_type; + typedef typename Container::size_type size_type; + typedef typename Container::iterator iterator_type; + + static typename mpl::if_, data_type&, data_type>::type + get_item(Container& container, index_type i) { + iterator_type pos = moveToPos(container, i); + return *pos; + } + static object get_slice(Container& container, index_type from, + index_type to) { + Container res; + iterator_type beg = moveToPos(container, from); + iterator_type end = moveToPos(container, to); + std::copy(beg, end, res.begin()); + return object(res); + } + static void set_item(Container& container, index_type i, data_type const& v) { + iterator_type pos = moveToPos(container, i); + *pos = v; + } + + static void set_slice(Container& container, index_type from, index_type to, + data_type const& v) { + iterator_type beg = moveToPos(container, from); + iterator_type end = moveToPos(container, to); + container.erase(beg, end); + // FIX: didn't we just invalidate this iterator? + container.insert(beg, v); + } + template + static void set_slice(Container& container, index_type from, index_type to, + Iter first, Iter last) { + iterator_type beg = moveToPos(container, from); + iterator_type end = moveToPos(container, to); + container.erase(beg, end); + // FIX: didn't we just invalidate this iterator? + container.insert(beg, first, last); + } + + static void delete_item(Container& container, index_type i) { + iterator_type pos = moveToPos(container, i); + container.erase(pos); + } + + static void delete_slice(Container& container, index_type from, + index_type to) { + iterator_type beg = moveToPos(container, from); + iterator_type end = moveToPos(container, to); + container.erase(beg, end); + } + + static size_t size(Container& container) { return container.size(); } + + static bool contains(Container& container, key_type const& key) { + return std::find(container.begin(), container.end(), key) != + container.end(); + } + + static index_type get_min_index(Container& container) { + (void)container; + return 0; + } + + static index_type get_max_index(Container& container) { + return container.size(); + } + + static bool compare_index(Container& container, index_type a, index_type b) { + (void)container; + return a < b; + } + + static void append(Container& container, data_type const& v) { + container.push_back(v); + } + template + static void extend(Container& container, Iter first, Iter last) { + container.insert(container.end(), first, last); + } + + static index_type convert_index(Container& container, PyObject* i_) { + extract i(i_); + if (i.check()) { + long index = i(); + if (index < 0) index += DerivedPolicies::size(container); + if (index >= long(container.size()) || index < 0) { + PyErr_SetString(PyExc_IndexError, "Index out of range"); + throw_error_already_set(); + } + return index; } - // The vector_indexing_suite class is a predefined indexing_suite derived - // class for wrapping std::vector (and std::vector like) classes. It provides - // all the policies required by the indexing_suite (see indexing_suite). - // Example usage: - // - // class X {...}; - // - // ... - // - // class_ >("XVec") - // .def(vector_indexing_suite >()) - // ; - // - // By default indexed elements are returned by proxy. This can be - // disabled by supplying *true* in the NoProxy template parameter. - // - template < - class Container, - bool NoProxy = false, - class DerivedPolicies - = detail::final_list_derived_policies > - class list_indexing_suite - : public indexing_suite - { - public: - - typedef typename Container::value_type data_type; - typedef typename Container::value_type key_type; - typedef typename Container::size_type index_type; - typedef typename Container::size_type size_type; - typedef typename Container::iterator iterator_type; - + PyErr_SetString(PyExc_TypeError, "Invalid index type"); + throw_error_already_set(); + return index_type(); + } - static - typename mpl::if_< - is_class - , data_type& - , data_type - >::type - get_item(Container& container, index_type i) - { - iterator_type pos=moveToPos(container,i); - return *pos; - } - static object - get_slice(Container& container, index_type from, index_type to){ - Container res; - iterator_type beg=moveToPos(container,from); - iterator_type end=moveToPos(container,to); - std::copy(beg,end,res.begin()); - return object(res); - }; - static void - set_item(Container& container, index_type i, data_type const& v){ - iterator_type pos=moveToPos(container,i); - *pos = v; - }; - - static void - set_slice(Container& container, index_type from, - index_type to, data_type const& v){ - iterator_type beg=moveToPos(container,from); - iterator_type end=moveToPos(container,to); - container.erase(beg,end); - // FIX: didn't we just invalidate this iterator? - container.insert(beg,v); - - }; - template - static void - set_slice(Container& container, index_type from, - index_type to, Iter first, Iter last){ - iterator_type beg=moveToPos(container,from); - iterator_type end=moveToPos(container,to); - container.erase(beg,end); - // FIX: didn't we just invalidate this iterator? - container.insert(beg,first,last); - }; - - static void - delete_item(Container& container, index_type i) - { - iterator_type pos=moveToPos(container,i); - container.erase(pos); - } - - static void - delete_slice(Container& container, index_type from, index_type to){ - iterator_type beg=moveToPos(container,from); - iterator_type end=moveToPos(container,to); - container.erase(beg,end); - } - - static size_t - size(Container& container) - { - return container.size(); - } - - static bool - contains(Container& container, key_type const& key) - { - return std::find(container.begin(), container.end(), key) - != container.end(); - } - - static index_type - get_min_index(Container& container) - { - (void)container; - return 0; - } - - static index_type - get_max_index(Container& container) - { - return container.size(); - } - - static bool - compare_index(Container& container, index_type a, index_type b) - { - (void)container; - return a < b; - } - - static void - append(Container& container, data_type const& v) - { - container.push_back(v); - } - template - static void - extend(Container& container, Iter first, Iter last) - { - container.insert(container.end(), first, last); - } - - - static index_type - convert_index(Container& container, PyObject* i_) - { - extract i(i_); - if (i.check()) - { - long index = i(); - if (index < 0) - index += DerivedPolicies::size(container); - if (index >= long(container.size()) || index < 0) - { - PyErr_SetString(PyExc_IndexError, "Index out of range"); - throw_error_already_set(); - } - return index; - } - - PyErr_SetString(PyExc_TypeError, "Invalid index type"); - throw_error_already_set(); - return index_type(); - } - - private: + private: #if 0 static void base_append(Container& container, object v) @@ -227,24 +189,23 @@ namespace boost { namespace python { DerivedPolicies::extend(container, temp.begin(), temp.end()); } #endif - static iterator_type - moveToPos(Container &container, index_type i){ - iterator_type pos; - index_type idx=0; - pos=container.begin(); - while(idx DataType; - Dict() {} + Dict() {} Dict(const Dict &other) : _data(other._data) { _hasNonPodData = other._hasNonPodData; @@ -311,9 +311,9 @@ class RDKIT_RDGENERAL_EXPORT Dict { } private: - DataType _data{}; //!< the actual dictionary + DataType _data{}; //!< the actual dictionary bool _hasNonPodData{false}; // if true, need a deep copy - // (copy_rdvalue) + // (copy_rdvalue) }; template <> diff --git a/Code/RDGeneral/Exceptions.h b/Code/RDGeneral/Exceptions.h index c8f78c72e..1f204bc67 100644 --- a/Code/RDGeneral/Exceptions.h +++ b/Code/RDGeneral/Exceptions.h @@ -21,12 +21,12 @@ class RDKIT_RDGENERAL_EXPORT IndexErrorException : public std::runtime_error { IndexErrorException(int i) : std::runtime_error("IndexErrorException"), _idx(i), - _msg("Index Error: " + std::to_string(_idx)){}; - int index() const { return _idx; }; + _msg("Index Error: " + std::to_string(_idx)) {} + int index() const { return _idx; } - const char* what() const noexcept override { return _msg.c_str(); }; + const char* what() const noexcept override { return _msg.c_str(); } - ~IndexErrorException() noexcept {}; + ~IndexErrorException() noexcept {} private: int _idx; @@ -39,11 +39,11 @@ class RDKIT_RDGENERAL_EXPORT IndexErrorException : public std::runtime_error { class RDKIT_RDGENERAL_EXPORT ValueErrorException : public std::runtime_error { public: ValueErrorException(const std::string& i) - : std::runtime_error("ValueErrorException"), _value(i){}; + : std::runtime_error("ValueErrorException"), _value(i) {} ValueErrorException(const char* msg) - : std::runtime_error("ValueErrorException"), _value(msg){}; - const char* what() const noexcept override { return _value.c_str(); }; - ~ValueErrorException() noexcept {}; + : std::runtime_error("ValueErrorException"), _value(msg) {} + const char* what() const noexcept override { return _value.c_str(); } + ~ValueErrorException() noexcept {} private: std::string _value; @@ -57,12 +57,12 @@ class RDKIT_RDGENERAL_EXPORT KeyErrorException : public std::runtime_error { KeyErrorException(std::string key) : std::runtime_error("KeyErrorException"), _key(key), - _msg("Key Error: " + key){}; - std::string key() const { return _key; }; + _msg("Key Error: " + key) {} + std::string key() const { return _key; } - const char* what() const noexcept override { return _msg.c_str(); }; + const char* what() const noexcept override { return _msg.c_str(); } - ~KeyErrorException() noexcept {}; + ~KeyErrorException() noexcept {} private: std::string _key; diff --git a/Code/RDGeneral/FileParseException.h b/Code/RDGeneral/FileParseException.h index ffb96c607..f4cbfab60 100644 --- a/Code/RDGeneral/FileParseException.h +++ b/Code/RDGeneral/FileParseException.h @@ -20,13 +20,13 @@ class RDKIT_RDGENERAL_EXPORT FileParseException : public std::runtime_error { public: //! construct with an error message explicit FileParseException(const char *msg) - : std::runtime_error("FileParseException"), _msg(msg){}; + : std::runtime_error("FileParseException"), _msg(msg) {} //! construct with an error message explicit FileParseException(const std::string msg) - : std::runtime_error("FileParseException"), _msg(msg){}; + : std::runtime_error("FileParseException"), _msg(msg) {} //! get the error message - const char *what() const noexcept override { return _msg.c_str(); }; - ~FileParseException() noexcept {}; + const char *what() const noexcept override { return _msg.c_str(); } + ~FileParseException() noexcept {} private: std::string _msg; diff --git a/Code/RDGeneral/Invariant.h b/Code/RDGeneral/Invariant.h index fce615cea..52686e5cc 100644 --- a/Code/RDGeneral/Invariant.h +++ b/Code/RDGeneral/Invariant.h @@ -66,7 +66,7 @@ class RDKIT_RDGENERAL_EXPORT Invariant : public std::runtime_error { prefix_d(prefix), file_dp(file), line_d(line) {} - ~Invariant() noexcept {}; + ~Invariant() noexcept {} const char* what() const noexcept override { return mess_d.c_str(); } diff --git a/Code/RDGeneral/RDExportMacros.h b/Code/RDGeneral/RDExportMacros.h index cd1db48ff..26925f7c4 100644 --- a/Code/RDGeneral/RDExportMacros.h +++ b/Code/RDGeneral/RDExportMacros.h @@ -20,21 +20,21 @@ // RDKit export macro definitions #ifdef RDKIT_DYN_LINK -#if defined( WIN32 ) && defined( _MSC_VER ) && defined( BOOST_HAS_DECLSPEC ) +#if defined(WIN32) && defined(_MSC_VER) && defined(BOOST_HAS_DECLSPEC) #define RDKIT_EXPORT_API __declspec(dllexport) #define RDKIT_IMPORT_API __declspec(dllimport) -#elif __GNUC__ >= 4 || defined( __clang__ ) +#elif __GNUC__ >= 4 || defined(__clang__) #define RDKIT_EXPORT_API __attribute__((visibility("default"))) #define RDKIT_IMPORT_API __attribute__((visibility("default"))) -#endif // WIN32 -#endif // RDKIT_DYN_LINK +#endif // WIN32 +#endif // RDKIT_DYN_LINK // RDKit end export macro definitions -#endif // SWIG +#endif // SWIG #ifndef RDKIT_EXPORT_API #define RDKIT_EXPORT_API #endif #ifndef RDKIT_IMPORT_API #define RDKIT_IMPORT_API -#endif \ No newline at end of file +#endif diff --git a/Code/RDGeneral/RDLog.h b/Code/RDGeneral/RDLog.h index 743168601..a5151c8ae 100644 --- a/Code/RDGeneral/RDLog.h +++ b/Code/RDGeneral/RDLog.h @@ -38,7 +38,7 @@ class RDKIT_RDGENERAL_EXPORT rdLogger { df_owner(owner), df_enabled(true), tee(nullptr), - teestream(nullptr){}; + teestream(nullptr) {} //! Sets a stream to tee the output to. void SetTee(std::ostream &stream) { @@ -117,8 +117,8 @@ RDKIT_RDGENERAL_EXPORT void InitLogs(); // ! Temporarily block logging until this object goes out of scope struct RDKIT_RDGENERAL_EXPORT BlockLogs { std::vector logs_to_reenable; - BlockLogs(); + BlockLogs(); ~BlockLogs(); }; -} +} // namespace RDLog #endif diff --git a/Code/RDGeneral/RDProps.h b/Code/RDGeneral/RDProps.h index 56a2f6356..0e6488718 100644 --- a/Code/RDGeneral/RDProps.h +++ b/Code/RDGeneral/RDProps.h @@ -118,7 +118,7 @@ class RDProps { } //! \overload - bool hasProp(const std::string &key) const { return d_props.hasVal(key); }; + bool hasProp(const std::string &key) const { return d_props.hasVal(key); } //! clears the value of a \c property /*! @@ -139,7 +139,7 @@ class RDProps { } } d_props.clearVal(key); - }; + } //! clears all of our \c computed \c properties void clearComputedProps() const { diff --git a/Code/RDGeneral/RDValue-taggedunion.h b/Code/RDGeneral/RDValue-taggedunion.h index 3cef831bf..3b96c648a 100644 --- a/Code/RDGeneral/RDValue-taggedunion.h +++ b/Code/RDGeneral/RDValue-taggedunion.h @@ -233,7 +233,7 @@ struct RDValue { inline RDValue(const boost::any &v) : value(new boost::any(v)), type(RDTypeTag::AnyTag) {} inline RDValue(const std::string &v) - : value(new std::string(v)), type(RDTypeTag::StringTag){}; + : value(new std::string(v)), type(RDTypeTag::StringTag) {} template inline RDValue(const T &v) : value(new boost::any(v)), type(RDTypeTag::AnyTag) {} @@ -411,14 +411,16 @@ inline int rdvalue_cast(RDValue_cast_t v) { template <> inline std::int8_t rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) return boost::numeric_cast(v.value.i); - if (rdvalue_is(v)) return boost::numeric_cast(v.value.u); + if (rdvalue_is(v)) + return boost::numeric_cast(v.value.u); throw boost::bad_any_cast(); } template <> inline std::int16_t rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) return boost::numeric_cast(v.value.i); - if (rdvalue_is(v)) return boost::numeric_cast(v.value.u); + if (rdvalue_is(v)) + return boost::numeric_cast(v.value.u); throw boost::bad_any_cast(); } @@ -427,7 +429,7 @@ inline std::int64_t rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) return static_cast(v.value.i); if (rdvalue_is(v)) return static_cast(v.value.u); if (rdvalue_is(v)) { - return boost::any_cast(*v.ptrCast()); + return boost::any_cast(*v.ptrCast()); } throw boost::bad_any_cast(); } @@ -442,14 +444,16 @@ inline unsigned int rdvalue_cast(RDValue_cast_t v) { template <> inline std::uint8_t rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) return boost::numeric_cast(v.value.u); - if (rdvalue_is(v)) return boost::numeric_cast(v.value.u); + if (rdvalue_is(v)) + return boost::numeric_cast(v.value.u); throw boost::bad_any_cast(); } template <> inline std::uint16_t rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) return boost::numeric_cast(v.value.i); - if (rdvalue_is(v)) return boost::numeric_cast(v.value.u); + if (rdvalue_is(v)) + return boost::numeric_cast(v.value.u); throw boost::bad_any_cast(); } @@ -458,7 +462,7 @@ inline std::uint64_t rdvalue_cast(RDValue_cast_t v) { if (rdvalue_is(v)) return static_cast(v.value.u); if (rdvalue_is(v)) return boost::numeric_cast(v.value.i); if (rdvalue_is(v)) { - return boost::any_cast(*v.ptrCast()); + return boost::any_cast(*v.ptrCast()); } throw boost::bad_any_cast(); } diff --git a/Code/RDGeneral/Ranking.h b/Code/RDGeneral/Ranking.h index 5f5a194a8..7b91c7d89 100644 --- a/Code/RDGeneral/Ranking.h +++ b/Code/RDGeneral/Ranking.h @@ -49,7 +49,7 @@ struct pairLess template class argless : public std::binary_function { public: - argless(const T &c) : std::binary_function(), container(c){}; + argless(const T &c) : std::binary_function(), container(c) {} bool operator()(unsigned int v1, unsigned int v2) const { return container[v1] < container[v2]; } diff --git a/Code/RDGeneral/StreamOps.h b/Code/RDGeneral/StreamOps.h index e26bb0e64..57ce42c78 100644 --- a/Code/RDGeneral/StreamOps.h +++ b/Code/RDGeneral/StreamOps.h @@ -357,7 +357,7 @@ const unsigned char EndTag = 0xFF; class CustomPropHandler { public: - virtual ~CustomPropHandler(){}; + virtual ~CustomPropHandler() {} virtual const char *getPropName() const = 0; virtual bool canSerialize(const RDValue &value) const = 0; virtual bool read(std::istream &ss, RDValue &value) const = 0; diff --git a/Code/RDGeneral/hash/detail/float_functions.hpp b/Code/RDGeneral/hash/detail/float_functions.hpp index c94427a8e..89d5d7674 100644 --- a/Code/RDGeneral/hash/detail/float_functions.hpp +++ b/Code/RDGeneral/hash/detail/float_functions.hpp @@ -9,7 +9,7 @@ #include #if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once +#pragma once #endif // The C++ standard requires that the C float functions are overloaded @@ -25,128 +25,122 @@ // STLport: #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -# if (defined(__GNUC__) && __GNUC__ < 3 && (defined(linux) || defined(__linux) || defined(__linux__))) || defined(__DMC__) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# elif defined(BOOST_MSVC) && BOOST_MSVC < 1300 -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# else -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -# endif +#if (defined(__GNUC__) && __GNUC__ < 3 && \ + (defined(linux) || defined(__linux) || defined(__linux__))) || \ + defined(__DMC__) +#define BOOST_HASH_USE_C99_FLOAT_FUNCS +#elif defined(BOOST_MSVC) && BOOST_MSVC < 1300 +#define BOOST_HASH_USE_C99_FLOAT_FUNCS +#else +#define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +#endif // Roguewave: // // On borland 5.51, with roguewave 2.1.1 the standard C++ overloads aren't // defined, but for the same version of roguewave on sunpro they are. #elif defined(_RWSTD_VER) -# if defined(__BORLANDC__) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# define BOOST_HASH_C99_NO_FLOAT_FUNCS -# elif defined(__DECCXX) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# else -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -# endif +#if defined(__BORLANDC__) +#define BOOST_HASH_USE_C99_FLOAT_FUNCS +#define BOOST_HASH_C99_NO_FLOAT_FUNCS +#elif defined(__DECCXX) +#define BOOST_HASH_USE_C99_FLOAT_FUNCS +#else +#define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +#endif // libstdc++ (gcc 3.0 onwards, I think) #elif defined(__GLIBCPP__) || defined(__GLIBCXX__) -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +#define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS // SGI: #elif defined(__STL_CONFIG_H) -# if defined(linux) || defined(__linux) || defined(__linux__) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# else -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -# endif +#if defined(linux) || defined(__linux) || defined(__linux__) +#define BOOST_HASH_USE_C99_FLOAT_FUNCS +#else +#define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +#endif // vxWorks. It has its own math library, but uses Dinkumware STL #elif defined(__VXWORKS__) -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +#define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS // Dinkumware. #elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) // Some versions of Visual C++ don't seem to have the C++ overloads but they // all seem to have the c99 float overloads -# if defined(BOOST_MSVC) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS +#if defined(BOOST_MSVC) +#define BOOST_HASH_USE_C99_FLOAT_FUNCS // On other platforms the C++ overloads seem to have been introduced sometime // before 402. -# elif defined(_CPPLIB_VER) && (_CPPLIB_VER >= 402) -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -# else -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# endif +#elif defined(_CPPLIB_VER) && (_CPPLIB_VER >= 402) +#define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +#else +#define BOOST_HASH_USE_C99_FLOAT_FUNCS +#endif // Digital Mars #elif defined(__DMC__) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS +#define BOOST_HASH_USE_C99_FLOAT_FUNCS // Use overloaded float functions by default. #else -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +#define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS #endif -namespace gboost -{ - namespace hash_detail - { +namespace gboost { +namespace hash_detail { - inline float call_ldexp(float v, int exp) - { - using namespace std; +inline float call_ldexp(float v, int exp) { + using namespace std; #if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \ defined(BOOST_HASH_C99_NO_FLOAT_FUNCS) - return ldexp(v, exp); + return ldexp(v, exp); #else - return ldexpf(v, exp); + return ldexpf(v, exp); #endif - } - - inline double call_ldexp(double v, int exp) - { - using namespace std; - return ldexp(v, exp); - } - - inline long double call_ldexp(long double v, int exp) - { - using namespace std; -#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) - return ldexp(v, exp); -#else - return ldexpl(v, exp); -#endif - } - - inline float call_frexp(float v, int* exp) - { - using namespace std; -#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \ - defined(BOOST_HASH_C99_NO_FLOAT_FUNCS) - return frexp(v, exp); -#else - return frexpf(v, exp); -#endif - } - - inline double call_frexp(double v, int* exp) - { - using namespace std; - return frexp(v, exp); - } - - inline long double call_frexp(long double v, int* exp) - { - using namespace std; -#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) - return frexp(v, exp); -#else - return frexpl(v, exp); -#endif - } - } } +inline double call_ldexp(double v, int exp) { + using namespace std; + return ldexp(v, exp); +} + +inline long double call_ldexp(long double v, int exp) { + using namespace std; +#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) + return ldexp(v, exp); +#else + return ldexpl(v, exp); +#endif +} + +inline float call_frexp(float v, int* exp) { + using namespace std; +#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \ + defined(BOOST_HASH_C99_NO_FLOAT_FUNCS) + return frexp(v, exp); +#else + return frexpf(v, exp); +#endif +} + +inline double call_frexp(double v, int* exp) { + using namespace std; + return frexp(v, exp); +} + +inline long double call_frexp(long double v, int* exp) { + using namespace std; +#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) + return frexp(v, exp); +#else + return frexpl(v, exp); +#endif +} +} // namespace hash_detail +} // namespace gboost + #if defined(BOOST_HASH_USE_C99_FLOAT_FUNCS) #undef BOOST_HASH_USE_C99_FLOAT_FUNCS #endif diff --git a/Code/RDGeneral/hash/detail/hash_float.hpp b/Code/RDGeneral/hash/detail/hash_float.hpp index b64eb5315..eaccbbd49 100644 --- a/Code/RDGeneral/hash/detail/hash_float.hpp +++ b/Code/RDGeneral/hash/detail/hash_float.hpp @@ -7,14 +7,14 @@ #define GBOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER #if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once +#pragma once #endif #if defined(BOOST_MSVC) #pragma warning(push) #if BOOST_MSVC >= 1400 -#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does - // not satisfy test. Loop body not executed +#pragma warning(disable : 6294) // Ill-defined for-loop: initial condition does + // not satisfy test. Loop body not executed #endif #endif @@ -29,9 +29,9 @@ // Cygwn #if defined(__CYGWIN__) -# if defined(__i386__) || defined(_M_IX86) -# define GBOOST_HASH_USE_x86_BINARY_HASH -# endif +#if defined(__i386__) || defined(_M_IX86) +#define GBOOST_HASH_USE_x86_BINARY_HASH +#endif // STLport #elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) @@ -39,12 +39,12 @@ // GNU libstdc++ 3 #elif defined(__GLIBCPP__) || defined(__GLIBCXX__) -# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \ - !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) -# define GBOOST_HASH_USE_FPCLASSIFY -# endif +#if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \ + !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) +#define GBOOST_HASH_USE_FPCLASSIFY +#endif -// Dinkumware Library, on Visual C++ +// Dinkumware Library, on Visual C++ #elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) // Not using _fpclass because it is only available for double. @@ -58,139 +58,120 @@ #include #endif -namespace gboost -{ - namespace hash_detail - { - template - struct limits : std::numeric_limits {}; +namespace gboost { +namespace hash_detail { +template +struct limits : std::numeric_limits {}; #if defined(__OpenBSD__) - template <> - struct limits - : std::numeric_limits - { - static long double epsilon() { - return LDBL_EPSILON; - } +template <> +struct limits : std::numeric_limits { + static long double epsilon() { return LDBL_EPSILON; } - static long double (max)() { - return LDBL_MAX; - } + static long double(max)() { return LDBL_MAX; } - static long double (min)() { - return LDBL_MIN; - } + static long double(min)() { return LDBL_MIN; } - BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG); - BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP); - BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP); - }; -#endif // __OpenBSD__ + BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG); + BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP); + BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP); +}; +#endif // __OpenBSD__ - inline void hash_float_combine(std::hash_result_t& seed, std::hash_result_t value) - { - seed ^= value + (seed<<6) + (seed>>2); - } +inline void hash_float_combine(std::hash_result_t& seed, + std::hash_result_t value) { + seed ^= value + (seed << 6) + (seed >> 2); +} // A simple, non-portable hash algorithm for x86. #if defined(GBOOST_HASH_USE_x86_BINARY_HASH) - inline std::hash_result_t float_hash_impl(float v) - { - std::uint32_t* ptr = (std::uint32_t*)&v; - std::hash_result_t seed = *ptr; - return seed; - } - - inline std::hash_result_t float_hash_impl(double v) - { - std::uint32_t* ptr = (std::uint32_t*)&v; - std::hash_result_t seed = *ptr++; - hash_float_combine(seed, *ptr); - return seed; - } - - inline std::hash_result_t float_hash_impl(long double v) - { - std::uint32_t* ptr = (std::uint32_t*)&v; - std::hash_result_t seed = *ptr++; - hash_float_combine(seed, *ptr++); - hash_float_combine(seed, *(std::uint16_t*)ptr); - return seed; - } - -#else - - template - inline std::hash_result_t float_hash_impl(T v) - { - int exp = 0; - - v = gboost::hash_detail::call_frexp(v, &exp); - - // A positive value is easier to hash, so combine the - // sign with the exponent. - if(v < 0) { - v = -v; - exp += limits::max_exponent - - limits::min_exponent; - } - - // The result of frexp is always between 0.5 and 1, so its - // top bit will always be 1. Subtract by 0.5 to remove that. - v -= T(0.5); - v = gboost::hash_detail::call_ldexp(v, - limits::digits + 1); - std::hash_result_t seed = static_cast(v); - v -= seed; - - // ceiling(digits(T) * log2(radix(T))/ digits(hash_result_t)) - 1; - std::hash_result_t const length - = (limits::digits * - boost::static_log2::radix>::value - 1) - / limits::digits; - - for(std::hash_result_t i = 0; i != length; ++i) - { - v = gboost::hash_detail::call_ldexp(v, - limits::digits); - std::hash_result_t part = static_cast(v); - v -= part; - hash_float_combine(seed, part); - } - - hash_float_combine(seed, exp); - - return seed; - } -#endif - - template - inline std::hash_result_t float_hash_value(T v) - { -#if defined(GBOOST_HASH_USE_FPCLASSIFY) - using namespace std; - switch (fpclassify(v)) { - case FP_ZERO: - return 0; - case FP_INFINITE: - return (std::hash_result_t)(v > 0 ? -1 : -2); - case FP_NAN: - return (std::hash_result_t)(-3); - case FP_NORMAL: - case FP_SUBNORMAL: - return float_hash_impl(v); - default: - BOOST_ASSERT(0); - return 0; - } -#else - return v == 0 ? 0 : float_hash_impl(v); -#endif - } - } +inline std::hash_result_t float_hash_impl(float v) { + std::uint32_t* ptr = (std::uint32_t*)&v; + std::hash_result_t seed = *ptr; + return seed; } +inline std::hash_result_t float_hash_impl(double v) { + std::uint32_t* ptr = (std::uint32_t*)&v; + std::hash_result_t seed = *ptr++; + hash_float_combine(seed, *ptr); + return seed; +} + +inline std::hash_result_t float_hash_impl(long double v) { + std::uint32_t* ptr = (std::uint32_t*)&v; + std::hash_result_t seed = *ptr++; + hash_float_combine(seed, *ptr++); + hash_float_combine(seed, *(std::uint16_t*)ptr); + return seed; +} + +#else + +template +inline std::hash_result_t float_hash_impl(T v) { + int exp = 0; + + v = gboost::hash_detail::call_frexp(v, &exp); + + // A positive value is easier to hash, so combine the + // sign with the exponent. + if (v < 0) { + v = -v; + exp += limits::max_exponent - limits::min_exponent; + } + + // The result of frexp is always between 0.5 and 1, so its + // top bit will always be 1. Subtract by 0.5 to remove that. + v -= T(0.5); + v = gboost::hash_detail::call_ldexp(v, + limits::digits + 1); + std::hash_result_t seed = static_cast(v); + v -= seed; + + // ceiling(digits(T) * log2(radix(T))/ digits(hash_result_t)) - 1; + std::hash_result_t const length = + (limits::digits * boost::static_log2::radix>::value - 1) / + limits::digits; + + for (std::hash_result_t i = 0; i != length; ++i) { + v = gboost::hash_detail::call_ldexp(v, limits::digits); + std::hash_result_t part = static_cast(v); + v -= part; + hash_float_combine(seed, part); + } + + hash_float_combine(seed, exp); + + return seed; +} +#endif + +template +inline std::hash_result_t float_hash_value(T v) { +#if defined(GBOOST_HASH_USE_FPCLASSIFY) + using namespace std; + switch (fpclassify(v)) { + case FP_ZERO: + return 0; + case FP_INFINITE: + return (std::hash_result_t)(v > 0 ? -1 : -2); + case FP_NAN: + return (std::hash_result_t)(-3); + case FP_NORMAL: + case FP_SUBNORMAL: + return float_hash_impl(v); + default: + BOOST_ASSERT(0); + return 0; + } +#else + return v == 0 ? 0 : float_hash_impl(v); +#endif +} +} // namespace hash_detail +} // namespace gboost + #if defined(BOOST_MSVC) #pragma warning(pop) #endif diff --git a/Code/RDGeneral/hash/extensions.hpp b/Code/RDGeneral/hash/extensions.hpp index a438928cf..c4dcfc8c3 100644 --- a/Code/RDGeneral/hash/extensions.hpp +++ b/Code/RDGeneral/hash/extensions.hpp @@ -5,180 +5,148 @@ // Based on Peter Dimov's proposal // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. +// issue 6.18. #if !defined(GBOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) #define GBOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once +#pragma once #endif #include -namespace gboost -{ +namespace gboost { #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - namespace hash_detail - { - template - struct call_hash_impl - { - template - struct inner - { - static std::hash_result_t call(T const& v) - { - using namespace boost; - return hash_value(v); - } - }; - }; - - template <> - struct call_hash_impl - { - template - struct inner - { -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - static std::hash_result_t call(Array const& v) -#else - static std::hash_result_t call(Array& v) -#endif - { - const int size = sizeof(v) / sizeof(*v); - return gboost::hash_range(v, v + size); - } - }; - }; - - template - struct call_hash - : public call_hash_impl::value> - ::BOOST_NESTED_TEMPLATE inner - { - }; +namespace hash_detail { +template +struct call_hash_impl { + template + struct inner { + static std::hash_result_t call(T const& v) { + using namespace boost; + return hash_value(v); } -#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + }; +}; + +template <> +struct call_hash_impl { + template + struct inner { +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + static std::hash_result_t call(Array const& v) +#else + static std::hash_result_t call(Array& v) +#endif + { + const int size = sizeof(v) / sizeof(*v); + return gboost::hash_range(v, v + size); + } + }; +}; + +template +struct call_hash + : public call_hash_impl::value>::BOOST_NESTED_TEMPLATE + inner {}; +} // namespace hash_detail +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - template struct hash - : std::unary_function - { +template +struct hash : std::unary_function { #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - std::hash_result_t operator()(T const& val) const - { - return hash_value(val); - } + std::hash_result_t operator()(T const& val) const { return hash_value(val); } #else - std::hash_result_t operator()(T const& val) const - { - return hash_detail::call_hash::call(val); - } + std::hash_result_t operator()(T const& val) const { + return hash_detail::call_hash::call(val); + } #endif - }; +}; #if BOOST_WORKAROUND(__DMC__, <= 0x848) - template struct hash - : std::unary_function - { - std::hash_result_t operator()(const T* val) const - { - return gboost::hash_range(val, val+n); - } - }; +template +struct hash : std::unary_function { + std::hash_result_t operator()(const T* val) const { + return gboost::hash_range(val, val + n); + } +}; #endif -#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // On compilers without partial specialization, boost::hash - // has already been declared to deal with pointers, so just - // need to supply the non-pointer version. +// On compilers without partial specialization, boost::hash +// has already been declared to deal with pointers, so just +// need to supply the non-pointer version. - namespace hash_detail - { - template - struct hash_impl; +namespace hash_detail { +template +struct hash_impl; #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template <> - struct hash_impl - { - template - struct inner - : std::unary_function - { +template <> +struct hash_impl { + template + struct inner : std::unary_function { #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - std::hash_result_t operator()(T const& val) const - { - return hash_value(val); - } -#else - std::hash_result_t operator()(T const& val) const - { - return hash_detail::call_hash::call(val); - } -#endif - }; - }; - -#else // Visual C++ 6.5 - - // There's probably a more elegant way to Visual C++ 6.5 to work - // but I don't know what it is. - - template - struct hash_impl_msvc - { - template - struct inner - : public std::unary_function - { - std::hash_result_t operator()(T const& val) const - { - return hash_detail::call_hash::call(val); - } - - std::hash_result_t operator()(T& val) const - { - return hash_detail::call_hash::call(val); - } - }; - }; - - template <> - struct hash_impl_msvc - { - template - struct inner - : public std::unary_function - { - std::hash_result_t operator()(T& val) const - { - return hash_detail::call_hash::call(val); - } - }; - }; - - template - struct hash_impl_msvc2 - : public hash_impl_msvc::value> - ::BOOST_NESTED_TEMPLATE inner {}; - - template <> - struct hash_impl - { - template - struct inner : public hash_impl_msvc2 {}; - }; - -#endif // Visual C++ 6.5 + std::hash_result_t operator()(T const& val) const { + return hash_value(val); } +#else + std::hash_result_t operator()(T const& val) const { + return hash_detail::call_hash::call(val); + } +#endif + }; +}; + +#else // Visual C++ 6.5 + +// There's probably a more elegant way to Visual C++ 6.5 to work +// but I don't know what it is. + +template +struct hash_impl_msvc { + template + struct inner : public std::unary_function { + std::hash_result_t operator()(T const& val) const { + return hash_detail::call_hash::call(val); + } + + std::hash_result_t operator()(T& val) const { + return hash_detail::call_hash::call(val); + } + }; +}; + +template <> +struct hash_impl_msvc { + template + struct inner : public std::unary_function { + std::hash_result_t operator()(T& val) const { + return hash_detail::call_hash::call(val); + } + }; +}; + +template +struct hash_impl_msvc2 + : public hash_impl_msvc::value>::BOOST_NESTED_TEMPLATE + inner {}; + +template <> +struct hash_impl { + template + struct inner : public hash_impl_msvc2 {}; +}; + +#endif // Visual C++ 6.5 +} // namespace hash_detail #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -} +} // namespace gboost #endif diff --git a/Code/RDGeneral/hash/hash.hpp b/Code/RDGeneral/hash/hash.hpp index 57c056e33..4f02a4e71 100644 --- a/Code/RDGeneral/hash/hash.hpp +++ b/Code/RDGeneral/hash/hash.hpp @@ -7,7 +7,7 @@ // // Based on Peter Dimov's proposal // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. +// issue 6.18. #if !defined(GBOOST_FUNCTIONAL_HASH_HASH_HPP) #define GBOOST_FUNCTIONAL_HASH_HASH_HPP @@ -30,488 +30,434 @@ #include #endif -namespace gboost -{ - std::hash_result_t hash_value(bool); - std::hash_result_t hash_value(char); - std::hash_result_t hash_value(unsigned char); - std::hash_result_t hash_value(signed char); - std::hash_result_t hash_value(short); - std::hash_result_t hash_value(unsigned short); - std::hash_result_t hash_value(int); - std::hash_result_t hash_value(unsigned int); - std::hash_result_t hash_value(long); - std::hash_result_t hash_value(unsigned long); +namespace gboost { +std::hash_result_t hash_value(bool); +std::hash_result_t hash_value(char); +std::hash_result_t hash_value(unsigned char); +std::hash_result_t hash_value(signed char); +std::hash_result_t hash_value(short); +std::hash_result_t hash_value(unsigned short); +std::hash_result_t hash_value(int); +std::hash_result_t hash_value(unsigned int); +std::hash_result_t hash_value(long); +std::hash_result_t hash_value(unsigned long); #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - std::hash_result_t hash_value(wchar_t); +std::hash_result_t hash_value(wchar_t); #endif - + #if defined(BOOST_HAS_LONG_LONG) - std::hash_result_t hash_value(boost::long_long_type); - std::hash_result_t hash_value(boost::ulong_long_type); +std::hash_result_t hash_value(boost::long_long_type); +std::hash_result_t hash_value(boost::ulong_long_type); #endif #if !BOOST_WORKAROUND(__DMC__, <= 0x848) - template std::hash_result_t hash_value(T* const&); +template +std::hash_result_t hash_value(T* const&); #else - template std::hash_result_t hash_value(T*); +template +std::hash_result_t hash_value(T*); #endif #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - template< class T, unsigned N > - std::hash_result_t hash_value(const T (&x)[N]); +template +std::hash_result_t hash_value(const T (&x)[N]); - template< class T, unsigned N > - std::hash_result_t hash_value(T (&x)[N]); +template +std::hash_result_t hash_value(T (&x)[N]); #endif - std::hash_result_t hash_value(float v); - std::hash_result_t hash_value(double v); - std::hash_result_t hash_value(long double v); +std::hash_result_t hash_value(float v); +std::hash_result_t hash_value(double v); +std::hash_result_t hash_value(long double v); - template - std::hash_result_t hash_value(std::pair const&); - template - std::hash_result_t hash_value(std::vector const&); - template - std::hash_result_t hash_value(std::list const& v); - template - std::hash_result_t hash_value(std::deque const& v); - template - std::hash_result_t hash_value(std::set const& v); - template - std::hash_result_t hash_value(std::multiset const& v); - template - std::hash_result_t hash_value(std::map const& v); - template - std::hash_result_t hash_value(std::multimap const& v); +template +std::hash_result_t hash_value(std::pair const&); +template +std::hash_result_t hash_value(std::vector const&); +template +std::hash_result_t hash_value(std::list const& v); +template +std::hash_result_t hash_value(std::deque const& v); +template +std::hash_result_t hash_value(std::set const& v); +template +std::hash_result_t hash_value(std::multiset const& v); +template +std::hash_result_t hash_value(std::map const& v); +template +std::hash_result_t hash_value(std::multimap const& v); - template - std::hash_result_t hash_value(std::complex const&); +template +std::hash_result_t hash_value(std::complex const&); - // Implementation +// Implementation - namespace hash_detail - { - template - inline std::hash_result_t hash_value_signed(T val) - { - const int hash_result_t_bits = std::numeric_limits::digits; - // ceiling(std::numeric_limits::digits / hash_result_t_bits) - 1 - const int length = (std::numeric_limits::digits - 1) - / hash_result_t_bits; +namespace hash_detail { +template +inline std::hash_result_t hash_value_signed(T val) { + const int hash_result_t_bits = + std::numeric_limits::digits; + // ceiling(std::numeric_limits::digits / hash_result_t_bits) - 1 + const int length = (std::numeric_limits::digits - 1) / hash_result_t_bits; - std::hash_result_t seed = 0; - T positive = val < 0 ? -1 - val : val; + std::hash_result_t seed = 0; + T positive = val < 0 ? -1 - val : val; - // Hopefully, this loop can be unrolled. - for(unsigned int i = length * hash_result_t_bits; i > 0; i -= hash_result_t_bits) - { - seed ^= (std::hash_result_t) (positive >> i) + (seed<<6) + (seed>>2); - } - seed ^= (std::hash_result_t) val + (seed<<6) + (seed>>2); + // Hopefully, this loop can be unrolled. + for (unsigned int i = length * hash_result_t_bits; i > 0; + i -= hash_result_t_bits) { + seed ^= (std::hash_result_t)(positive >> i) + (seed << 6) + (seed >> 2); + } + seed ^= (std::hash_result_t)val + (seed << 6) + (seed >> 2); - return seed; - } + return seed; +} - template - inline std::hash_result_t hash_value_unsigned(T val) - { - const int hash_result_t_bits = std::numeric_limits::digits; - // ceiling(std::numeric_limits::digits / hash_result_t_bits) - 1 - const int length = (std::numeric_limits::digits - 1) - / hash_result_t_bits; +template +inline std::hash_result_t hash_value_unsigned(T val) { + const int hash_result_t_bits = + std::numeric_limits::digits; + // ceiling(std::numeric_limits::digits / hash_result_t_bits) - 1 + const int length = (std::numeric_limits::digits - 1) / hash_result_t_bits; - std::hash_result_t seed = 0; + std::hash_result_t seed = 0; - // Hopefully, this loop can be unrolled. - for(unsigned int i = length * hash_result_t_bits; i > 0; i -= hash_result_t_bits) - { - seed ^= (std::hash_result_t) (val >> i) + (seed<<6) + (seed>>2); - } - seed ^= (std::hash_result_t) val + (seed<<6) + (seed>>2); + // Hopefully, this loop can be unrolled. + for (unsigned int i = length * hash_result_t_bits; i > 0; + i -= hash_result_t_bits) { + seed ^= (std::hash_result_t)(val >> i) + (seed << 6) + (seed >> 2); + } + seed ^= (std::hash_result_t)val + (seed << 6) + (seed >> 2); - return seed; - } - } + return seed; +} +} // namespace hash_detail - inline std::hash_result_t hash_value(bool v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(bool v) { + return static_cast(v); +} - inline std::hash_result_t hash_value(char v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(char v) { + return static_cast(v); +} - inline std::hash_result_t hash_value(unsigned char v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(unsigned char v) { + return static_cast(v); +} - inline std::hash_result_t hash_value(signed char v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(signed char v) { + return static_cast(v); +} - inline std::hash_result_t hash_value(short v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(short v) { + return static_cast(v); +} - inline std::hash_result_t hash_value(unsigned short v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(unsigned short v) { + return static_cast(v); +} - inline std::hash_result_t hash_value(int v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(int v) { + return static_cast(v); +} - inline std::hash_result_t hash_value(unsigned int v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(unsigned int v) { + return static_cast(v); +} - inline std::hash_result_t hash_value(long v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(long v) { + return static_cast(v); +} - inline std::hash_result_t hash_value(unsigned long v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(unsigned long v) { + return static_cast(v); +} #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - inline std::hash_result_t hash_value(wchar_t v) - { - return static_cast(v); - } +inline std::hash_result_t hash_value(wchar_t v) { + return static_cast(v); +} #endif #if defined(BOOST_HAS_LONG_LONG) - inline std::hash_result_t hash_value(boost::long_long_type v) - { - return hash_detail::hash_value_signed(v); - } +inline std::hash_result_t hash_value(boost::long_long_type v) { + return hash_detail::hash_value_signed(v); +} - inline std::hash_result_t hash_value(boost::ulong_long_type v) - { - return hash_detail::hash_value_unsigned(v); - } +inline std::hash_result_t hash_value(boost::ulong_long_type v) { + return hash_detail::hash_value_unsigned(v); +} #endif - // Implementation by Alberto Barbati and Dave Harris. +// Implementation by Alberto Barbati and Dave Harris. #if !BOOST_WORKAROUND(__DMC__, <= 0x848) - template std::hash_result_t hash_value(T* const& v) +template +std::hash_result_t hash_value(T* const& v) #else - template std::hash_result_t hash_value(T* v) +template +std::hash_result_t hash_value(T* v) #endif - { - std::hash_result_t x = static_cast( - reinterpret_cast(v)); +{ + std::hash_result_t x = + static_cast(reinterpret_cast(v)); - return x + (x >> 3); - } + return x + (x >> 3); +} #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template - inline void hash_combine(std::hash_result_t& seed, T& v) +template +inline void hash_combine(std::hash_result_t& seed, T& v) #else - template - inline void hash_combine(std::hash_result_t& seed, T const& v) +template +inline void hash_combine(std::hash_result_t& seed, T const& v) #endif - { - gboost::hash hasher; - seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); - } +{ + gboost::hash hasher; + seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); +} - template - inline std::hash_result_t hash_range(It first, It last) - { - std::hash_result_t seed = 0; +template +inline std::hash_result_t hash_range(It first, It last) { + std::hash_result_t seed = 0; - for(; first != last; ++first) - { - hash_combine(seed, *first); - } + for (; first != last; ++first) { + hash_combine(seed, *first); + } - return seed; - } + return seed; +} - template - inline void hash_range(std::hash_result_t& seed, It first, It last) - { - for(; first != last; ++first) - { - hash_combine(seed, *first); - } - } +template +inline void hash_range(std::hash_result_t& seed, It first, It last) { + for (; first != last; ++first) { + hash_combine(seed, *first); + } +} #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) - template - inline std::hash_result_t hash_range(T* first, T* last) - { - std::hash_result_t seed = 0; +template +inline std::hash_result_t hash_range(T* first, T* last) { + std::hash_result_t seed = 0; - for(; first != last; ++first) - { - gboost::hash hasher; - seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); - } + for (; first != last; ++first) { + gboost::hash hasher; + seed ^= hasher(*first) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } - return seed; - } + return seed; +} - template - inline void hash_range(std::hash_result_t& seed, T* first, T* last) - { - for(; first != last; ++first) - { - gboost::hash hasher; - seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); - } - } +template +inline void hash_range(std::hash_result_t& seed, T* first, T* last) { + for (; first != last; ++first) { + gboost::hash hasher; + seed ^= hasher(*first) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } +} #endif #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - template< class T, unsigned N > - inline std::hash_result_t hash_value(const T (&x)[N]) - { - return hash_range(x, x + N); - } +template +inline std::hash_result_t hash_value(const T (&x)[N]) { + return hash_range(x, x + N); +} - template< class T, unsigned N > - inline std::hash_result_t hash_value(T (&x)[N]) - { - return hash_range(x, x + N); - } +template +inline std::hash_result_t hash_value(T (&x)[N]) { + return hash_range(x, x + N); +} #endif - inline std::hash_result_t hash_value(float v) - { - return gboost::hash_detail::float_hash_value(v); - } +inline std::hash_result_t hash_value(float v) { + return gboost::hash_detail::float_hash_value(v); +} - inline std::hash_result_t hash_value(double v) - { - return gboost::hash_detail::float_hash_value(v); - } +inline std::hash_result_t hash_value(double v) { + return gboost::hash_detail::float_hash_value(v); +} - inline std::hash_result_t hash_value(long double v) - { - return gboost::hash_detail::float_hash_value(v); - } +inline std::hash_result_t hash_value(long double v) { + return gboost::hash_detail::float_hash_value(v); +} - template - std::hash_result_t hash_value(std::pair const& v) - { - std::hash_result_t seed = 0; - hash_combine(seed, v.first); - hash_combine(seed, v.second); - return seed; - } +template +std::hash_result_t hash_value(std::pair const& v) { + std::hash_result_t seed = 0; + hash_combine(seed, v.first); + hash_combine(seed, v.second); + return seed; +} - template - std::hash_result_t hash_value(std::vector const& v) - { - return hash_range(v.begin(), v.end()); - } +template +std::hash_result_t hash_value(std::vector const& v) { + return hash_range(v.begin(), v.end()); +} - template - std::hash_result_t hash_value(std::list const& v) - { - return hash_range(v.begin(), v.end()); - } +template +std::hash_result_t hash_value(std::list const& v) { + return hash_range(v.begin(), v.end()); +} - template - std::hash_result_t hash_value(std::deque const& v) - { - return hash_range(v.begin(), v.end()); - } +template +std::hash_result_t hash_value(std::deque const& v) { + return hash_range(v.begin(), v.end()); +} - template - std::hash_result_t hash_value(std::set const& v) - { - return hash_range(v.begin(), v.end()); - } +template +std::hash_result_t hash_value(std::set const& v) { + return hash_range(v.begin(), v.end()); +} - template - std::hash_result_t hash_value(std::multiset const& v) - { - return hash_range(v.begin(), v.end()); - } +template +std::hash_result_t hash_value(std::multiset const& v) { + return hash_range(v.begin(), v.end()); +} - template - std::hash_result_t hash_value(std::map const& v) - { - return hash_range(v.begin(), v.end()); - } +template +std::hash_result_t hash_value(std::map const& v) { + return hash_range(v.begin(), v.end()); +} - template - std::hash_result_t hash_value(std::multimap const& v) - { - return hash_range(v.begin(), v.end()); - } +template +std::hash_result_t hash_value(std::multimap const& v) { + return hash_range(v.begin(), v.end()); +} - template - std::hash_result_t hash_value(std::complex const& v) - { - gboost::hash hasher; - std::hash_result_t seed = hasher(v.imag()); - seed ^= hasher(v.real()) + (seed<<6) + (seed>>2); - return seed; - } +template +std::hash_result_t hash_value(std::complex const& v) { + gboost::hash hasher; + std::hash_result_t seed = hasher(v.imag()); + seed ^= hasher(v.real()) + (seed << 6) + (seed >> 2); + return seed; +} - // - // gboost::hash - // +// +// gboost::hash +// #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) -#define BOOST_HASH_SPECIALIZE(type) \ - template <> struct hash \ - : public std::unary_function \ - { \ - std::hash_result_t operator()(type v) const \ - { \ - return gboost::hash_value(v); \ - } \ - }; +#define BOOST_HASH_SPECIALIZE(type) \ + template <> \ + struct hash : public std::unary_function { \ + std::hash_result_t operator()(type v) const { \ + return gboost::hash_value(v); \ + } \ + }; -#define BOOST_HASH_SPECIALIZE_REF(type) \ - template <> struct hash \ - : public std::unary_function \ - { \ - std::hash_result_t operator()(type const& v) const \ - { \ - return gboost::hash_value(v); \ - } \ - }; +#define BOOST_HASH_SPECIALIZE_REF(type) \ + template <> \ + struct hash : public std::unary_function { \ + std::hash_result_t operator()(type const& v) const { \ + return gboost::hash_value(v); \ + } \ + }; #else -#define BOOST_HASH_SPECIALIZE(type) \ - template <> struct hash \ - : public std::unary_function \ - { \ - std::hash_result_t operator()(type v) const \ - { \ - return gboost::hash_value(v); \ - } \ - }; \ - \ - template <> struct hash \ - : public std::unary_function \ - { \ - std::hash_result_t operator()(const type v) const \ - { \ - return gboost::hash_value(v); \ - } \ - }; +#define BOOST_HASH_SPECIALIZE(type) \ + template <> \ + struct hash : public std::unary_function { \ + std::hash_result_t operator()(type v) const { \ + return gboost::hash_value(v); \ + } \ + }; \ + \ + template <> \ + struct hash \ + : public std::unary_function { \ + std::hash_result_t operator()(const type v) const { \ + return gboost::hash_value(v); \ + } \ + }; -#define BOOST_HASH_SPECIALIZE_REF(type) \ - template <> struct hash \ - : public std::unary_function \ - { \ - std::hash_result_t operator()(type const& v) const \ - { \ - return gboost::hash_value(v); \ - } \ - }; \ - \ - template <> struct hash \ - : public std::unary_function \ - { \ - std::hash_result_t operator()(type const& v) const \ - { \ - return gboost::hash_value(v); \ - } \ - }; +#define BOOST_HASH_SPECIALIZE_REF(type) \ + template <> \ + struct hash : public std::unary_function { \ + std::hash_result_t operator()(type const& v) const { \ + return gboost::hash_value(v); \ + } \ + }; \ + \ + template <> \ + struct hash \ + : public std::unary_function { \ + std::hash_result_t operator()(type const& v) const { \ + return gboost::hash_value(v); \ + } \ + }; #endif - BOOST_HASH_SPECIALIZE(bool) - BOOST_HASH_SPECIALIZE(char) - BOOST_HASH_SPECIALIZE(signed char) - BOOST_HASH_SPECIALIZE(unsigned char) +BOOST_HASH_SPECIALIZE(bool) +BOOST_HASH_SPECIALIZE(char) +BOOST_HASH_SPECIALIZE(signed char) +BOOST_HASH_SPECIALIZE(unsigned char) #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - BOOST_HASH_SPECIALIZE(wchar_t) +BOOST_HASH_SPECIALIZE(wchar_t) #endif - BOOST_HASH_SPECIALIZE(short) - BOOST_HASH_SPECIALIZE(unsigned short) - BOOST_HASH_SPECIALIZE(int) - BOOST_HASH_SPECIALIZE(unsigned int) - BOOST_HASH_SPECIALIZE(long) - BOOST_HASH_SPECIALIZE(unsigned long) +BOOST_HASH_SPECIALIZE(short) +BOOST_HASH_SPECIALIZE(unsigned short) +BOOST_HASH_SPECIALIZE(int) +BOOST_HASH_SPECIALIZE(unsigned int) +BOOST_HASH_SPECIALIZE(long) +BOOST_HASH_SPECIALIZE(unsigned long) - BOOST_HASH_SPECIALIZE(float) - BOOST_HASH_SPECIALIZE(double) - BOOST_HASH_SPECIALIZE(long double) +BOOST_HASH_SPECIALIZE(float) +BOOST_HASH_SPECIALIZE(double) +BOOST_HASH_SPECIALIZE(long double) #undef BOOST_HASH_SPECIALIZE #undef BOOST_HASH_SPECIALIZE_REF #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - template - struct hash - : public std::unary_function - { - std::hash_result_t operator()(T* v) const - { +template +struct hash : public std::unary_function { + std::hash_result_t operator()(T* v) const { #if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) - return gboost::hash_value(v); + return gboost::hash_value(v); #else - std::hash_result_t x = static_cast( - reinterpret_cast(v)); + std::hash_result_t x = + static_cast(reinterpret_cast(v)); - return x + (x >> 3); + return x + (x >> 3); #endif - } - }; + } +}; #else - namespace hash_detail - { - template - struct hash_impl; +namespace hash_detail { +template +struct hash_impl; - template <> - struct hash_impl - { - template - struct inner - : public std::unary_function - { - std::hash_result_t operator()(T val) const - { +template <> +struct hash_impl { + template + struct inner : public std::unary_function { + std::hash_result_t operator()(T val) const { #if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590) - return gboost::hash_value(val); + return gboost::hash_value(val); #else - std::hash_result_t x = static_cast( - reinterpret_cast(val)); + std::hash_result_t x = static_cast( + reinterpret_cast(val)); - return x + (x >> 3); + return x + (x >> 3); #endif - } - }; - }; } + }; +}; +} // namespace hash_detail - template struct hash - : public gboost::hash_detail::hash_impl::value> - ::BOOST_NESTED_TEMPLATE inner - { - }; +template +struct hash : public gboost::hash_detail::hash_impl< + boost::is_pointer::value>::BOOST_NESTED_TEMPLATE inner { +}; #endif -} +} // namespace gboost -#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP +#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP // Include this outside of the include guards in case the file is included // twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it // undefined. -#if !defined(GBOOST_HASH_NO_EXTENSIONS) \ - && !defined(GBOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) +#if !defined(GBOOST_HASH_NO_EXTENSIONS) && \ + !defined(GBOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) #include #endif diff --git a/Code/RDGeneral/hash/hash_fwd.hpp b/Code/RDGeneral/hash/hash_fwd.hpp index 09ffb1dae..8714f585d 100644 --- a/Code/RDGeneral/hash/hash_fwd.hpp +++ b/Code/RDGeneral/hash/hash_fwd.hpp @@ -5,41 +5,47 @@ // Based on Peter Dimov's proposal // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. +// issue 6.18. #if !defined(GBOOST_FUNCTIONAL_HASH_FWD_HPP) #define GBOOST_FUNCTIONAL_HASH_FWD_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once +#pragma once #endif #include -namespace std{ - typedef std::uint32_t hash_result_t; +namespace std { +typedef std::uint32_t hash_result_t; } #include #include #include -namespace gboost -{ - template struct hash; +namespace gboost { +template +struct hash; #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template void hash_combine(std::hash_result_t& seed, T& v); +template +void hash_combine(std::hash_result_t& seed, T& v); #else - template void hash_combine(std::hash_result_t& seed, T const& v); +template +void hash_combine(std::hash_result_t& seed, T const& v); #endif - template std::hash_result_t hash_range(It, It); - template void hash_range(std::hash_result_t&, It, It); +template +std::hash_result_t hash_range(It, It); +template +void hash_range(std::hash_result_t&, It, It); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) - template inline std::hash_result_t hash_range(T*, T*); - template inline void hash_range(std::hash_result_t&, T*, T*); +template +inline std::hash_result_t hash_range(T*, T*); +template +inline void hash_range(std::hash_result_t&, T*, T*); #endif -} +} // namespace gboost #endif diff --git a/Code/RDGeneral/types.h b/Code/RDGeneral/types.h index 3557669f4..272d393c1 100644 --- a/Code/RDGeneral/types.h +++ b/Code/RDGeneral/types.h @@ -325,7 +325,7 @@ typedef INT_SET::const_iterator INT_SET_CI; //! functor to compare two doubles with a tolerance struct RDKIT_RDGENERAL_EXPORT ltDouble { public: - ltDouble(){}; + ltDouble() {} bool operator()(double d1, double d2) const { if (fabs(d1 - d2) < _tol) { return false; @@ -344,7 +344,7 @@ typedef std::map DOUBLE_INT_MAP; //! functor for returning the larger of two values template struct RDKIT_RDGENERAL_EXPORT larger_of { - T operator()(T arg1, T arg2) { return arg1 > arg2 ? arg1 : arg2; }; + T operator()(T arg1, T arg2) { return arg1 > arg2 ? arg1 : arg2; } }; //! functor for comparing two strings @@ -353,7 +353,7 @@ struct RDKIT_RDGENERAL_EXPORT charptr_functor { // std::cout << s1 << " " << s2 << " " << strcmp(s1, s2) << "\n"; return strcmp(s1, s2) < 0; - }; + } }; //! \brief calculate the union of two INT_VECTs and put the results in a diff --git a/Code/RDGeneral/versions.h.cmake b/Code/RDGeneral/versions.h.cmake index ad0599909..92bbe8356 100644 --- a/Code/RDGeneral/versions.h.cmake +++ b/Code/RDGeneral/versions.h.cmake @@ -8,18 +8,20 @@ // of the RDKit source tree. // - -// inspired by: https://github.com/openbabel/openbabel/blob/master/src/config.h.cmake +// inspired by: +// https://github.com/openbabel/openbabel/blob/master/src/config.h.cmake #include /* Version check macro Can be used like #if (RDKIT_VERSION >= RDKIT_VERSION_CHECK(2018, 3, 1)) */ -#define RDKIT_VERSION_CHECK(year, month, rev) ((year*1000)+(month*10)+(rev)) +#define RDKIT_VERSION_CHECK(year, month, rev) \ + ((year * 1000) + (month * 10) + (rev)) /* RDKIT_VERSION is (year*1000) + (month*10) + (rev) */ -#define RDKIT_VERSION RDKIT_VERSION_CHECK(@RDKit_Year@, @RDKit_intMonth@, @RDKit_Revision@) +#define RDKIT_VERSION \ + RDKIT_VERSION_CHECK(@RDKit_Year @, @RDKit_intMonth @, @RDKit_Revision @) namespace RDKit { - RDKIT_RDGENERAL_EXPORT extern const char * rdkitVersion; - RDKIT_RDGENERAL_EXPORT extern const char * boostVersion; - RDKIT_RDGENERAL_EXPORT extern const char * rdkitBuild; -} +RDKIT_RDGENERAL_EXPORT extern const char* rdkitVersion; +RDKIT_RDGENERAL_EXPORT extern const char* boostVersion; +RDKIT_RDGENERAL_EXPORT extern const char* rdkitBuild; +} // namespace RDKit diff --git a/Code/SimDivPickers/DistPicker.h b/Code/SimDivPickers/DistPicker.h index f44c78bc4..3be677fe3 100644 --- a/Code/SimDivPickers/DistPicker.h +++ b/Code/SimDivPickers/DistPicker.h @@ -48,8 +48,8 @@ class RDKIT_SIMDIVPICKERS_EXPORT DistPicker { /*! \brief Default constructor * */ - DistPicker(){}; - virtual ~DistPicker(){}; + DistPicker() {} + virtual ~DistPicker() {} /*! \brief this is a virtual function specific to the type of algorihtm used * @@ -77,7 +77,7 @@ class RDKIT_SIMDIVPICKERS_EXPORT DistPicker { namespace { class distmatFunctor { public: - distmatFunctor(const double *distMat) : dp_distMat(distMat){}; + distmatFunctor(const double *distMat) : dp_distMat(distMat) {} double operator()(unsigned int i, unsigned int j) { return getDistFromLTM(this->dp_distMat, i, j); } diff --git a/Code/SimDivPickers/HierarchicalClusterPicker.h b/Code/SimDivPickers/HierarchicalClusterPicker.h index 37c11ba9d..0574dcf66 100644 --- a/Code/SimDivPickers/HierarchicalClusterPicker.h +++ b/Code/SimDivPickers/HierarchicalClusterPicker.h @@ -41,9 +41,7 @@ class RDKIT_SIMDIVPICKERS_EXPORT HierarchicalClusterPicker : public DistPicker { * Sets the hierarchy clustering method */ explicit HierarchicalClusterPicker(ClusterMethod clusterMethod) - : d_method(clusterMethod) { - ; - }; + : d_method(clusterMethod) {} /*! \brief This is the function that does the picking * diff --git a/Code/SimDivPickers/LeaderPicker.h b/Code/SimDivPickers/LeaderPicker.h index a9ae2cbd7..ceb8f8e02 100644 --- a/Code/SimDivPickers/LeaderPicker.h +++ b/Code/SimDivPickers/LeaderPicker.h @@ -36,7 +36,7 @@ class LeaderPicker : public DistPicker { /*! \brief Default Constructor * */ - LeaderPicker() {} + LeaderPicker() {} LeaderPicker(double threshold) : default_threshold(threshold), default_nthreads(1) {} LeaderPicker(double threshold, int nthreads) @@ -326,7 +326,8 @@ struct LeaderPickerState { int query; T *func; - LeaderPickerState(unsigned int count, int) : left(count), threshold(0.0), query(0), func(nullptr) { + LeaderPickerState(unsigned int count, int) + : left(count), threshold(0.0), query(0), func(nullptr) { v.resize(count); for (unsigned int i = 0; i < count; i++) v[i] = i; } diff --git a/Code/SimDivPickers/MaxMinPicker.h b/Code/SimDivPickers/MaxMinPicker.h index 4f835bb7d..bb1734073 100644 --- a/Code/SimDivPickers/MaxMinPicker.h +++ b/Code/SimDivPickers/MaxMinPicker.h @@ -37,7 +37,7 @@ class RDKIT_SIMDIVPICKERS_EXPORT MaxMinPicker : public DistPicker { /*! \brief Default Constructor * */ - MaxMinPicker(){}; + MaxMinPicker() {} /*! \brief Contains the implementation for a lazy MaxMin diversity picker * diff --git a/Code/SimDivPickers/Wrap/PickerHelpers.h b/Code/SimDivPickers/Wrap/PickerHelpers.h index 41f424950..64d26e56d 100644 --- a/Code/SimDivPickers/Wrap/PickerHelpers.h +++ b/Code/SimDivPickers/Wrap/PickerHelpers.h @@ -13,7 +13,6 @@ #include #include - // NOTE: TANIMOTO and DICE provably return the same results for the diversity // picking this is still here just in case we ever later want to support other // methods. @@ -57,4 +56,4 @@ class pyobjFunctor { python::object dp_obj; }; -#endif // RDKIT_PICKERHELPERS_H \ No newline at end of file +#endif // RDKIT_PICKERHELPERS_H