RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RegisterDescriptor.h
Go to the documentation of this file.
1
//
2
// Copyright (c) 2016, Novartis Institutes for BioMedical Research Inc.
3
// All rights reserved.
4
//
5
// Redistribution and use in source and binary forms, with or without
6
// modification, are permitted provided that the following conditions are
7
// met:
8
//
9
// * Redistributions of source code must retain the above copyright
10
// notice, this list of conditions and the following disclaimer.
11
// * Redistributions in binary form must reproduce the above
12
// copyright notice, this list of conditions and the following
13
// disclaimer in the documentation and/or other materials provided
14
// with the distribution.
15
// * Neither the name of Novartis Institutes for BioMedical Research Inc.
16
// nor the names of its contributors may be used to endorse or promote
17
// products derived from this software without specific prior written
18
// permission.
19
//
20
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
//
32
#ifndef RDKIT_REGISTER_DESCRIPTOR_H
33
#define RDKIT_REGISTER_DESCRIPTOR_H
34
35
#include "
Property.h
"
36
37
namespace
RDKit
{
38
class
ROMol;
39
namespace
Descriptors {
40
41
// these macros create a static class that can call the specified function.
42
// using double class::operator(const ROMol&)
43
// this class also contains a function pointer with the signature
44
// double(*)(const ROMol&)
45
// these classes are automatically registered with the property registry
46
/*
47
#define REGISTER_FULL_DESCRIPTOR( NAME, VERSION, FUNC ) \
48
double NAME##PropertyFunction(const ROMol&m){return
49
static_cast<double>(FUNC(mol));}\
50
struct NAME##PropertyFunctor : public PropertyFunctor{ \
51
NAME##PropertyFunctor(bool registerProp=true) : PropertyFunctor(#NAME,
52
VERSION) { \
53
if (registerProp) Properties::registerProperty(new
54
NAME##PropertyFunctor(false)); \
55
d_dataFunc = &NAME##PropertyFunction; \
56
} \
57
double operator()(const RDKit::ROMol &mol) const { \
58
return NAME##PropertyFunction(mol); } \
59
}; \
60
static NAME##PropertyFunctor NAME##PropertyFunctor__;
61
*/
62
63
#define REGISTER_DESCRIPTOR(NAME, FUNC) \
64
Properties::registerProperty(new PropertyFunctor( \
65
#NAME, NAME##Version, \
66
[](const ROMol &m) { return static_cast<double>(FUNC(m)); }));
67
68
}
// namespace Descriptors
69
}
// namespace RDKit
70
71
#endif
Property.h
RDKit
Std stuff.
Definition
Abbreviations.h:19
GraphMol
Descriptors
RegisterDescriptor.h
Generated on Sun Dec 22 2024 04:42:57 for RDKit by
1.9.8