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
17
namespace
RDKit::SynthonSpaceSearch
{
18
class
RDKIT_SYNTHONSPACESEARCH_EXPORT
SearchResults
{
19
public
:
20
explicit
SearchResults
() : d_maxNumResults(0) {}
21
SearchResults
(std::vector<std::unique_ptr<ROMol>> &&mols,
size_t
maxNumRes,
22
bool
timedOut,
bool
cancelled);
23
SearchResults
(
const
SearchResults
&other);
24
SearchResults
(
SearchResults
&&other) =
default
;
25
~SearchResults
() =
default
;
26
27
SearchResults
&
operator=
(
const
SearchResults
&other);
28
SearchResults
&
operator=
(
SearchResults
&&other) =
default
;
29
30
/*!
31
* Returns the upper bound on the number of results the search might return.
32
* There may be fewer than this in practice for several reasons such as
33
* duplicate reagent sets being removed or the final product not matching the
34
* query even though the synthons suggested it would.
35
*
36
* @return int
37
*/
38
size_t
getMaxNumResults
()
const
{
return
d_maxNumResults; }
39
/*!
40
* Returns the hits from the search. Not necessarily all those possible,
41
* just the maximum number requested.
42
*
43
* @return std::vector<std::unique_ptr<ROMol>>
44
*/
45
const
std::vector<std::unique_ptr<ROMol>> &
getHitMolecules
()
const
{
46
return
d_hitMolecules;
47
}
48
49
/*!
50
* Returns whether the search timed out or not,
51
* @return bool
52
*/
53
bool
getTimedOut
()
const
{
return
d_timedOut; }
54
/*!
55
* Returns whether the search was cancelled or not,
56
* @return bool
57
*/
58
bool
getCancelled
()
const
{
return
d_cancelled; }
59
60
private
:
61
std::vector<std::unique_ptr<ROMol>> d_hitMolecules;
62
size_t
d_maxNumResults;
63
bool
d_timedOut{
false
};
64
bool
d_cancelled{
false
};
65
};
66
67
inline
SearchResults::SearchResults
(std::vector<std::unique_ptr<ROMol>> &&mols,
68
const
size_t
maxNumRes,
bool
timedOut,
69
bool
cancelled)
70
: d_maxNumResults(maxNumRes), d_timedOut(timedOut), d_cancelled(cancelled) {
71
d_hitMolecules = std::move(mols);
72
mols.clear();
73
}
74
75
inline
SearchResults::SearchResults
(
const
SearchResults
&other)
76
: d_maxNumResults(other.d_maxNumResults),
77
d_timedOut(other.d_timedOut),
78
d_cancelled(other.d_cancelled) {
79
for
(
const
auto
&hm : other.d_hitMolecules) {
80
d_hitMolecules.emplace_back(new ROMol(*hm));
81
}
82
}
83
}
// namespace RDKit::SynthonSpaceSearch
84
85
#endif
// RDKIT_SYNTHONSPACE_SEARCHRESULTS_H
ROMol.h
Defines the primary molecule class ROMol as well as associated typedefs.
RDKit::SynthonSpaceSearch::SearchResults
Definition
SearchResults.h:18
RDKit::SynthonSpaceSearch::SearchResults::getHitMolecules
const std::vector< std::unique_ptr< ROMol > > & getHitMolecules() const
Definition
SearchResults.h:45
RDKit::SynthonSpaceSearch::SearchResults::~SearchResults
~SearchResults()=default
RDKit::SynthonSpaceSearch::SearchResults::operator=
SearchResults & operator=(SearchResults &&other)=default
RDKit::SynthonSpaceSearch::SearchResults::operator=
SearchResults & operator=(const SearchResults &other)
RDKit::SynthonSpaceSearch::SearchResults::getCancelled
bool getCancelled() const
Definition
SearchResults.h:58
RDKit::SynthonSpaceSearch::SearchResults::SearchResults
SearchResults()
Definition
SearchResults.h:20
RDKit::SynthonSpaceSearch::SearchResults::SearchResults
SearchResults(SearchResults &&other)=default
RDKit::SynthonSpaceSearch::SearchResults::getTimedOut
bool getTimedOut() const
Definition
SearchResults.h:53
RDKit::SynthonSpaceSearch::SearchResults::getMaxNumResults
size_t getMaxNumResults() const
Definition
SearchResults.h:38
export.h
RDKIT_SYNTHONSPACESEARCH_EXPORT
#define RDKIT_SYNTHONSPACESEARCH_EXPORT
Definition
export.h:545
RDKit::SynthonSpaceSearch
Definition
SearchResults.h:17
GraphMol
SynthonSpaceSearch
SearchResults.h
Generated on Sun Mar 9 2025 10:04:30 for RDKit by
1.12.0