20#include <boost/utility/binary.hpp>
21#include <boost/variant.hpp>
43 const char *
what() const noexcept
override {
return _msg.c_str(); }
60 AllProps = 0x0000FFFF,
61 CoordsAsDouble = 0x00010000,
64} PropertyPickleOptions;
164 unsigned int propertyFlags);
169 unsigned int propertyFlags) {
170 MolPickler::pickleMol(&mol, ss, propertyFlags);
176 unsigned int propertyFlags);
179 unsigned int propertyFlags) {
180 MolPickler::pickleMol(&mol, res, propertyFlags);
185 unsigned int propertyFlags);
187 unsigned int propertyFlags) {
188 MolPickler::molFromPickle(pickle, &mol, propertyFlags);
191 MolPickler::molFromPickle(pickle, mol, PicklerOps::AllProps);
194 MolPickler::molFromPickle(pickle, &mol, PicklerOps::AllProps);
199 unsigned int propertyFlags);
201 unsigned int propertyFlags) {
202 MolPickler::molFromPickle(ss, &mol, propertyFlags);
205 MolPickler::molFromPickle(ss, mol, PicklerOps::AllProps);
208 MolPickler::molFromPickle(ss, &mol, PicklerOps::AllProps);
213 static std::int32_t _pickleAtomData(std::ostream &tss,
const Atom *atom);
215 static void _unpickleAtomData(std::istream &tss,
Atom *atom,
int version);
217 static void _pickleQueryAtomData(std::ostream &tss,
const Atom *atom);
220 template <
typename T>
221 static void _pickle(
const ROMol *mol, std::ostream &ss,
222 unsigned int propertyFlags);
225 template <
typename T>
226 static void _pickleAtom(std::ostream &ss,
const Atom *atom);
229 template <
typename T>
230 static void _pickleBond(std::ostream &ss,
const Bond *bond,
231 std::map<int, int> &atomIdxMap);
234 template <
typename T>
235 static void _pickleSSSR(std::ostream &ss,
const RingInfo *ringInfo,
236 std::map<int, int> &atomIdxMap);
239 template <
typename T>
240 static void _pickleSubstanceGroup(std::ostream &ss,
242 std::map<int, int> &atomIdxMap,
243 std::map<int, int> &bondIdxMap);
246 template <
typename T>
247 static void _pickleStereo(std::ostream &ss, std::vector<StereoGroup> groups,
248 std::map<int, int> &atomIdxMap,
249 std::map<int, int> &bondIdxMap);
252 template <
typename T,
typename C>
253 static void _pickleConformer(std::ostream &ss,
const Conformer *conf);
256 template <
typename T>
257 static void _depickle(std::istream &ss,
ROMol *mol,
int version,
int numAtoms,
258 unsigned int propertyFlags);
262 template <
typename T>
263 static Atom *_addAtomFromPickle(std::istream &ss,
ROMol *mol,
265 bool directMap =
false);
268 template <
typename T>
269 static Bond *_addBondFromPickle(std::istream &ss,
ROMol *mol,
int version,
270 bool directMap =
false);
274 template <
typename T>
275 static void _addRingInfoFromPickle(
276 std::istream &ss,
ROMol *mol,
int version,
bool directMap =
false,
278 FIND_RING_TYPE::FIND_RING_TYPE_OTHER_OR_UNKNOWN);
281 template <
typename T>
282 static SubstanceGroup _getSubstanceGroupFromPickle(std::istream &ss,
283 ROMol *mol,
int version);
285 template <
typename T>
286 static void _depickleStereo(std::istream &ss,
ROMol *mol,
int version);
289 template <
typename T,
typename C>
290 static Conformer *_conformerFromPickle(std::istream &ss,
int version);
293 static void _pickleProperties(std::ostream &ss,
const RDProps &props,
294 unsigned int pickleFlags);
296 static void _unpickleProperties(std::istream &ss,
RDProps &props,
300 static void _pickleV1(
const ROMol *mol, std::ostream &ss);
302 static void _depickleV1(std::istream &ss,
ROMol *mol);
304 static void _addAtomFromPickleV1(std::istream &ss,
ROMol *mol);
306 static void _addBondFromPickleV1(std::istream &ss,
ROMol *mol);
309namespace PicklerOps {
313 std::tuple<MolPickler::Tags, int32_t, int32_t>,
314 std::tuple<MolPickler::Tags, int32_t, int32_t, int32_t, char>,
315 std::tuple<MolPickler::Tags, std::set<int32_t>>,
316 std::tuple<MolPickler::Tags, std::string>,
317 std::tuple<MolPickler::Tags, Dict::Pair, double>>;
Defines the Atom class and associated typedefs.
Pulls in all the query types.
Base class for all queries.
The class for representing atoms.
class for representing a bond
used to indicate exceptions whilst pickling (serializing) molecules
~MolPicklerException() noexcept override=default
const char * what() const noexcept override
MolPicklerException(const std::string msg)
MolPicklerException(const char *msg)
handles pickling (serializing) molecules
static const std::int32_t endianId
mark the endian-ness of the pickle
static void molFromPickle(std::istream &ss, ROMol *mol)
static void molFromPickle(const std::string &pickle, ROMol &mol, unsigned int propertyFlags)
static void molFromPickle(std::istream &ss, ROMol &mol, unsigned int propertyFlags)
static void pickleMol(const ROMol *mol, std::string &res, unsigned int propertyFlags)
static void molFromPickle(std::istream &ss, ROMol *mol, unsigned int propertyFlags)
constructs a molecule from a pickle stored in a stream
static void molFromPickle(const std::string &pickle, ROMol *mol)
@ ATOM_PDB_RESIDUE_TEMPFACTOR
@ QUERY_PROPERTY_WITH_VALUE
@ BEGINFINDOTHERORUNKNOWN
@ ATOM_PDB_RESIDUE_OCCUPANCY
@ ATOM_PDB_RESIDUE_SERIALNUMBER
@ ATOM_PDB_RESIDUE_INSERTIONCODE
@ ATOM_PDB_RESIDUE_RESIDUENUMBER
@ ATOM_PDB_RESIDUE_SECONDARYSTRUCTURE
@ ATOM_PDB_RESIDUE_SEGMENTNUMBER
@ ATOM_PDB_RESIDUE_RESIDUENAME
@ ATOM_PDB_RESIDUE_ALTLOC
@ ATOM_PDB_RESIDUE_CHAINID
@ ATOM_PDB_RESIDUE_ISHETEROATOM
static void pickleMol(const ROMol &mol, std::ostream &ss)
static void pickleMol(const ROMol &mol, std::string &res, unsigned int propertyFlags)
static void pickleMol(const ROMol *mol, std::ostream &ss, unsigned int propertyFlags)
static void molFromPickle(const std::string &pickle, ROMol *mol, unsigned int propertyFlags)
constructs a molecule from a pickle stored in a string
static const CustomPropHandlerVec & getCustomPropHandlers()
static void molFromPickle(const std::string &pickle, ROMol &mol)
static void setDefaultPickleProperties(unsigned int)
static const std::int32_t versionMajor
mark the pickle major version
static const std::int32_t versionMinor
mark the pickle minor version
static void molFromPickle(std::istream &ss, ROMol &mol)
static void pickleMol(const ROMol &mol, std::ostream &ss, unsigned int propertyFlags)
static void pickleMol(const ROMol *mol, std::ostream &ss)
pickles a molecule and sends the results to stream ss
static void pickleMol(const ROMol *mol, std::string &res)
pickles a molecule and adds the results to string res
static unsigned int getDefaultPickleProperties()
static void addCustomPropHandler(const CustomPropHandler &handler)
static const std::int32_t versionPatch
mark the pickle patch version
static void pickleMol(const ROMol &mol, std::string &res)
The class for representing SubstanceGroups.
#define RDKIT_GRAPHMOL_EXPORT
QueryDetails getQueryDetails(const Queries::Query< int, T const *, true > *query)
boost::variant< MolPickler::Tags, std::tuple< MolPickler::Tags, int32_t >, std::tuple< MolPickler::Tags, int32_t, int32_t >, std::tuple< MolPickler::Tags, int32_t, int32_t, int32_t, char >, std::tuple< MolPickler::Tags, std::set< int32_t > >, std::tuple< MolPickler::Tags, std::string >, std::tuple< MolPickler::Tags, Dict::Pair, double > > QueryDetails
FIND_RING_TYPE
A class to store information about a molecule's rings.
std::vector< std::shared_ptr< const CustomPropHandler > > CustomPropHandlerVec