Loading...
Searching...
No Matches
SanitException.h
Go to the documentation of this file.
//
// Copyright (C) 2002-2019 Greg Landrum and Rational Discovery LLC
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#include <RDGeneral/export.h>
#ifndef RD_SANITEXCEPTION_H
#define RD_SANITEXCEPTION_H
#include <RDGeneral/types.h>
#include <GraphMol/GraphMol.h>
#include <GraphMol/Atom.h>
#include <GraphMol/Bond.h>
#include <string>
#include <utility>
#include <vector>
#include <exception>
namespace RDKit {
//! class for flagging sanitization errors
class RDKIT_GRAPHMOL_EXPORT MolSanitizeException : public std::exception {
public:
MolSanitizeException(const char *msg) : d_msg(msg) {}
MolSanitizeException(std::string msg) : d_msg(std::move(msg)) {}
MolSanitizeException(const MolSanitizeException &other)
: d_msg(other.d_msg) {}
const char *what() const noexcept override { return d_msg.c_str(); }
~MolSanitizeException() noexcept override {}
virtual MolSanitizeException *copy() const {
return new MolSanitizeException(*this);
}
virtual std::string getType() const { return "MolSanitizeException"; }
protected:
std::string d_msg;
};
class RDKIT_GRAPHMOL_EXPORT AtomSanitizeException
: public MolSanitizeException {
public:
AtomSanitizeException(const char *msg, unsigned int atomIdx)
: MolSanitizeException(msg), d_atomIdx(atomIdx) {}
AtomSanitizeException(const std::string &msg, unsigned int atomIdx)
: MolSanitizeException(msg), d_atomIdx(atomIdx) {}
AtomSanitizeException(const AtomSanitizeException &other)
: MolSanitizeException(other), d_atomIdx(other.d_atomIdx) {}
unsigned int getAtomIdx() const { return d_atomIdx; }
~AtomSanitizeException() noexcept override {}
MolSanitizeException *copy() const override {
return new AtomSanitizeException(*this);
}
std::string getType() const override { return "AtomSanitizeException"; }
protected:
unsigned int d_atomIdx;
};
class RDKIT_GRAPHMOL_EXPORT AtomValenceException
: public AtomSanitizeException {
public:
AtomValenceException(const char *msg, unsigned int atomIdx)
: AtomSanitizeException(msg, atomIdx) {}
AtomValenceException(const std::string &msg, unsigned int atomIdx)
: AtomSanitizeException(msg, atomIdx) {}
AtomValenceException(const AtomValenceException &other)
: AtomSanitizeException(other) {}
~AtomValenceException() noexcept override {}
MolSanitizeException *copy() const override {
return new AtomValenceException(*this);
}
std::string getType() const override { return "AtomValenceException"; }
};
class RDKIT_GRAPHMOL_EXPORT AtomKekulizeException
: public AtomSanitizeException {
public:
AtomKekulizeException(const char *msg, unsigned int atomIdx)
: AtomSanitizeException(msg, atomIdx) {}
AtomKekulizeException(const std::string &msg, unsigned int atomIdx)
: AtomSanitizeException(msg, atomIdx) {}
AtomKekulizeException(const AtomKekulizeException &other)
: AtomSanitizeException(other) {}
~AtomKekulizeException() noexcept override {}
MolSanitizeException *copy() const override {
return new AtomKekulizeException(*this);
}
std::string getType() const override { return "AtomKekulizeException"; }
};
class RDKIT_GRAPHMOL_EXPORT KekulizeException : public MolSanitizeException {
public:
KekulizeException(const char *msg, std::vector<unsigned int> indices)
: MolSanitizeException(msg), d_atomIndices(std::move(indices)) {}
KekulizeException(const std::string &msg, std::vector<unsigned int> indices)
: MolSanitizeException(msg), d_atomIndices(std::move(indices)) {}
KekulizeException(const KekulizeException &other)
: MolSanitizeException(other), d_atomIndices(other.d_atomIndices) {}
const std::vector<unsigned int> &getAtomIndices() const {
return d_atomIndices;
}
~KekulizeException() noexcept override {}
MolSanitizeException *copy() const override {
return new KekulizeException(*this);
}
std::string getType() const override { return "KekulizeException"; }
protected:
std::vector<unsigned int> d_atomIndices;
};
} // namespace RDKit
#endif
Atom.h
Defines the Atom class and associated typedefs.
Bond.h
GraphMol.h
pulls in RWMol and ROMol
RDKit::AtomKekulizeException
Definition SanitException.h:82
RDKit::AtomKekulizeException::AtomKekulizeException
AtomKekulizeException(const std::string &msg, unsigned int atomIdx)
Definition SanitException.h:86
RDKit::AtomKekulizeException::~AtomKekulizeException
~AtomKekulizeException() noexcept override
Definition SanitException.h:90
RDKit::AtomKekulizeException::copy
MolSanitizeException * copy() const override
Definition SanitException.h:91
RDKit::AtomKekulizeException::AtomKekulizeException
AtomKekulizeException(const char *msg, unsigned int atomIdx)
Definition SanitException.h:84
RDKit::AtomKekulizeException::getType
std::string getType() const override
Definition SanitException.h:94
RDKit::AtomKekulizeException::AtomKekulizeException
AtomKekulizeException(const AtomKekulizeException &other)
Definition SanitException.h:88
RDKit::AtomSanitizeException
Definition SanitException.h:46
RDKit::AtomSanitizeException::getAtomIdx
unsigned int getAtomIdx() const
Definition SanitException.h:54
RDKit::AtomSanitizeException::copy
MolSanitizeException * copy() const override
Definition SanitException.h:56
RDKit::AtomSanitizeException::AtomSanitizeException
AtomSanitizeException(const AtomSanitizeException &other)
Definition SanitException.h:52
RDKit::AtomSanitizeException::~AtomSanitizeException
~AtomSanitizeException() noexcept override
Definition SanitException.h:55
RDKit::AtomSanitizeException::d_atomIdx
unsigned int d_atomIdx
Definition SanitException.h:62
RDKit::AtomSanitizeException::AtomSanitizeException
AtomSanitizeException(const std::string &msg, unsigned int atomIdx)
Definition SanitException.h:50
RDKit::AtomSanitizeException::AtomSanitizeException
AtomSanitizeException(const char *msg, unsigned int atomIdx)
Definition SanitException.h:48
RDKit::AtomSanitizeException::getType
std::string getType() const override
Definition SanitException.h:59
RDKit::AtomValenceException
Definition SanitException.h:66
RDKit::AtomValenceException::AtomValenceException
AtomValenceException(const char *msg, unsigned int atomIdx)
Definition SanitException.h:68
RDKit::AtomValenceException::copy
MolSanitizeException * copy() const override
Definition SanitException.h:75
RDKit::AtomValenceException::AtomValenceException
AtomValenceException(const std::string &msg, unsigned int atomIdx)
Definition SanitException.h:70
RDKit::AtomValenceException::~AtomValenceException
~AtomValenceException() noexcept override
Definition SanitException.h:74
RDKit::AtomValenceException::getType
std::string getType() const override
Definition SanitException.h:78
RDKit::AtomValenceException::AtomValenceException
AtomValenceException(const AtomValenceException &other)
Definition SanitException.h:72
RDKit::KekulizeException
Definition SanitException.h:97
RDKit::KekulizeException::KekulizeException
KekulizeException(const KekulizeException &other)
Definition SanitException.h:103
RDKit::KekulizeException::getAtomIndices
const std::vector< unsigned int > & getAtomIndices() const
Definition SanitException.h:105
RDKit::KekulizeException::getType
std::string getType() const override
Definition SanitException.h:112
RDKit::KekulizeException::d_atomIndices
std::vector< unsigned int > d_atomIndices
Definition SanitException.h:115
RDKit::KekulizeException::~KekulizeException
~KekulizeException() noexcept override
Definition SanitException.h:108
RDKit::KekulizeException::KekulizeException
KekulizeException(const char *msg, std::vector< unsigned int > indices)
Definition SanitException.h:99
RDKit::KekulizeException::KekulizeException
KekulizeException(const std::string &msg, std::vector< unsigned int > indices)
Definition SanitException.h:101
RDKit::KekulizeException::copy
MolSanitizeException * copy() const override
Definition SanitException.h:109
RDKit::MolSanitizeException
class for flagging sanitization errors
Definition SanitException.h:28
RDKit::MolSanitizeException::what
const char * what() const noexcept override
Definition SanitException.h:34
RDKit::MolSanitizeException::copy
virtual MolSanitizeException * copy() const
Definition SanitException.h:36
RDKit::MolSanitizeException::MolSanitizeException
MolSanitizeException(std::string msg)
Definition SanitException.h:31
RDKit::MolSanitizeException::MolSanitizeException
MolSanitizeException(const MolSanitizeException &other)
Definition SanitException.h:32
RDKit::MolSanitizeException::~MolSanitizeException
~MolSanitizeException() noexcept override
Definition SanitException.h:35
RDKit::MolSanitizeException::getType
virtual std::string getType() const
Definition SanitException.h:39
RDKit::MolSanitizeException::d_msg
std::string d_msg
Definition SanitException.h:42
RDKit::MolSanitizeException::MolSanitizeException
MolSanitizeException(const char *msg)
Definition SanitException.h:30
export.h
RDKIT_GRAPHMOL_EXPORT
#define RDKIT_GRAPHMOL_EXPORT
Definition export.h:233
RDKit
Std stuff.
Definition Abbreviations.h:19
types.h