rdkit-headers 2022.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. rdkit_headers/__init__.py +13 -0
  2. rdkit_headers/include/rdkit/CIPLabeler/CIPLabeler.h +59 -0
  3. rdkit_headers/include/rdkit/CIPLabeler/TooManyNodesException.h +28 -0
  4. rdkit_headers/include/rdkit/Catalogs/Catalog.h +461 -0
  5. rdkit_headers/include/rdkit/Catalogs/CatalogEntry.h +48 -0
  6. rdkit_headers/include/rdkit/Catalogs/CatalogParams.h +42 -0
  7. rdkit_headers/include/rdkit/ChemicalFeatures/ChemicalFeature.h +38 -0
  8. rdkit_headers/include/rdkit/ChemicalFeatures/FreeChemicalFeature.h +97 -0
  9. rdkit_headers/include/rdkit/DataManip/MetricMatrixCalc/MetricFuncs.h +54 -0
  10. rdkit_headers/include/rdkit/DataManip/MetricMatrixCalc/MetricMatrixCalc.h +106 -0
  11. rdkit_headers/include/rdkit/DataStructs/BitOps.h +337 -0
  12. rdkit_headers/include/rdkit/DataStructs/BitVect.h +68 -0
  13. rdkit_headers/include/rdkit/DataStructs/BitVectUtils.h +35 -0
  14. rdkit_headers/include/rdkit/DataStructs/BitVects.h +25 -0
  15. rdkit_headers/include/rdkit/DataStructs/DatastructsException.h +31 -0
  16. rdkit_headers/include/rdkit/DataStructs/DatastructsStreamOps.h +72 -0
  17. rdkit_headers/include/rdkit/DataStructs/DiscreteDistMat.h +30 -0
  18. rdkit_headers/include/rdkit/DataStructs/DiscreteValueVect.h +146 -0
  19. rdkit_headers/include/rdkit/DataStructs/ExplicitBitVect.h +96 -0
  20. rdkit_headers/include/rdkit/DataStructs/FPBReader.h +281 -0
  21. rdkit_headers/include/rdkit/DataStructs/MultiFPBReader.h +213 -0
  22. rdkit_headers/include/rdkit/DataStructs/SparseBitVect.h +101 -0
  23. rdkit_headers/include/rdkit/DataStructs/SparseIntVect.h +571 -0
  24. rdkit_headers/include/rdkit/DataStructs/base64.h +41 -0
  25. rdkit_headers/include/rdkit/DistGeom/BoundsMatrix.h +121 -0
  26. rdkit_headers/include/rdkit/DistGeom/ChiralSet.h +58 -0
  27. rdkit_headers/include/rdkit/DistGeom/ChiralViolationContrib.h +96 -0
  28. rdkit_headers/include/rdkit/DistGeom/DistGeomUtils.h +195 -0
  29. rdkit_headers/include/rdkit/DistGeom/DistViolationContrib.h +54 -0
  30. rdkit_headers/include/rdkit/DistGeom/FourthDimContrib.h +65 -0
  31. rdkit_headers/include/rdkit/DistGeom/TriangleSmooth.h +36 -0
  32. rdkit_headers/include/rdkit/Features/Feature.h +96 -0
  33. rdkit_headers/include/rdkit/ForceField/Contrib.h +40 -0
  34. rdkit_headers/include/rdkit/ForceField/ForceField.h +253 -0
  35. rdkit_headers/include/rdkit/ForceField/MMFF/AngleBend.h +78 -0
  36. rdkit_headers/include/rdkit/ForceField/MMFF/AngleConstraint.h +64 -0
  37. rdkit_headers/include/rdkit/ForceField/MMFF/BondStretch.h +67 -0
  38. rdkit_headers/include/rdkit/ForceField/MMFF/Contribs.h +26 -0
  39. rdkit_headers/include/rdkit/ForceField/MMFF/DistanceConstraint.h +61 -0
  40. rdkit_headers/include/rdkit/ForceField/MMFF/Nonbonded.h +105 -0
  41. rdkit_headers/include/rdkit/ForceField/MMFF/OopBend.h +65 -0
  42. rdkit_headers/include/rdkit/ForceField/MMFF/Params.h +1134 -0
  43. rdkit_headers/include/rdkit/ForceField/MMFF/PositionConstraint.h +55 -0
  44. rdkit_headers/include/rdkit/ForceField/MMFF/StretchBend.h +70 -0
  45. rdkit_headers/include/rdkit/ForceField/MMFF/TorsionAngle.h +79 -0
  46. rdkit_headers/include/rdkit/ForceField/MMFF/TorsionConstraint.h +70 -0
  47. rdkit_headers/include/rdkit/ForceField/UFF/AngleBend.h +92 -0
  48. rdkit_headers/include/rdkit/ForceField/UFF/AngleConstraint.h +64 -0
  49. rdkit_headers/include/rdkit/ForceField/UFF/BondStretch.h +83 -0
  50. rdkit_headers/include/rdkit/ForceField/UFF/Contribs.h +23 -0
  51. rdkit_headers/include/rdkit/ForceField/UFF/DistanceConstraint.h +62 -0
  52. rdkit_headers/include/rdkit/ForceField/UFF/Inversion.h +81 -0
  53. rdkit_headers/include/rdkit/ForceField/UFF/Nonbonded.h +87 -0
  54. rdkit_headers/include/rdkit/ForceField/UFF/Params.h +153 -0
  55. rdkit_headers/include/rdkit/ForceField/UFF/PositionConstraint.h +55 -0
  56. rdkit_headers/include/rdkit/ForceField/UFF/TorsionAngle.h +115 -0
  57. rdkit_headers/include/rdkit/ForceField/UFF/TorsionConstraint.h +70 -0
  58. rdkit_headers/include/rdkit/Geometry/Grid3D.h +55 -0
  59. rdkit_headers/include/rdkit/Geometry/GridUtils.h +64 -0
  60. rdkit_headers/include/rdkit/Geometry/Transform.h +19 -0
  61. rdkit_headers/include/rdkit/Geometry/Transform2D.h +85 -0
  62. rdkit_headers/include/rdkit/Geometry/Transform3D.h +101 -0
  63. rdkit_headers/include/rdkit/Geometry/UniformGrid3D.h +217 -0
  64. rdkit_headers/include/rdkit/Geometry/Utils.h +97 -0
  65. rdkit_headers/include/rdkit/Geometry/point.h +585 -0
  66. rdkit_headers/include/rdkit/GraphMol/Abbreviations/Abbreviations.h +132 -0
  67. rdkit_headers/include/rdkit/GraphMol/Atom.h +449 -0
  68. rdkit_headers/include/rdkit/GraphMol/AtomIterators.h +212 -0
  69. rdkit_headers/include/rdkit/GraphMol/Bond.h +393 -0
  70. rdkit_headers/include/rdkit/GraphMol/BondIterators.h +75 -0
  71. rdkit_headers/include/rdkit/GraphMol/Canon.h +130 -0
  72. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/CartesianProduct.h +147 -0
  73. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/Enumerate.h +187 -0
  74. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerateBase.h +200 -0
  75. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerateTypes.h +59 -0
  76. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerationPickler.h +60 -0
  77. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h +227 -0
  78. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/RandomSample.h +163 -0
  79. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h +184 -0
  80. rdkit_headers/include/rdkit/GraphMol/ChemReactions/PreprocessRxn.h +64 -0
  81. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Reaction.h +491 -0
  82. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionFingerprints.h +147 -0
  83. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionParser.h +274 -0
  84. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionPickler.h +119 -0
  85. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionRunner.h +116 -0
  86. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionUtils.h +74 -0
  87. rdkit_headers/include/rdkit/GraphMol/ChemReactions/SanitizeRxn.h +169 -0
  88. rdkit_headers/include/rdkit/GraphMol/ChemTransforms/ChemTransforms.h +270 -0
  89. rdkit_headers/include/rdkit/GraphMol/ChemTransforms/MolFragmenter.h +120 -0
  90. rdkit_headers/include/rdkit/GraphMol/Chirality.h +137 -0
  91. rdkit_headers/include/rdkit/GraphMol/Conformer.h +183 -0
  92. rdkit_headers/include/rdkit/GraphMol/CoordGen.h +195 -0
  93. rdkit_headers/include/rdkit/GraphMol/Depictor/DepictUtils.h +366 -0
  94. rdkit_headers/include/rdkit/GraphMol/Depictor/EmbeddedFrag.h +544 -0
  95. rdkit_headers/include/rdkit/GraphMol/Depictor/RDDepictor.h +284 -0
  96. rdkit_headers/include/rdkit/GraphMol/Deprotect/Deprotect.h +105 -0
  97. rdkit_headers/include/rdkit/GraphMol/Descriptors/AUTOCORR2D.h +49 -0
  98. rdkit_headers/include/rdkit/GraphMol/Descriptors/AUTOCORR3D.h +51 -0
  99. rdkit_headers/include/rdkit/GraphMol/Descriptors/AtomFeat.h +39 -0
  100. rdkit_headers/include/rdkit/GraphMol/Descriptors/BCUT.h +66 -0
  101. rdkit_headers/include/rdkit/GraphMol/Descriptors/ConnectivityDescriptors.h +211 -0
  102. rdkit_headers/include/rdkit/GraphMol/Descriptors/CoulombMat.h +42 -0
  103. rdkit_headers/include/rdkit/GraphMol/Descriptors/Crippen.h +137 -0
  104. rdkit_headers/include/rdkit/GraphMol/Descriptors/Data3Ddescriptors.h +55 -0
  105. rdkit_headers/include/rdkit/GraphMol/Descriptors/EEM.h +59 -0
  106. rdkit_headers/include/rdkit/GraphMol/Descriptors/GETAWAY.h +51 -0
  107. rdkit_headers/include/rdkit/GraphMol/Descriptors/Lipinski.h +169 -0
  108. rdkit_headers/include/rdkit/GraphMol/Descriptors/MORSE.h +50 -0
  109. rdkit_headers/include/rdkit/GraphMol/Descriptors/MQN.h +47 -0
  110. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolData3Ddescriptors.h +62 -0
  111. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolDescriptors.h +86 -0
  112. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolDescriptors3D.h +25 -0
  113. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolSurf.h +120 -0
  114. rdkit_headers/include/rdkit/GraphMol/Descriptors/PBF.h +60 -0
  115. rdkit_headers/include/rdkit/GraphMol/Descriptors/PMI.h +128 -0
  116. rdkit_headers/include/rdkit/GraphMol/Descriptors/Property.h +123 -0
  117. rdkit_headers/include/rdkit/GraphMol/Descriptors/RDF.h +52 -0
  118. rdkit_headers/include/rdkit/GraphMol/Descriptors/RegisterDescriptor.h +84 -0
  119. rdkit_headers/include/rdkit/GraphMol/Descriptors/USRDescriptor.h +137 -0
  120. rdkit_headers/include/rdkit/GraphMol/Descriptors/WHIM.h +51 -0
  121. rdkit_headers/include/rdkit/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.h +77 -0
  122. rdkit_headers/include/rdkit/GraphMol/DistGeomHelpers/Embedder.h +437 -0
  123. rdkit_headers/include/rdkit/GraphMol/FMCS/FMCS.h +194 -0
  124. rdkit_headers/include/rdkit/GraphMol/FMCS/Graph.h +43 -0
  125. rdkit_headers/include/rdkit/GraphMol/FileParsers/FileParserUtils.h +231 -0
  126. rdkit_headers/include/rdkit/GraphMol/FileParsers/FileParsers.h +399 -0
  127. rdkit_headers/include/rdkit/GraphMol/FileParsers/GeneralFileReader.h +170 -0
  128. rdkit_headers/include/rdkit/GraphMol/FileParsers/MolFileStereochem.h +60 -0
  129. rdkit_headers/include/rdkit/GraphMol/FileParsers/MolSupplier.h +444 -0
  130. rdkit_headers/include/rdkit/GraphMol/FileParsers/MolWriters.h +338 -0
  131. rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedMolSupplier.h +102 -0
  132. rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedSDMolSupplier.h +65 -0
  133. rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedSmilesMolSupplier.h +66 -0
  134. rdkit_headers/include/rdkit/GraphMol/FileParsers/PNGParser.h +203 -0
  135. rdkit_headers/include/rdkit/GraphMol/FileParsers/SequenceParsers.h +117 -0
  136. rdkit_headers/include/rdkit/GraphMol/FileParsers/SequenceWriters.h +47 -0
  137. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterCatalog.h +260 -0
  138. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterCatalogEntry.h +276 -0
  139. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterMatcherBase.h +152 -0
  140. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterMatchers.h +576 -0
  141. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FunctionalGroupHierarchy.h +52 -0
  142. rdkit_headers/include/rdkit/GraphMol/Fingerprints/AtomPairGenerator.h +188 -0
  143. rdkit_headers/include/rdkit/GraphMol/Fingerprints/AtomPairs.h +268 -0
  144. rdkit_headers/include/rdkit/GraphMol/Fingerprints/FingerprintGenerator.h +372 -0
  145. rdkit_headers/include/rdkit/GraphMol/Fingerprints/FingerprintUtil.h +160 -0
  146. rdkit_headers/include/rdkit/GraphMol/Fingerprints/Fingerprints.h +167 -0
  147. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MACCS.h +32 -0
  148. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MHFP.h +285 -0
  149. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MorganFingerprints.h +210 -0
  150. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MorganGenerator.h +251 -0
  151. rdkit_headers/include/rdkit/GraphMol/Fingerprints/RDKitFPGenerator.h +162 -0
  152. rdkit_headers/include/rdkit/GraphMol/Fingerprints/TopologicalTorsionGenerator.h +127 -0
  153. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h +72 -0
  154. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/CrystalFF/TorsionPreferences.h +41 -0
  155. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/FFConvenience.h +130 -0
  156. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h +236 -0
  157. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/Builder.h +141 -0
  158. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/MMFF.h +105 -0
  159. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/AtomTyper.h +57 -0
  160. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/Builder.h +129 -0
  161. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/UFF.h +82 -0
  162. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatGenerator.h +33 -0
  163. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatParams.h +94 -0
  164. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatalogEntry.h +136 -0
  165. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatalogUtils.h +62 -0
  166. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragFPGenerator.h +38 -0
  167. rdkit_headers/include/rdkit/GraphMol/GenericGroups/GenericGroups.h +301 -0
  168. rdkit_headers/include/rdkit/GraphMol/GraphMol.h +22 -0
  169. rdkit_headers/include/rdkit/GraphMol/MMPA/MMPA.h +81 -0
  170. rdkit_headers/include/rdkit/GraphMol/MolAlign/AlignMolecules.h +183 -0
  171. rdkit_headers/include/rdkit/GraphMol/MolAlign/O3AAlignMolecules.h +354 -0
  172. rdkit_headers/include/rdkit/GraphMol/MolBundle.h +121 -0
  173. rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalog.h +20 -0
  174. rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalogEntry.h +109 -0
  175. rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalogParams.h +40 -0
  176. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/FeatureParser.h +58 -0
  177. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeature.h +98 -0
  178. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h +68 -0
  179. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeatureFactory.h +78 -0
  180. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2D.h +539 -0
  181. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DHelpers.h +284 -0
  182. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DJS.h +62 -0
  183. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DSVG.h +88 -0
  184. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DUtils.h +179 -0
  185. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2Dwx.h +107 -0
  186. rdkit_headers/include/rdkit/GraphMol/MolEnumerator/LinkNode.h +159 -0
  187. rdkit_headers/include/rdkit/GraphMol/MolEnumerator/MolEnumerator.h +276 -0
  188. rdkit_headers/include/rdkit/GraphMol/MolHash/MolHash.h +12 -0
  189. rdkit_headers/include/rdkit/GraphMol/MolHash/nmmolhash.h +60 -0
  190. rdkit_headers/include/rdkit/GraphMol/MolInterchange/MolInterchange.h +93 -0
  191. rdkit_headers/include/rdkit/GraphMol/MolInterchange/details.h +49 -0
  192. rdkit_headers/include/rdkit/GraphMol/MolOps.h +1016 -0
  193. rdkit_headers/include/rdkit/GraphMol/MolPickler.h +314 -0
  194. rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogEntry.h +56 -0
  195. rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogParams.h +65 -0
  196. rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogUtils.h +37 -0
  197. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Charge.h +145 -0
  198. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Fragment.h +105 -0
  199. rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogEntry.h +60 -0
  200. rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogParams.h +63 -0
  201. rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogUtils.h +35 -0
  202. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Metal.h +73 -0
  203. rdkit_headers/include/rdkit/GraphMol/MolStandardize/MolStandardize.h +178 -0
  204. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Normalize.h +104 -0
  205. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Tautomer.h +428 -0
  206. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogEntry.h +59 -0
  207. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogParams.h +69 -0
  208. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h +81 -0
  209. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogEntry.h +57 -0
  210. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogParams.h +66 -0
  211. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogUtils.h +37 -0
  212. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Validate.h +199 -0
  213. rdkit_headers/include/rdkit/GraphMol/MolTransforms/MolTransforms.h +222 -0
  214. rdkit_headers/include/rdkit/GraphMol/MonomerInfo.h +138 -0
  215. rdkit_headers/include/rdkit/GraphMol/PartialCharges/GasteigerCharges.h +27 -0
  216. rdkit_headers/include/rdkit/GraphMol/PartialCharges/GasteigerParams.h +86 -0
  217. rdkit_headers/include/rdkit/GraphMol/PeriodicTable.h +325 -0
  218. rdkit_headers/include/rdkit/GraphMol/QueryAtom.h +161 -0
  219. rdkit_headers/include/rdkit/GraphMol/QueryBond.h +146 -0
  220. rdkit_headers/include/rdkit/GraphMol/QueryOps.h +1110 -0
  221. rdkit_headers/include/rdkit/GraphMol/RDKitBase.h +35 -0
  222. rdkit_headers/include/rdkit/GraphMol/RDKitQueries.h +25 -0
  223. rdkit_headers/include/rdkit/GraphMol/RGroupDecomposition/RGroupDecomp.h +225 -0
  224. rdkit_headers/include/rdkit/GraphMol/ROMol.h +844 -0
  225. rdkit_headers/include/rdkit/GraphMol/RWMol.h +222 -0
  226. rdkit_headers/include/rdkit/GraphMol/ReducedGraphs/ReducedGraphs.h +85 -0
  227. rdkit_headers/include/rdkit/GraphMol/Resonance.h +236 -0
  228. rdkit_headers/include/rdkit/GraphMol/RingInfo.h +274 -0
  229. rdkit_headers/include/rdkit/GraphMol/Rings.h +90 -0
  230. rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNAttribs.h +93 -0
  231. rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNParse.h +70 -0
  232. rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNParseOps.h +328 -0
  233. rdkit_headers/include/rdkit/GraphMol/SanitException.h +120 -0
  234. rdkit_headers/include/rdkit/GraphMol/ScaffoldNetwork/ScaffoldNetwork.h +195 -0
  235. rdkit_headers/include/rdkit/GraphMol/ShapeHelpers/ShapeEncoder.h +73 -0
  236. rdkit_headers/include/rdkit/GraphMol/ShapeHelpers/ShapeUtils.h +279 -0
  237. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmartsWrite.h +46 -0
  238. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesParse.h +160 -0
  239. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesParseOps.h +53 -0
  240. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesWrite.h +288 -0
  241. rdkit_headers/include/rdkit/GraphMol/SmilesParse/primes.h +18 -0
  242. rdkit_headers/include/rdkit/GraphMol/StereoGroup.h +74 -0
  243. rdkit_headers/include/rdkit/GraphMol/Subgraphs/SubgraphUtils.h +57 -0
  244. rdkit_headers/include/rdkit/GraphMol/Subgraphs/Subgraphs.h +154 -0
  245. rdkit_headers/include/rdkit/GraphMol/SubstanceGroup.h +297 -0
  246. rdkit_headers/include/rdkit/GraphMol/Substruct/SubstructMatch.h +232 -0
  247. rdkit_headers/include/rdkit/GraphMol/Substruct/SubstructUtils.h +44 -0
  248. rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/PatternFactory.h +40 -0
  249. rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/SubstructLibrary.h +951 -0
  250. rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/SubstructLibrarySerialization.h +231 -0
  251. rdkit_headers/include/rdkit/GraphMol/TautomerQuery/TautomerQuery.h +104 -0
  252. rdkit_headers/include/rdkit/GraphMol/Trajectory/Snapshot.h +69 -0
  253. rdkit_headers/include/rdkit/GraphMol/Trajectory/Trajectory.h +105 -0
  254. rdkit_headers/include/rdkit/GraphMol/atomic_data.h +76 -0
  255. rdkit_headers/include/rdkit/GraphMol/details.h +15 -0
  256. rdkit_headers/include/rdkit/GraphMol/new_canon.h +772 -0
  257. rdkit_headers/include/rdkit/Numerics/Alignment/AlignPoints.h +49 -0
  258. rdkit_headers/include/rdkit/Numerics/Conrec.h +203 -0
  259. rdkit_headers/include/rdkit/Numerics/EigenSolvers/PowerEigenSolver.h +68 -0
  260. rdkit_headers/include/rdkit/Numerics/Matrix.h +347 -0
  261. rdkit_headers/include/rdkit/Numerics/Optimizer/BFGSOpt.h +397 -0
  262. rdkit_headers/include/rdkit/Numerics/SquareMatrix.h +89 -0
  263. rdkit_headers/include/rdkit/Numerics/SymmMatrix.h +361 -0
  264. rdkit_headers/include/rdkit/Numerics/Vector.h +327 -0
  265. rdkit_headers/include/rdkit/Query/AndQuery.h +57 -0
  266. rdkit_headers/include/rdkit/Query/EqualityQuery.h +88 -0
  267. rdkit_headers/include/rdkit/Query/GreaterEqualQuery.h +74 -0
  268. rdkit_headers/include/rdkit/Query/GreaterQuery.h +74 -0
  269. rdkit_headers/include/rdkit/Query/LessEqualQuery.h +75 -0
  270. rdkit_headers/include/rdkit/Query/LessQuery.h +74 -0
  271. rdkit_headers/include/rdkit/Query/NullQueryAlgebra.h +86 -0
  272. rdkit_headers/include/rdkit/Query/OrQuery.h +58 -0
  273. rdkit_headers/include/rdkit/Query/Query.h +210 -0
  274. rdkit_headers/include/rdkit/Query/QueryObjects.h +38 -0
  275. rdkit_headers/include/rdkit/Query/RangeQuery.h +116 -0
  276. rdkit_headers/include/rdkit/Query/SetQuery.h +87 -0
  277. rdkit_headers/include/rdkit/Query/XOrQuery.h +63 -0
  278. rdkit_headers/include/rdkit/RDGeneral/BadFileException.h +39 -0
  279. rdkit_headers/include/rdkit/RDGeneral/BoostEndInclude.h +69 -0
  280. rdkit_headers/include/rdkit/RDGeneral/BoostStartInclude.h +95 -0
  281. rdkit_headers/include/rdkit/RDGeneral/ConcurrentQueue.h +132 -0
  282. rdkit_headers/include/rdkit/RDGeneral/Dict.h +350 -0
  283. rdkit_headers/include/rdkit/RDGeneral/Exceptions.h +73 -0
  284. rdkit_headers/include/rdkit/RDGeneral/FileParseException.h +36 -0
  285. rdkit_headers/include/rdkit/RDGeneral/Invariant.h +198 -0
  286. rdkit_headers/include/rdkit/RDGeneral/LocaleSwitcher.h +54 -0
  287. rdkit_headers/include/rdkit/RDGeneral/RDAny.h +217 -0
  288. rdkit_headers/include/rdkit/RDGeneral/RDConfig.h +49 -0
  289. rdkit_headers/include/rdkit/RDGeneral/RDExportMacros.h +40 -0
  290. rdkit_headers/include/rdkit/RDGeneral/RDLog.h +142 -0
  291. rdkit_headers/include/rdkit/RDGeneral/RDProps.h +172 -0
  292. rdkit_headers/include/rdkit/RDGeneral/RDThreads.h +44 -0
  293. rdkit_headers/include/rdkit/RDGeneral/RDValue-doublemagic.h +478 -0
  294. rdkit_headers/include/rdkit/RDGeneral/RDValue-taggedunion.h +518 -0
  295. rdkit_headers/include/rdkit/RDGeneral/RDValue.h +285 -0
  296. rdkit_headers/include/rdkit/RDGeneral/Ranking.h +87 -0
  297. rdkit_headers/include/rdkit/RDGeneral/StreamOps.h +637 -0
  298. rdkit_headers/include/rdkit/RDGeneral/export.h +559 -0
  299. rdkit_headers/include/rdkit/RDGeneral/hanoiSort.h +167 -0
  300. rdkit_headers/include/rdkit/RDGeneral/hash/detail/float_functions.hpp +156 -0
  301. rdkit_headers/include/rdkit/RDGeneral/hash/detail/hash_float.hpp +179 -0
  302. rdkit_headers/include/rdkit/RDGeneral/hash/extensions.hpp +152 -0
  303. rdkit_headers/include/rdkit/RDGeneral/hash/hash.hpp +463 -0
  304. rdkit_headers/include/rdkit/RDGeneral/hash/hash_fwd.hpp +51 -0
  305. rdkit_headers/include/rdkit/RDGeneral/test.h +274 -0
  306. rdkit_headers/include/rdkit/RDGeneral/types.h +401 -0
  307. rdkit_headers/include/rdkit/RDGeneral/utils.h +106 -0
  308. rdkit_headers/include/rdkit/RDGeneral/versions.h +27 -0
  309. rdkit_headers/include/rdkit/RDStreams/streams.h +19 -0
  310. rdkit_headers/include/rdkit/RingDecomposerLib.h +751 -0
  311. rdkit_headers/include/rdkit/SimDivPickers/DistPicker.h +92 -0
  312. rdkit_headers/include/rdkit/SimDivPickers/HierarchicalClusterPicker.h +107 -0
  313. rdkit_headers/include/rdkit/SimDivPickers/LeaderPicker.h +470 -0
  314. rdkit_headers/include/rdkit/SimDivPickers/MaxMinPicker.h +303 -0
  315. rdkit_headers-2022.3.3.dist-info/METADATA +24 -0
  316. rdkit_headers-2022.3.3.dist-info/RECORD +320 -0
  317. rdkit_headers-2022.3.3.dist-info/WHEEL +4 -0
  318. rdkit_headers-2022.3.3.dist-info/entry_points.txt +4 -0
  319. rdkit_headers-2022.3.3.dist-info/licenses/LICENSE +29 -0
  320. rdkit_headers-2022.3.3.dist-info/licenses/NOTICE +5 -0
@@ -0,0 +1,172 @@
1
+ // This file is part of the RDKit.
2
+ // The contents are covered by the terms of the BSD license
3
+ // which is included in the file license.txt, found at the root
4
+ // of the RDKit source tree.
5
+ //
6
+ #include <RDGeneral/export.h>
7
+ #ifndef RDKIT_RDPROPS_H
8
+ #define RDKIT_RDPROPS_H
9
+ #include "Dict.h"
10
+ #include "types.h"
11
+
12
+ namespace RDKit {
13
+
14
+ class RDProps {
15
+ protected:
16
+ mutable Dict d_props;
17
+ // It is a quirk of history that this is mutable
18
+ // as the RDKit allows properties to be set
19
+ // on const objects.
20
+
21
+ public:
22
+ RDProps() : d_props() {}
23
+ RDProps(const RDProps &rhs) : d_props(rhs.d_props) {}
24
+ RDProps &operator=(const RDProps &rhs) {
25
+ if (this == &rhs) {
26
+ return *this;
27
+ }
28
+ d_props = rhs.d_props;
29
+ return *this;
30
+ }
31
+ RDProps(RDProps &&o) noexcept = default;
32
+ RDProps &operator=(RDProps &&rhs) noexcept = default;
33
+
34
+ void clear() { d_props.reset(); }
35
+ //! gets the underlying Dictionary
36
+ const Dict &getDict() const { return d_props; }
37
+ Dict &getDict() { return d_props; }
38
+
39
+ // ------------------------------------
40
+ // Local Property Dict functionality
41
+ // all setProp functions are const because they
42
+ // are not meant to change the atom chemically
43
+ // ------------------------------------
44
+ //! returns a list with the names of our \c properties
45
+ STR_VECT getPropList(bool includePrivate = true,
46
+ bool includeComputed = true) const {
47
+ const STR_VECT &tmp = d_props.keys();
48
+ STR_VECT res, computed;
49
+ if (!includeComputed &&
50
+ getPropIfPresent(RDKit::detail::computedPropName, computed)) {
51
+ computed.push_back(RDKit::detail::computedPropName);
52
+ }
53
+
54
+ auto pos = tmp.begin();
55
+ while (pos != tmp.end()) {
56
+ if ((includePrivate || (*pos)[0] != '_') &&
57
+ std::find(computed.begin(), computed.end(), *pos) == computed.end()) {
58
+ res.push_back(*pos);
59
+ }
60
+ pos++;
61
+ }
62
+ return res;
63
+ }
64
+
65
+ //! sets a \c property value
66
+ /*!
67
+ \param key the name under which the \c property should be stored.
68
+ If a \c property is already stored under this name, it will be
69
+ replaced.
70
+ \param val the value to be stored
71
+ \param computed (optional) allows the \c property to be flagged
72
+ \c computed.
73
+ */
74
+
75
+ //! \overload
76
+ template <typename T>
77
+ void setProp(const std::string &key, T val, bool computed = false) const {
78
+ if (computed) {
79
+ STR_VECT compLst;
80
+ getPropIfPresent(RDKit::detail::computedPropName, compLst);
81
+ if (std::find(compLst.begin(), compLst.end(), key) == compLst.end()) {
82
+ compLst.push_back(key);
83
+ d_props.setVal(RDKit::detail::computedPropName, compLst);
84
+ }
85
+ }
86
+ d_props.setVal(key, val);
87
+ }
88
+
89
+ //! allows retrieval of a particular property value
90
+ /*!
91
+
92
+ \param key the name under which the \c property should be stored.
93
+ If a \c property is already stored under this name, it will be
94
+ replaced.
95
+ \param res a reference to the storage location for the value.
96
+
97
+ <b>Notes:</b>
98
+ - if no \c property with name \c key exists, a KeyErrorException will be
99
+ thrown.
100
+ - the \c boost::lexical_cast machinery is used to attempt type
101
+ conversions.
102
+ If this fails, a \c boost::bad_lexical_cast exception will be thrown.
103
+
104
+ */
105
+ //! \overload
106
+ template <typename T>
107
+ void getProp(const std::string &key, T &res) const {
108
+ d_props.getVal(key, res);
109
+ }
110
+
111
+ //! \overload
112
+ template <typename T>
113
+ T getProp(const std::string &key) const {
114
+ return d_props.getVal<T>(key);
115
+ }
116
+
117
+ //! returns whether or not we have a \c property with name \c key
118
+ //! and assigns the value if we do
119
+ //! \overload
120
+ template <typename T>
121
+ bool getPropIfPresent(const std::string &key, T &res) const {
122
+ return d_props.getValIfPresent(key, res);
123
+ }
124
+
125
+ //! \overload
126
+ bool hasProp(const std::string &key) const { return d_props.hasVal(key); }
127
+
128
+ //! clears the value of a \c property
129
+ /*!
130
+ <b>Notes:</b>
131
+ - if no \c property with name \c key exists, a KeyErrorException
132
+ will be thrown.
133
+ - if the \c property is marked as \c computed, it will also be removed
134
+ from our list of \c computedProperties
135
+ */
136
+ //! \overload
137
+ void clearProp(const std::string &key) const {
138
+ STR_VECT compLst;
139
+ if (getPropIfPresent(RDKit::detail::computedPropName, compLst)) {
140
+ auto svi = std::find(compLst.begin(), compLst.end(), key);
141
+ if (svi != compLst.end()) {
142
+ compLst.erase(svi);
143
+ d_props.setVal(RDKit::detail::computedPropName, compLst);
144
+ }
145
+ }
146
+ d_props.clearVal(key);
147
+ }
148
+
149
+ //! clears all of our \c computed \c properties
150
+ void clearComputedProps() const {
151
+ STR_VECT compLst;
152
+ if (getPropIfPresent(RDKit::detail::computedPropName, compLst)) {
153
+ for (const auto &sv : compLst) {
154
+ d_props.clearVal(sv);
155
+ }
156
+ compLst.clear();
157
+ d_props.setVal(RDKit::detail::computedPropName, compLst);
158
+ }
159
+ }
160
+
161
+ //! update the properties from another
162
+ /*
163
+ \param source Source to update the properties from
164
+ \param preserve Existing If true keep existing data, else override from
165
+ the source
166
+ */
167
+ void updateProps(const RDProps &source, bool preserveExisting = false) {
168
+ d_props.update(source.getDict(), preserveExisting);
169
+ }
170
+ };
171
+ } // namespace RDKit
172
+ #endif
@@ -0,0 +1,44 @@
1
+ //
2
+ // Copyright (C) 2015-2018 Greg Landrum
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
+ #include <RDGeneral/export.h>
12
+ #ifndef RDTHREADS_H_2015
13
+ #define RDTHREADS_H_2015
14
+
15
+ #include <RDGeneral/Invariant.h>
16
+
17
+ #ifdef RDK_THREADSAFE_SSS
18
+ #include <thread>
19
+
20
+ namespace RDKit {
21
+ inline unsigned int getNumThreadsToUse(int target) {
22
+ if (target >= 1) {
23
+ return static_cast<unsigned int>(target);
24
+ }
25
+ unsigned int res = std::thread::hardware_concurrency();
26
+ if (res > rdcast<unsigned int>(-target)) {
27
+ return res + target;
28
+ } else {
29
+ return 1;
30
+ }
31
+ }
32
+ } // namespace RDKit
33
+
34
+ #else
35
+
36
+ namespace RDKit {
37
+ inline unsigned int getNumThreadsToUse(int target) {
38
+ RDUNUSED_PARAM(target);
39
+ return 1;
40
+ }
41
+ } // namespace RDKit
42
+ #endif
43
+
44
+ #endif
@@ -0,0 +1,478 @@
1
+ // Copyright (c) 2015, Novartis Institutes for BioMedical Research Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following
12
+ // disclaimer in the documentation and/or other materials provided
13
+ // with the distribution.
14
+ // * Neither the name of Novartis Institutes for BioMedical Research Inc.
15
+ // nor the names of its contributors may be used to endorse or promote
16
+ // products derived from this software without specific prior written
17
+ // permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ //
31
+ #include <RDGeneral/export.h>
32
+ #ifndef RDKIT_RDVALUE_PTRMAGIC_H
33
+ #define RDKIT_RDVALUE_PTRMAGIC_H
34
+
35
+ #include <cstdint>
36
+ #include <cassert>
37
+ #include <boost/any.hpp>
38
+ #include "Invariant.h"
39
+ #include <iostream>
40
+ #include <iomanip>
41
+ #include <sstream>
42
+ #include <vector>
43
+ #include <string>
44
+ #include <RDGeneral/BoostStartInclude.h>
45
+ #include <boost/utility.hpp>
46
+ #include <boost/lexical_cast.hpp>
47
+ #include <boost/type_traits.hpp>
48
+ #include <boost/static_assert.hpp>
49
+ #include <RDGeneral/BoostEndInclude.h>
50
+ #include <cmath>
51
+ #include "LocaleSwitcher.h"
52
+
53
+ #define RDVALUE_HASBOOL
54
+
55
+ namespace RDKit {
56
+
57
+ // Inspired by
58
+ // https://nikic.github.io/2012/02/02/Pointer-magic-for-efficient-dynamic-value-representations.html
59
+ // 16 bit storage for value types using Quiet NaN spaces in
60
+ // doubles
61
+ // Won't work on Solaris and some other os's as mmaping maps from
62
+ // top memory down
63
+ // Example check:
64
+ // std::string *pointer = new std::string(v);
65
+ // assert((reinterpret_cast<boost::uint64_t>(pointer) & StringTag) == 0);
66
+
67
+ // implementations, need a typedef at compile time to figure this out.
68
+ // current implementation is probably little endian, need to check.
69
+
70
+ /*
71
+ Encoding for storing other things as a double. Use
72
+ Quiet NaN
73
+ Quiet NaN: // used to encode types
74
+ F F F 1XXX < - X = type bits (first bit is set to one)
75
+
76
+ seeeeeee|eeeemmmm|mmmmmmmm|mmmmmmmm|mmmmmmmm|mmmmmmmm|mmmmmmmm|mmmmmmmm
77
+ s1111111|11111ppp|pppppppp|pppppppp|pppppppp|pppppppp|pppppppp|pppppppp
78
+ ^- first mantissa bit 1 everything else is "payload" -^
79
+ ^- exponent bits all 1 and mustn't be all-zero (as it
80
+ ^- any sign bit would be INF then)
81
+
82
+ Available
83
+ 8 = 1000 MaxDouble // Not really a tag, is a sentinel
84
+ 9 = 1001 Float
85
+ b = 1010 Int32
86
+ a = 1011 Uint32
87
+ C = 1100 <none>
88
+ D = 1101 <none>
89
+ E = 1110 <none>
90
+ F = 1111 PtrTag (look at lower 3 bits for type)
91
+ */
92
+
93
+ namespace RDTypeTag {
94
+ static const boost::uint64_t NaN = 0xfff7FFFFFFFFFFFF; // signalling NaN
95
+ static const boost::uint64_t MaxDouble = 0xfff8000000000000; //
96
+ static const boost::uint64_t DoubleTag = 0xfff8000000000000; //
97
+ static const boost::uint64_t FloatTag = 0xfff9000000000000; //
98
+ static const boost::uint64_t IntTag = 0xfffa000000000000; //
99
+ static const boost::uint64_t UnsignedIntTag = 0xfffb000000000000; //
100
+ static const boost::uint64_t BoolTag = 0xfffc000000000000; //
101
+
102
+ // PTR Tags use the last 3 bits for typing info
103
+ static const boost::uint64_t PtrTag = 0xffff000000000000;
104
+ static const boost::uint64_t StringTag = 0xffff000000000001; // 001
105
+ static const boost::uint64_t VecDoubleTag = 0xffff000000000002; // 010
106
+ static const boost::uint64_t VecFloatTag = 0xffff000000000003; // 011
107
+ static const boost::uint64_t VecIntTag = 0xffff000000000004; // 100
108
+ static const boost::uint64_t VecUnsignedIntTag = 0xffff000000000005; // 101
109
+ static const boost::uint64_t VecStringTag = 0xffff000000000006; // 110
110
+ static const boost::uint64_t AnyTag = 0xffff000000000007; // 111
111
+
112
+ // Retrieves the tag (and PtrMask) from the type
113
+ template <class T>
114
+ inline boost::uint64_t GetTag() {
115
+ return AnyTag;
116
+ }
117
+ template <>
118
+ inline boost::uint64_t GetTag<double>() {
119
+ return MaxDouble;
120
+ }
121
+ template <>
122
+ inline boost::uint64_t GetTag<float>() {
123
+ return FloatTag;
124
+ }
125
+ template <>
126
+ inline boost::uint64_t GetTag<int>() {
127
+ return IntTag;
128
+ }
129
+ template <>
130
+ inline boost::uint64_t GetTag<unsigned int>() {
131
+ return UnsignedIntTag;
132
+ }
133
+ template <>
134
+ inline boost::uint64_t GetTag<bool>() {
135
+ return BoolTag;
136
+ }
137
+ template <>
138
+ inline boost::uint64_t GetTag<std::string>() {
139
+ return StringTag;
140
+ }
141
+ template <>
142
+ inline boost::uint64_t GetTag<std::vector<double>>() {
143
+ return VecDoubleTag;
144
+ }
145
+ template <>
146
+ inline boost::uint64_t GetTag<std::vector<float>>() {
147
+ return VecFloatTag;
148
+ }
149
+ template <>
150
+ inline boost::uint64_t GetTag<std::vector<int>>() {
151
+ return VecIntTag;
152
+ }
153
+ template <>
154
+ inline boost::uint64_t GetTag<std::vector<unsigned int>>() {
155
+ return VecUnsignedIntTag;
156
+ }
157
+ template <>
158
+ inline boost::uint64_t GetTag<std::vector<std::string>>() {
159
+ return VecStringTag;
160
+ }
161
+ template <>
162
+ inline boost::uint64_t GetTag<boost::any>() {
163
+ return AnyTag;
164
+ }
165
+ } // namespace RDTypeTag
166
+
167
+ struct RDValue {
168
+ // Bit Twidling for conversion from the Tag to a Pointer
169
+ static const boost::uint64_t TagMask = 0xFFFF000000000000;
170
+ static const boost::uint64_t PointerTagMask = 0xFFFF000000000007;
171
+ static const boost::uint64_t ApplyMask = 0x0000FFFFFFFFFFFF;
172
+ static const boost::uint64_t ApplyPtrMask = 0x0000FFFFFFFFFFF8;
173
+
174
+ union {
175
+ double doubleBits;
176
+ boost::uint64_t otherBits;
177
+ };
178
+
179
+ inline RDValue() : doubleBits(0.0) {}
180
+
181
+ inline RDValue(double number) {
182
+ if (boost::math::isnan(number)) {
183
+ // Store a signalling NaN for NaN's.
184
+ // quiet NaNs are used for other types.
185
+ otherBits = RDTypeTag::NaN;
186
+ assert(boost::math::isnan(doubleBits));
187
+ } else
188
+ doubleBits = number;
189
+ }
190
+
191
+ inline RDValue(float number) {
192
+ otherBits = 0 | RDTypeTag::FloatTag;
193
+ memcpy(((char *)&otherBits), &number, sizeof(float));
194
+ }
195
+
196
+ inline RDValue(int32_t number) {
197
+ otherBits = (((boost::uint64_t)number) & ApplyMask) | RDTypeTag::IntTag;
198
+ }
199
+
200
+ inline RDValue(unsigned int number) {
201
+ otherBits =
202
+ (((boost::uint64_t)number) & ApplyMask) | RDTypeTag::UnsignedIntTag;
203
+ }
204
+
205
+ inline RDValue(bool number) {
206
+ otherBits =
207
+ (static_cast<boost::uint64_t>(number) & ApplyMask) | RDTypeTag::BoolTag;
208
+ }
209
+
210
+ inline RDValue(boost::any *pointer) {
211
+ // ensure that the pointer really is only 48 bit
212
+ assert((reinterpret_cast<boost::uint64_t>(pointer) & RDTypeTag::AnyTag) ==
213
+ 0);
214
+ otherBits = reinterpret_cast<boost::uint64_t>(pointer) | RDTypeTag::AnyTag;
215
+ }
216
+
217
+ inline RDValue(const boost::any &any) {
218
+ // ensure that the pointer really is only 48 bit
219
+ boost::any *pointer = new boost::any(any);
220
+ assert((reinterpret_cast<boost::uint64_t>(pointer) & RDTypeTag::AnyTag) ==
221
+ 0);
222
+ otherBits = reinterpret_cast<boost::uint64_t>(pointer) | RDTypeTag::AnyTag;
223
+ }
224
+
225
+ // Unknown types are stored as boost::any
226
+ template <class T>
227
+ inline RDValue(const T &v) {
228
+ boost::any *pointer = new boost::any(v);
229
+ assert((reinterpret_cast<boost::uint64_t>(pointer) & RDTypeTag::AnyTag) ==
230
+ 0);
231
+ otherBits = reinterpret_cast<boost::uint64_t>(pointer) | RDTypeTag::AnyTag;
232
+ }
233
+
234
+ inline RDValue(const std::string &v) {
235
+ std::string *pointer = new std::string(v);
236
+ assert((reinterpret_cast<boost::uint64_t>(pointer) &
237
+ RDTypeTag::StringTag) == 0);
238
+ otherBits =
239
+ reinterpret_cast<boost::uint64_t>(pointer) | RDTypeTag::StringTag;
240
+ }
241
+
242
+ inline RDValue(const std::vector<double> &v) {
243
+ std::vector<double> *pointer = new std::vector<double>(v);
244
+ assert((reinterpret_cast<boost::uint64_t>(pointer) &
245
+ RDTypeTag::VecDoubleTag) == 0);
246
+ otherBits =
247
+ reinterpret_cast<boost::uint64_t>(pointer) | RDTypeTag::VecDoubleTag;
248
+ }
249
+
250
+ inline RDValue(const std::vector<float> &v) {
251
+ std::vector<float> *pointer = new std::vector<float>(v);
252
+ assert((reinterpret_cast<boost::uint64_t>(pointer) &
253
+ RDTypeTag::VecFloatTag) == 0);
254
+ otherBits =
255
+ reinterpret_cast<boost::uint64_t>(pointer) | RDTypeTag::VecFloatTag;
256
+ }
257
+
258
+ inline RDValue(const std::vector<int> &v) {
259
+ std::vector<int> *pointer = new std::vector<int>(v);
260
+ assert((reinterpret_cast<boost::uint64_t>(pointer) &
261
+ RDTypeTag::VecIntTag) == 0);
262
+ otherBits =
263
+ reinterpret_cast<boost::uint64_t>(pointer) | RDTypeTag::VecIntTag;
264
+ }
265
+
266
+ inline RDValue(const std::vector<unsigned int> &v) {
267
+ std::vector<unsigned int> *pointer = new std::vector<unsigned int>(v);
268
+ assert((reinterpret_cast<boost::uint64_t>(pointer) &
269
+ RDTypeTag::VecIntTag) == 0);
270
+ otherBits = reinterpret_cast<boost::uint64_t>(pointer) |
271
+ RDTypeTag::VecUnsignedIntTag;
272
+ }
273
+
274
+ inline RDValue(const std::vector<std::string> &v) {
275
+ std::vector<std::string> *pointer = new std::vector<std::string>(v);
276
+ assert((reinterpret_cast<boost::uint64_t>(pointer) &
277
+ RDTypeTag::VecStringTag) == 0);
278
+ otherBits =
279
+ reinterpret_cast<boost::uint64_t>(pointer) | RDTypeTag::VecStringTag;
280
+ }
281
+
282
+ boost::uint64_t getTag() const {
283
+ if (otherBits < RDTypeTag::MaxDouble ||
284
+ (otherBits & RDTypeTag::NaN) == RDTypeTag::NaN) {
285
+ return RDTypeTag::DoubleTag;
286
+ }
287
+
288
+ boost::uint64_t tag = otherBits & TagMask;
289
+ if (tag == RDTypeTag::PtrTag) return otherBits & PointerTagMask;
290
+ return tag;
291
+ }
292
+
293
+ // ptrCast - unsafe, use rdvalue_cast instead.
294
+ template <class T>
295
+ inline T *ptrCast() const {
296
+ return reinterpret_cast<T *>(otherBits & ~RDTypeTag::GetTag<T>());
297
+ }
298
+
299
+ // RDValue doesn't have an explicit destructor, it must
300
+ // be wrapped in a container.
301
+ // The idea is that POD types don't need to be destroyed
302
+ // and this allows the container optimization possibilities.
303
+ inline void destroy() {
304
+ switch (getTag()) {
305
+ case RDTypeTag::StringTag:
306
+ delete ptrCast<std::string>();
307
+ break;
308
+ case RDTypeTag::VecDoubleTag:
309
+ delete ptrCast<std::vector<double>>();
310
+ break;
311
+ case RDTypeTag::VecFloatTag:
312
+ delete ptrCast<std::vector<float>>();
313
+ break;
314
+ case RDTypeTag::VecIntTag:
315
+ delete ptrCast<std::vector<int>>();
316
+ break;
317
+ case RDTypeTag::VecUnsignedIntTag:
318
+ delete ptrCast<std::vector<unsigned int>>();
319
+ break;
320
+ case RDTypeTag::VecStringTag:
321
+ delete ptrCast<std::vector<std::string>>();
322
+ break;
323
+ case RDTypeTag::AnyTag:
324
+ delete ptrCast<boost::any>();
325
+ break;
326
+ default:
327
+ break;
328
+ }
329
+ }
330
+
331
+ static inline void cleanup_rdvalue(RDValue v) { v.destroy(); }
332
+ };
333
+
334
+ /////////////////////////////////////////////////////////////////////////////////////
335
+ // Given two RDValue::Values - copy the appropriate structure
336
+ // RDValue doesn't have a copy constructor, the default
337
+ // copy act's like a move for better value semantics.
338
+ // Containers may need to copy though.
339
+ inline void copy_rdvalue(RDValue &dest, const RDValue &src) {
340
+ dest.destroy();
341
+ switch (src.getTag()) {
342
+ case RDTypeTag::StringTag:
343
+ dest = RDValue(*src.ptrCast<std::string>());
344
+ break;
345
+ case RDTypeTag::VecDoubleTag:
346
+ dest = RDValue(*src.ptrCast<std::vector<double>>());
347
+ break;
348
+ case RDTypeTag::VecFloatTag:
349
+ dest = RDValue(*src.ptrCast<std::vector<float>>());
350
+ break;
351
+ case RDTypeTag::VecIntTag:
352
+ dest = RDValue(*src.ptrCast<std::vector<int>>());
353
+ break;
354
+ case RDTypeTag::VecUnsignedIntTag:
355
+ dest = RDValue(*src.ptrCast<std::vector<unsigned int>>());
356
+ break;
357
+ case RDTypeTag::VecStringTag:
358
+ dest = RDValue(*src.ptrCast<std::vector<std::string>>());
359
+ break;
360
+ case RDTypeTag::AnyTag:
361
+ dest = RDValue(*src.ptrCast<boost::any>());
362
+ break;
363
+ default:
364
+ dest = src;
365
+ }
366
+ }
367
+
368
+ /////////////////////////////////////////////////////////////////////////////////////
369
+ // rdvalue_is<T>
370
+
371
+ template <class T>
372
+ inline bool rdvalue_is(const RDValue_cast_t) {
373
+ const short tag =
374
+ RDTypeTag::GetTag<typename boost::remove_reference<T>::type>();
375
+ if (v.getTag() == tag) return true;
376
+
377
+ // If we are an Any tag, check the any type info
378
+ if (v.getTag() == RDTypeTag::AnyTag) {
379
+ return v.value.a->type() == typeid(T);
380
+ }
381
+
382
+ return false;
383
+ }
384
+
385
+ template <>
386
+ inline bool rdvalue_is<double>(const RDValue_cast_t) {
387
+ return v.otherBits < RDTypeTag::MaxDouble ||
388
+ (v.otherBits & RDTypeTag::NaN) == RDTypeTag::NaN;
389
+ }
390
+
391
+ template <>
392
+ inline bool rdvalue_is<const double &>(const RDValue_cast_t) {
393
+ return rdvalue_is<double>(v);
394
+ }
395
+
396
+ /*
397
+ template<>
398
+ inline bool rdvalue_is<bool>(const RDValue_cast_t) {
399
+ return (v.getTag() == RDTypeTag::IntTag &&
400
+ (static_cast<int32_t>(v.otherBits & ~RDTypeTag::IntTag) == 1 ||
401
+ static_cast<int32_t>(v.otherBits & ~RDTypeTag::IntTag) == 0 ));
402
+ }
403
+
404
+ template<>
405
+ inline bool rdvalue_is<const bool&>(const RDValue_cast_t) {
406
+ return rdvalue_is<bool>(v);
407
+ }
408
+ */
409
+
410
+ /////////////////////////////////////////////////////////////////////////////////////
411
+ // rdvalue_cast<T>
412
+ //
413
+ // POD types do not support reference semantics. Other types do.
414
+ // rdvalue_cast<const std::vector<double> &>(RDValue); // ok
415
+ // rdvalue_cast<const float &>(RDValue); // bad_any_cast
416
+
417
+ typedef RDValue RDValue_cast_t;
418
+ // Get stuff stored in boost any
419
+ template <class T>
420
+ inline T rdvalue_cast(RDValue_cast_t v) {
421
+ // Disable reference and pointer casts to POD data.
422
+ BOOST_STATIC_ASSERT(!(
423
+ (boost::is_pointer<T>::value &&
424
+ (boost::is_integral<typename boost::remove_pointer<T>::type>::value ||
425
+ boost::is_floating_point<
426
+ typename boost::remove_pointer<T>::type>::value)) ||
427
+ (boost::is_reference<T>::value &&
428
+ (boost::is_integral<typename boost::remove_reference<T>::type>::value ||
429
+ boost::is_floating_point<
430
+ typename boost::remove_reference<T>::type>::value))));
431
+
432
+ if (rdvalue_is<boost::any>(v)) {
433
+ return boost::any_cast<T>(*v.ptrCast<boost::any>());
434
+ }
435
+ throw boost::bad_any_cast();
436
+ }
437
+
438
+ // POD casts
439
+ template <>
440
+ inline double rdvalue_cast<double>(RDValue_cast_t v) {
441
+ if (rdvalue_is<double>(v)) return v.doubleBits;
442
+ throw boost::bad_any_cast();
443
+ }
444
+
445
+ template <>
446
+ inline float rdvalue_cast<float>(RDValue_cast_t v) {
447
+ if (rdvalue_is<float>(v)) {
448
+ float f;
449
+ memcpy(&f, ((char *)&v.otherBits), sizeof(float));
450
+ return f;
451
+ }
452
+ throw boost::bad_any_cast();
453
+ }
454
+
455
+ // n.b. with const expressions, could use ~RDTagTypes::GetTag<T>()
456
+ // and enable_if
457
+ template <>
458
+ inline int rdvalue_cast<int>(RDValue_cast_t v) {
459
+ if (rdvalue_is<int>(v))
460
+ return static_cast<int32_t>(v.otherBits & ~RDTypeTag::IntTag);
461
+ throw boost::bad_any_cast();
462
+ }
463
+ template <>
464
+ inline unsigned int rdvalue_cast<unsigned int>(RDValue_cast_t v) {
465
+ if (rdvalue_is<unsigned int>(v))
466
+ return static_cast<uint32_t>(v.otherBits & ~RDTypeTag::UnsignedIntTag);
467
+ throw boost::bad_any_cast();
468
+ }
469
+
470
+ template <>
471
+ inline bool rdvalue_cast<bool>(RDValue_cast_t v) {
472
+ if (rdvalue_is<bool>(v))
473
+ return static_cast<bool>(v.otherBits & ~RDTypeTag::BoolTag);
474
+ throw boost::bad_any_cast();
475
+ }
476
+
477
+ } // namespace RDKit
478
+ #endif