10#ifndef RDKIT_RDPROPS_H
11#define RDKIT_RDPROPS_H
49 bool includeComputed =
true)
const {
52 if (!includeComputed &&
57 auto pos = tmp.begin();
58 while (pos != tmp.end()) {
59 if ((includePrivate || (*pos)[0] !=
'_') &&
60 std::find(computed.begin(), computed.end(), *pos) == computed.end()) {
80 void setProp(
const std::string_view key, T val,
bool computed =
false)
const {
87 if (std::find(compLst.begin(), compLst.end(), key) == compLst.end()) {
88 compLst.emplace_back(key);
112 template <
typename T>
113 void getProp(
const std::string_view key, T &res)
const {
118 template <
typename T>
126 template <
typename T>
128 return d_props.getValIfPresent(key, res);
145 auto svi = std::find(compLst.begin(), compLst.end(), key);
146 if (svi != compLst.end()) {
159 for (
const auto &sv : compLst) {
The Dict class can be used to store objects of arbitrary type keyed by strings.
void clearProp(const std::string_view key) const
clears the value of a property
const Dict & getDict() const
gets the underlying Dictionary
RDProps & operator=(RDProps &&rhs) noexcept=default
T getProp(const std::string_view key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDProps & operator=(const RDProps &rhs)
void setProp(const std::string_view key, T val, bool computed=false) const
sets a property value
void getProp(const std::string_view key, T &res) const
allows retrieval of a particular property value
bool getPropIfPresent(const std::string_view key, T &res) const
void updateProps(const RDProps &source, bool preserveExisting=false)
update the properties from another
bool hasProp(const std::string_view key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDProps(const RDProps &rhs)
STR_VECT getPropList(bool includePrivate=true, bool includeComputed=true) const
returns a list with the names of our properties
void clearComputedProps() const
clears all of our computed properties
RDProps(RDProps &&o) noexcept=default
Class to allow us to throw a ValueError from C++ and have it make it back to Python.
constexpr std::string_view computedPropName
std::vector< std::string > STR_VECT