Chemical Data Processing Library C++ API - Version 1.1.1
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
CDPL::Chem::HashCodeCalculator Class Reference

HashCodeCalculator. More...

#include <HashCodeCalculator.hpp>

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 Types

typedef std::function< std::uint64_t(const Atom &)> AtomHashSeedFunction
 Type of the generic functor class used to store user-defined functions or function objects for the generation of initial atom hash codes. More...
 
typedef std::function< std::uint64_t(const Bond &)> BondHashSeedFunction
 Type of the generic functor class used to store user-defined functions or function objects for the generation of initial bond hash codes. More...
 

Public Member Functions

 HashCodeCalculator ()
 Constructs the HashCodeCalculator instance. More...
 
 HashCodeCalculator (const MolecularGraph &molgraph)
 Constructs the HashCodeCalculator instance and calculates the hash code of the molecular graph molgraph. More...
 
void setAtomHashSeedFunction (const AtomHashSeedFunction &func)
 Allows to specify a custom function for the generation of initial atom hash codes. More...
 
void setBondHashSeedFunction (const BondHashSeedFunction &func)
 Allows to specify a custom function for the generation of initial bond hash codes. More...
 
std::uint64_t calculate (const MolecularGraph &molgraph)
 Calculates the hash code of the molecular graph molgraph. More...
 
std::uint64_t getResult () const
 Returns the result of the last hash code calculation. More...
 

Static Public Attributes

static constexpr unsigned int DEF_ATOM_PROPERTY_FLAGS
 Specifies the default set of atomic properties considered in the generation of initial atom hash codes by HashCodeCalculator::DefAtomHashSeedFunction. More...
 
static constexpr unsigned int DEF_BOND_PROPERTY_FLAGS
 Specifies the default set of bond properties considered in the generation of initial bond hash codes by HashCodeCalculator::DefBondHashSeedFunction. More...
 

Detailed Description

HashCodeCalculator.

See also
[MHASH]

Member Typedef Documentation

◆ AtomHashSeedFunction

typedef std::function<std::uint64_t(const Atom&)> CDPL::Chem::HashCodeCalculator::AtomHashSeedFunction

Type of the generic functor class used to store user-defined functions or function objects for the generation of initial atom hash codes.

Functions or function objects for the generation of atom hash seeds are required to take the atom (as a const reference to Chem::Atom) as argument and return the hash seed as an integer of type std::uint64_t (see [FUNWRP]).

◆ BondHashSeedFunction

typedef std::function<std::uint64_t(const Bond&)> CDPL::Chem::HashCodeCalculator::BondHashSeedFunction

Type of the generic functor class used to store user-defined functions or function objects for the generation of initial bond hash codes.

Functions or function objects for the generation of bond hash seeds are required to take the bond (as a const reference to Chem::Bond) as argument and return the hash seed as an integer of type std::uint64_t (see [FUNWRP]).

Constructor & Destructor Documentation

◆ HashCodeCalculator() [1/2]

CDPL::Chem::HashCodeCalculator::HashCodeCalculator ( )

Constructs the HashCodeCalculator instance.

◆ HashCodeCalculator() [2/2]

CDPL::Chem::HashCodeCalculator::HashCodeCalculator ( const 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

◆ setAtomHashSeedFunction()

void CDPL::Chem::HashCodeCalculator::setAtomHashSeedFunction ( const AtomHashSeedFunction 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()

void CDPL::Chem::HashCodeCalculator::setBondHashSeedFunction ( const BondHashSeedFunction 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()

std::uint64_t CDPL::Chem::HashCodeCalculator::calculate ( const 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()

std::uint64_t CDPL::Chem::HashCodeCalculator::getResult ( ) const

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.

Member Data Documentation

◆ DEF_ATOM_PROPERTY_FLAGS

constexpr unsigned int CDPL::Chem::HashCodeCalculator::DEF_ATOM_PROPERTY_FLAGS
staticconstexpr
Initial value:

Specifies the default set of atomic properties considered in the generation of initial atom hash codes by HashCodeCalculator::DefAtomHashSeedFunction.

◆ DEF_BOND_PROPERTY_FLAGS

constexpr unsigned int CDPL::Chem::HashCodeCalculator::DEF_BOND_PROPERTY_FLAGS
staticconstexpr
Initial value:

Specifies the default set of bond properties considered in the generation of initial bond hash codes by HashCodeCalculator::DefBondHashSeedFunction.


The documentation for this class was generated from the following file:
CDPL::Chem::AtomPropertyFlag::FORMAL_CHARGE
const unsigned int FORMAL_CHARGE
Specifies the formal charge of an atom.
Definition: Chem/AtomPropertyFlag.hpp:73
CDPL::Chem::BondPropertyFlag::AROMATICITY
const unsigned int AROMATICITY
Specifies the membership of a bond in aromatic rings.
Definition: BondPropertyFlag.hpp:73
CDPL::Chem::BondPropertyFlag::CIP_CONFIGURATION
const unsigned int CIP_CONFIGURATION
Specifies the CIP-configuration of a double bond.
Definition: BondPropertyFlag.hpp:58
CDPL::Chem::BondPropertyFlag::ORDER
const unsigned int ORDER
Specifies the order of a bond.
Definition: BondPropertyFlag.hpp:63
CDPL::Chem::BondPropertyFlag::TOPOLOGY
const unsigned int TOPOLOGY
Specifies the ring/chain topology of a bond.
Definition: BondPropertyFlag.hpp:68
CDPL::Chem::AtomPropertyFlag::TYPE
const unsigned int TYPE
Specifies the generic type or element of an atom.
Definition: Chem/AtomPropertyFlag.hpp:63
CDPL::Chem::AtomPropertyFlag::ISOTOPE
const unsigned int ISOTOPE
Specifies the isotopic mass of an atom.
Definition: Chem/AtomPropertyFlag.hpp:68
CDPL::Chem::AtomPropertyFlag::CIP_CONFIGURATION
const unsigned int CIP_CONFIGURATION
Specifies the CIP-configuration of a chiral atom.
Definition: Chem/AtomPropertyFlag.hpp:58
CDPL::Chem::AtomPropertyFlag::AROMATICITY
const unsigned int AROMATICITY
Specifies the membership of an atom in aromatic rings.
Definition: Chem/AtomPropertyFlag.hpp:93
CDPL::Chem::AtomPropertyFlag::H_COUNT
const unsigned int H_COUNT
Specifies the hydrogen count of an atom.
Definition: Chem/AtomPropertyFlag.hpp:78