RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
SearchResults.h
Go to the documentation of this file.
1//
2// Copyright (C) David Cosgrove 2024.
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10
11#ifndef RDKIT_SYNTHONSPACE_SEARCHRESULTS_H
12#define RDKIT_SYNTHONSPACE_SEARCHRESULTS_H
13
14#include <RDGeneral/export.h>
15#include <GraphMol/ROMol.h>
16
19 public:
20 explicit SearchResults() : d_maxNumResults(0) {}
21 SearchResults(std::vector<std::unique_ptr<ROMol>> &&mols, size_t maxNumRes);
22 SearchResults(const SearchResults &other);
23 SearchResults(SearchResults &&other) = default;
24 ~SearchResults() = default;
25
28
29 /*!
30 * Returns the upper bound on the number of results the search might return.
31 * There may be fewer than this in practice for several reasons such as
32 * duplicate reagent sets being removed or the final product not matching the
33 * query even though the synthons suggested it would.
34 *
35 * @return int
36 */
37 size_t getMaxNumResults() const { return d_maxNumResults; }
38 /*!
39 * Returns the hits from the search. Not necessarily all those possible,
40 * just the maximum number requested.
41 *
42 * @return std::vector<std::unique_ptr<ROMol>>
43 */
44 const std::vector<std::unique_ptr<ROMol>> &getHitMolecules() const {
45 return d_hitMolecules;
46 }
47
48 private:
49 std::vector<std::unique_ptr<ROMol>> d_hitMolecules;
50 size_t d_maxNumResults;
51};
52
53inline SearchResults::SearchResults(std::vector<std::unique_ptr<ROMol>> &&mols,
54 const size_t maxNumRes)
55 : d_maxNumResults(maxNumRes) {
56 d_hitMolecules = std::move(mols);
57 mols.clear();
58}
59
61 : d_maxNumResults(other.d_maxNumResults) {
62 for (const auto &hm : other.d_hitMolecules) {
63 d_hitMolecules.emplace_back(new ROMol(*hm));
64 }
65}
66} // namespace RDKit::SynthonSpaceSearch
67
68#endif // RDKIT_SYNTHONSPACE_SEARCHRESULTS_H
Defines the primary molecule class ROMol as well as associated typedefs.
const std::vector< std::unique_ptr< ROMol > > & getHitMolecules() const
SearchResults & operator=(SearchResults &&other)=default
SearchResults & operator=(const SearchResults &other)
SearchResults(SearchResults &&other)=default
#define RDKIT_SYNTHONSPACESEARCH_EXPORT
Definition export.h:545
bool rdvalue_is(const RDValue_cast_t)