.. _cpp-Config: ********************************************************** Config.hpp ********************************************************** .. default-domain:: cpp .. default-role:: cpp:expr .. py:currentmodule:: mod .. cpp:namespace:: mod .. _libmod-config: This file defines configuration options for the library. Many of the options control verbosity of algorithms or which data to output when printing figures. .. enum-struct:: LabelType Selector for which type of label to use in algorithms. .. enumerator:: String Vertices and edges are considered to be labelled with character strings. If only first-order terms are present, then strings are generated as a serialisation of the term. .. enumerator:: Term Vertices and edges are considered to be labelled with first-order terms. If only strings are present, then first-order terms are generated by parsing the strings. This may result in an :cpp:class:`TermParsingError` if a string can not be parsed. .. enum-struct:: LabelRelation Selector for which type of labelled morphism to use in an algorithm. .. enumerator:: Isomorphism Strings are considered isomorphic when they are equal. Terms are considered isomorphic when their most general unifier is a renaming. .. enumerator:: Specialisation A term :math:`t_2` is more special than, or isomorphic to, a term :math:`t_1` if there is a substitution which can be applied to :math:`t_1` to make the terms equal. This relation means that the right-hand side of a comparison is the more specialised term. .. enumerator:: Unification Strings unify if they are equal, i.e., the same as with :cpp:any:`Isomorphism`. Terms unify if a most general unifier (MGU) exists. The found MGU is used for substitution in some algorithms. .. class:: LabelSettings A class simply for grouping label settings. .. function:: LabelSettings(LabelType type, LabelRelation relation) Construct label settings that only uses the vertex and edge labels. .. function:: LabelSettings(LabelType type, LabelRelation relation, LabelRelation stereoRelation) Construct label settings that include both vertex and edge labels, and stereo information. .. function:: LabelSettings(LabelType type, LabelRelation relation, bool withStereo, LabelRelation stereoRelation) .. function:: friend bool operator==(LabelSettings a, LabelSettings b) friend bool operator!=(LabelSettings a, LabelSettings b) .. function:: friend std::ostream &operator<<(std::ostream &s, const LabelSettings &ls) .. member:: LabelType type .. member:: LabelRelation relation .. member:: bool withStereo .. member:: LabelRelation stereoRelation .. enum-struct:: IsomorphismPolicy For some functions there is a choice of how to handle given arguments where two different objects may be isomorphic. Most notably the case is with graphs (:class:`graph::Graph`). .. enumerator:: Check Objects are checked for isomorphism as needed and exceptions are thrown when different objects are isomorphic. If in doubt, use this. .. enumerator:: TrustMe No checks are performed and the function trusts the caller to have performed the equivalent isomorphism checks. Only use this when you are completely sure that no exceptions would have been thrown if using :enumerator:`Check`. .. warning:: Generally the library has undefined behaviour if you use this option but an exception would have been thrown with :enumerator:`Check`. .. enum-struct:: SmilesClassPolicy When loading SMILES strings, the class labels can be recorded and mapped into the corresponding vertices of the loaded graph. This policy dictates what should happen when the same class label is written on multiple atoms. .. enumerator:: NoneOnDuplicate If a class label is duplicated, then no labels are mapped to vertices. .. enumerator:: ThrowOnDuplicate If a class label is duplicated, throw a :class:`InputError`. .. enumerator:: MapUnique Map all class labels that are unique to vertices. .. enum-struct:: Action Utility enum for deciding what to do in certain cases. .. enumerator:: Error Abort the function and produce an error message, e.g., through and exception. .. enumerator:: Warn Write a warning, but otherwise do as if it was `Ignore`. .. enumerator:: Ignore Ignore the case. The function taking the action as argument should describe what this means. .. class:: MDLOptions An aggregation of options for the various loading functions for MDL formats. Generally each option is defaulted to follow the specification of the formats, unless it is harmless to deviate (e.g., relaxed white-space parsing). .. member:: bool addHydrogens = true Use the MDL valence model to add hydrogens to atoms with default valence, or disable all hydrogen addition. .. member:: bool allowAbstract = false Allow non-standard atom symbols. The standard symbols are the element symbols and those specifying wildcard atoms. .. member:: bool applyV2000AtomAliases = true In MOL V2000 CTAB blocks, replace atom labels by their aliases. After application, the atom is considered abstract without errors, and hydrogen addition is suppressed. .. member:: Action onPatternIsotope = Action::Error Action onPatternCharge = Action::Error; Action onPatternRadical = Action::Error; What to do when an atom with symbol ``*`` has an isotope, charge, or radical. `Action::Ignore` means assuming the isotope, charge, or radical was not there. .. member:: Action onImplicitValenceOnAbstract = Action::Error What to do when `addHydrogens && allowAbstract` and an abstract atom is encountered with implicit valence. `Action::Ignore` means adding no hydrogens. .. member:: Action onV2000UnhandledProperty = Action::Warn What to do when a property line in a V2000 MOL file is not recognized. `Action::Ignore` means simply ignoring that particular line. .. member:: bool fullyIgnoreV2000UnhandledKnownProperty = false Warnings are usually stored as "loading warnings", even when they are ignored during parsing. Setting this to `true` will act as if `onV2000UnhandledProperty = Action::Ignore` and skip the storage, but only for a pre-defined known subset of properties. .. member:: Action onV3000UnhandledAtomProperty = Action::Warn What to do when a property in atom line in a V3000 MOL file is not recognized. `Action::Ignore` means simply ignoring that particular property. .. member:: Action onV2000Charge4 = Action::Error What to do when an atom in a V2000 MOL file has the charge 4 (doublet radical). `Action::Ignore` means assuming it was charge 0. .. member:: Action onV2000AbstractISO = Action::Error What to do when an abstract atom in a V2000 MOL file has a non-default ISO or mass difference value. .. member:: Action onRAD1 = Action::Error Action onRAD3 = Action::Error Action onRAD4 = Action::Error Action onRAD5 = Action::Error Action onRAD6 = Action::Error What to do when an atom has assigned the indicated radical state. `Action::Ignore` means pretending the atom has no radical state assigned. .. member:: Action onUnsupportedQueryBondType = Action::Error What to do when a bond type 5, 6, or 7 are encountered (constrained query bond types). `Action::Ignore` means assigning a term variable, as if the type was 8. .. function:: Config &getConfig() :returns: the singleton :cpp:class:`Config` instance used by the library. Class ``template ConfigSetting`` -------------------------------------------------------------------------------------------------------------------------------- .. class:: template ConfigSetting Holds a single option of type :cpp:any:`T`. Synopsis ^^^^^^^^ .. alias:: template ConfigSetting :maxdepth: 2 :noroot: Details ^^^^^^^ .. cpp:namespace-push:: template ConfigSetting .. function:: void set(T value) Sets the configuration value. .. function:: T get() const :returns: The configuration value. .. function: T &operator()() Access the value. .. cpp:namespace-pop:: Class ``Config`` -------------------------------------------------------------------------------------------------------------------------------- .. class:: Config Holds all configuration settings.