Chemical Data Processing Library Python API - Version 1.2.0
Classes | Public Member Functions | Static Public Attributes | Properties | List of all members
CDPL.Chem.HashCodeCalculator Class Reference

HashCodeCalculator. More...

+ Inheritance diagram for CDPL.Chem.HashCodeCalculator:

Classes

class  DefAtomHashSeedFunctor
 The default functor for the generation of atom hash seeds. More...
 
class  DefBondHashSeedFunctor
 The default functor for the generation of bond hash seeds. More...
 

Public Member Functions

None __init__ ()
 Constructs the HashCodeCalculator instance.
 
None __init__ (MolecularGraph molgraph)
 Constructs the HashCodeCalculator instance and calculates the hash code of the molecular graph molgraph. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
None setAtomHashSeedFunction (SizeTypeAtomFunctor func)
 Allows to specify a custom function for the generation of initial atom hash codes. More...
 
None setBondHashSeedFunction (UInt64BondFunctor func)
 Allows to specify a custom function for the generation of initial bond hash codes. More...
 
int calculate (MolecularGraph molgraph)
 Calculates the hash code of the molecular graph molgraph. More...
 
int getResult ()
 Returns the result of the last hash code calculation. More...
 
int __call__ (MolecularGraph molgraph)
 

Static Public Attributes

int DEF_ATOM_PROPERTY_FLAGS = 159
 Specifies the default set of atomic properties considered in the generation of initial atom hash codes by HashCodeCalculator.DefAtomHashSeedFunction.
 
int DEF_BOND_PROPERTY_FLAGS = 15
 Specifies the default set of bond properties considered in the generation of initial bond hash codes by HashCodeCalculator.DefBondHashSeedFunction.
 

Properties

 objectID = property(getObjectID)
 
 result = property(getResult)
 

Detailed Description

HashCodeCalculator.

See also
[MHASH]

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.HashCodeCalculator.__init__ ( MolecularGraph  molgraph)

Constructs the HashCodeCalculator instance and calculates the hash code of the molecular graph molgraph.

The calculated hash code can be retrieved by a call to getResult().

Parameters
molgraphThe molecular graph for which the hash code has to be calculated.

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.HashCodeCalculator.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python HashCodeCalculator instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two HashCodeCalculator instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ setAtomHashSeedFunction()

None CDPL.Chem.HashCodeCalculator.setAtomHashSeedFunction ( SizeTypeAtomFunctor  func)

Allows to specify a custom function for the generation of initial atom hash codes.

Parameters
funcA HashCodeCalculator.AtomHashSeedFunction instance that wraps the target function.
Note
By default, atom hash seeds are generated by HashCodeCalculator.DefAtomHashSeedFunctor.

◆ setBondHashSeedFunction()

None CDPL.Chem.HashCodeCalculator.setBondHashSeedFunction ( UInt64BondFunctor  func)

Allows to specify a custom function for the generation of initial bond hash codes.

Parameters
funcA HashCodeCalculator.BondHashSeedFunction instance that wraps the target function.
Note
By default, bond hash seeds are generated by HashCodeCalculator.DefBondHashSeedFunctor.

◆ calculate()

int CDPL.Chem.HashCodeCalculator.calculate ( MolecularGraph  molgraph)

Calculates the hash code of the molecular graph molgraph.

Parameters
molgraphThe molecular graph for which to calculate the hash code.
Returns
The hash code of the molecular graph molgraph.

◆ getResult()

int CDPL.Chem.HashCodeCalculator.getResult ( )

Returns the result of the last hash code calculation.

Returns
The result of the last hash code calculation, or zero if a calculation has not yet been performed.

◆ __call__()

int CDPL.Chem.HashCodeCalculator.__call__ ( MolecularGraph  molgraph)
Parameters
molgraph
Returns