From 23e0e810995064c28ccd3e86ae5e6f59f700865c Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Tue, 23 Jun 2026 15:48:59 +0100 Subject: [PATCH 1/5] Serialisable is now just a plain class (with templated functions). --- src/base/serialiser.h | 36 ++++------------------------- src/classes/atom.h | 2 +- src/classes/atomType.h | 2 +- src/classes/bond.h | 2 +- src/classes/box.h | 2 +- src/classes/braggReflection.h | 4 ++-- src/classes/isotopologue.h | 2 +- src/classes/pairPotentialOverride.h | 2 +- src/classes/partialSet.h | 2 +- src/classes/potentialSet.h | 2 +- src/classes/species.h | 2 +- src/classes/speciesIntra.h | 2 +- src/classes/speciesSite.h | 2 +- src/classes/speciesSites.h | 2 +- src/classes/structure.h | 2 +- src/expression/value.h | 2 +- src/expression/variable.h | 2 +- src/main/dissolve.h | 2 +- src/math/data1D.h | 2 +- src/math/data2D.h | 2 +- src/math/function1D.h | 2 +- src/math/histogram1D.h | 2 +- src/math/history.h | 4 ++-- src/math/range.h | 2 +- src/math/rangedVector3.h | 2 +- src/math/sampledData1D.h | 2 +- src/math/sampledDouble.h | 2 +- src/math/sampledVector.h | 2 +- src/math/vector3.h | 2 +- src/math/vector3i.h | 2 +- src/nodes/edge.h | 4 ++-- src/nodes/epsr.h | 2 +- src/nodes/node.h | 2 +- src/nodes/number.h | 2 +- src/nodes/parameter.h | 2 +- src/templates/doubleKeyedMap.h | 2 +- 36 files changed, 42 insertions(+), 70 deletions(-) diff --git a/src/base/serialiser.h b/src/base/serialiser.h index b5e97b8f06..3468c24ac0 100644 --- a/src/base/serialiser.h +++ b/src/base/serialiser.h @@ -4,7 +4,6 @@ #pragma once #include - #include "templates/keyedVector.h" #include "templates/orderedMap.h" #include "templates/resolvableKeyedVector.h" @@ -19,43 +18,16 @@ using SerialisedValue = toml::basic_value concept serialisablePointer = requires(T a, std::string tag, SerialisedValue target) { a->serialise(tag, target); }; -// The associated context for type T This type does double duty. -// First, since the struct has not actual members, it is a Unit type -// (a type with only one possible value). This is why the default -// inner type is SerialisableContext - says that we have no -// context and the type has no size. The second duty is acting as a -// type level function. Normally, you would just add an inner type to -// a class (e.g. NodeValue::Context) to perform this function. -// Unfortunately, you can't add an inner type to a primative type -// (e.g. float). By specialising this template, we can create a -// mapping between types and the context that they require. -template struct SerialisableContext -{ - using type = SerialisableContext; -}; - // An interface for classes that can be serialised into an input file -template class Serialisable +class Serialisable { public: + Serialisable() = default; + virtual ~Serialisable() = default; // Express as a serialisable value virtual void serialise(std::string tag, SerialisedValue &target) const = 0; // Read values from a serialisable value - virtual void deserialise(const SerialisedValue &node, Contexts... context) { return; } - - // When a type has only one context and that context is empty - // (i.e. is a Unit type), then we can create a simple overload - // that skips the need to add the second parameter. This does not - // conflict with the definition above because it only becomes - // instantiated when the Contexts pack is not empty, so the above - // definition of deserialise takes two parameters. We also insist - // that it is only called for empty types to ensure that we do not - // accidentally create a value with its default constructor. - template ::value && ...)>> - void deserialise(const SerialisedValue &node) - { - deserialise(node, {}); - } + virtual void deserialise(const SerialisedValue &node) { } /* Functions that hook into the toml11 library */ // Wrapper for deserialise that toml11 will check for diff --git a/src/classes/atom.h b/src/classes/atom.h index 88f748c1e1..0840e208ec 100644 --- a/src/classes/atom.h +++ b/src/classes/atom.h @@ -89,7 +89,7 @@ class AtomBase }; // Atom -template class Atom : public AtomBase, public Serialisable<> +template class Atom : public AtomBase, public Serialisable { public: Atom() = default; diff --git a/src/classes/atomType.h b/src/classes/atomType.h index 84a33105ef..c5209c3f1e 100644 --- a/src/classes/atomType.h +++ b/src/classes/atomType.h @@ -14,7 +14,7 @@ #include // AtomType Definition -class AtomType : public Serialisable<>, public std::enable_shared_from_this +class AtomType : public Serialisable, public std::enable_shared_from_this { public: AtomType(Elements::Element Z = Elements::Unknown); diff --git a/src/classes/bond.h b/src/classes/bond.h index eaa9ab057c..35cb5e809f 100644 --- a/src/classes/bond.h +++ b/src/classes/bond.h @@ -9,7 +9,7 @@ class AtomBase; // Bond -template class Bond : public Serialisable<> +template class Bond : public Serialisable { public: Bond(AtomClass *i = nullptr, AtomClass *j = nullptr) : i_(i), j_(j) {} diff --git a/src/classes/box.h b/src/classes/box.h index 8156541b12..c98c82ad6f 100644 --- a/src/classes/box.h +++ b/src/classes/box.h @@ -16,7 +16,7 @@ class Cell; class Data1D; // Basic Box Definition -class Box : public Serialisable<> +class Box : public Serialisable { public: // Box Type Enum diff --git a/src/classes/braggReflection.h b/src/classes/braggReflection.h index d1cb9352f7..5e2b16d0ce 100644 --- a/src/classes/braggReflection.h +++ b/src/classes/braggReflection.h @@ -8,7 +8,7 @@ #include "templates/array2D.h" // BraggReflection Class -class BraggReflection : public Serialisable<> +class BraggReflection : public Serialisable { public: BraggReflection(); @@ -78,7 +78,7 @@ class BraggReflection : public Serialisable<> }; // BraggReflectionVector class -class BraggReflectionVector : public Serialisable<> +class BraggReflectionVector : public Serialisable { public: BraggReflectionVector() = default; diff --git a/src/classes/isotopologue.h b/src/classes/isotopologue.h index 0f5fd4febe..706f667628 100644 --- a/src/classes/isotopologue.h +++ b/src/classes/isotopologue.h @@ -20,7 +20,7 @@ class CoreData; /* * Isotopologue Definition */ -class Isotopologue : public Serialisable<> +class Isotopologue : public Serialisable { public: Isotopologue(const Species *parent, std::string name = ""); diff --git a/src/classes/pairPotentialOverride.h b/src/classes/pairPotentialOverride.h index 7b45e49ac4..c80b707edd 100644 --- a/src/classes/pairPotentialOverride.h +++ b/src/classes/pairPotentialOverride.h @@ -9,7 +9,7 @@ #include // PairPotential Override Definition -class PairPotentialOverride : public Serialisable<> +class PairPotentialOverride : public Serialisable { public: // Override Types diff --git a/src/classes/partialSet.h b/src/classes/partialSet.h index 57a881c358..04a3ba2936 100644 --- a/src/classes/partialSet.h +++ b/src/classes/partialSet.h @@ -10,7 +10,7 @@ #include "templates/resolvable.h" // Set of Partials -class PartialSet : public Serialisable<>, ResolvableContext +class PartialSet : public Serialisable, ResolvableContext { public: PartialSet() = default; diff --git a/src/classes/potentialSet.h b/src/classes/potentialSet.h index 8fd99b02fa..893685d346 100644 --- a/src/classes/potentialSet.h +++ b/src/classes/potentialSet.h @@ -10,7 +10,7 @@ class AtomType; // Set of Potentials -class PotentialSet : public Serialisable<> +class PotentialSet : public Serialisable { public: PotentialSet(); diff --git a/src/classes/species.h b/src/classes/species.h index d7259fdce0..ff23f999fa 100644 --- a/src/classes/species.h +++ b/src/classes/species.h @@ -24,7 +24,7 @@ class CommonImproper; class Structure; // Species Definition -class Species : public Serialisable<> +class Species : public Serialisable { public: Species(std::string name = "Unnamed"); diff --git a/src/classes/speciesIntra.h b/src/classes/speciesIntra.h index 4ea00eb689..fb1dc66e93 100644 --- a/src/classes/speciesIntra.h +++ b/src/classes/speciesIntra.h @@ -14,7 +14,7 @@ class SpeciesAtom; class Species; // Base class for intramolecular interactions within Species -template class SpeciesIntra : public Serialisable<> +template class SpeciesIntra : public Serialisable { public: explicit SpeciesIntra(Species *parent, typename Functions::Form form) : parent_(parent), interactionPotential_(form) {}; diff --git a/src/classes/speciesSite.h b/src/classes/speciesSite.h index cfe31d18f3..38b28db5be 100644 --- a/src/classes/speciesSite.h +++ b/src/classes/speciesSite.h @@ -22,7 +22,7 @@ class Species; class SpeciesAtom; // Species Site Definition -class SpeciesSite : public Serialisable<> +class SpeciesSite : public Serialisable { public: // Site Type diff --git a/src/classes/speciesSites.h b/src/classes/speciesSites.h index 19765564cc..d5fe075ce3 100644 --- a/src/classes/speciesSites.h +++ b/src/classes/speciesSites.h @@ -10,7 +10,7 @@ class SpeciesSite; class Species; // SpeciesSites - Sites from one or more Species -class SpeciesSites : public Serialisable<>, ResolvableContext +class SpeciesSites : public Serialisable, ResolvableContext { public: SpeciesSites() = default; diff --git a/src/classes/structure.h b/src/classes/structure.h index 5c9c359ca3..444324fa75 100644 --- a/src/classes/structure.h +++ b/src/classes/structure.h @@ -35,7 +35,7 @@ class StructureAtom : public Atom> }; // Structure -class Structure : public Serialisable<> +class Structure : public Serialisable { public: Structure(); diff --git a/src/expression/value.h b/src/expression/value.h index ae70babab3..954b168c5f 100644 --- a/src/expression/value.h +++ b/src/expression/value.h @@ -7,7 +7,7 @@ #include // Expression Value -class ExpressionValue : public Serialisable<> +class ExpressionValue : public Serialisable { public: ExpressionValue(); diff --git a/src/expression/variable.h b/src/expression/variable.h index bfaa021194..3938bb4379 100644 --- a/src/expression/variable.h +++ b/src/expression/variable.h @@ -6,7 +6,7 @@ #include "expression/value.h" // Variable -class ExpressionVariable : public Serialisable<> +class ExpressionVariable : public Serialisable { public: ExpressionVariable(const ExpressionValue &value = ExpressionValue()); diff --git a/src/main/dissolve.h b/src/main/dissolve.h index e2f83d5bec..71e9628dcf 100644 --- a/src/main/dissolve.h +++ b/src/main/dissolve.h @@ -21,7 +21,7 @@ class Isotopologue; class Molecule; // Dissolve Main Class -class Dissolve : public Serialisable<> +class Dissolve : public Serialisable { public: Dissolve(CoreData &coreData); diff --git a/src/math/data1D.h b/src/math/data1D.h index 9473013082..6417c461b4 100644 --- a/src/math/data1D.h +++ b/src/math/data1D.h @@ -10,7 +10,7 @@ #include // One-Dimensional Data -class Data1D : public Data1DBase, public Serialisable<> +class Data1D : public Data1DBase, public Serialisable { public: Data1D(); diff --git a/src/math/data2D.h b/src/math/data2D.h index b075141d50..6bf399b6a0 100644 --- a/src/math/data2D.h +++ b/src/math/data2D.h @@ -12,7 +12,7 @@ class Histogram2D; // One-Dimensional Data -class Data2D : public Data2DBase, public Serialisable<> +class Data2D : public Data2DBase, public Serialisable { public: Data2D(); diff --git a/src/math/function1D.h b/src/math/function1D.h index 646a9a193b..b198a25043 100644 --- a/src/math/function1D.h +++ b/src/math/function1D.h @@ -111,7 +111,7 @@ class Functions1D }; // Function 1D Wrapper -class Function1DWrapper : public Serialisable<> +class Function1DWrapper : public Serialisable { public: Function1DWrapper(Functions1D::Form form = Functions1D::Form::None, const std::vector ¶ms = {}); diff --git a/src/math/histogram1D.h b/src/math/histogram1D.h index a8a06ecce6..6328ffed1f 100644 --- a/src/math/histogram1D.h +++ b/src/math/histogram1D.h @@ -7,7 +7,7 @@ #include "math/sampledDouble.h" // One-Dimensional Histogram -class Histogram1D : public Serialisable<> +class Histogram1D : public Serialisable { public: Histogram1D(); diff --git a/src/math/history.h b/src/math/history.h index d557824d7c..fe48fd65e9 100644 --- a/src/math/history.h +++ b/src/math/history.h @@ -11,7 +11,7 @@ // Serialisable Data History // Requires that the template class T is itself a Serialisable and implements the += and * operators -template class History : public Serialisable<> +template class History : public Serialisable { public: History(std::function initialiser = {}) : initialiser_(std::move(initialiser)) {} @@ -75,7 +75,7 @@ template class History : public Serialisable<> // Serialisable POD Data History // History for PODs, e.g. double, int -template class PODHistory : public Serialisable<> +template class PODHistory : public Serialisable { private: // Stored historical data diff --git a/src/math/range.h b/src/math/range.h index a081cbe8ea..65c7f22f4d 100644 --- a/src/math/range.h +++ b/src/math/range.h @@ -8,7 +8,7 @@ #include // Range -class Range : public Serialisable<> +class Range : public Serialisable { public: Range(std::optional minimum = std::nullopt, std::optional maximum = std::nullopt); diff --git a/src/math/rangedVector3.h b/src/math/rangedVector3.h index 08d55e6b65..8c0c051a3d 100644 --- a/src/math/rangedVector3.h +++ b/src/math/rangedVector3.h @@ -8,7 +8,7 @@ #include // Ranged Vector3 -class RangedVector3 : public Serialisable<> +class RangedVector3 : public Serialisable { public: RangedVector3() = default; diff --git a/src/math/sampledData1D.h b/src/math/sampledData1D.h index 1ffd9c730d..30c59f928c 100644 --- a/src/math/sampledData1D.h +++ b/src/math/sampledData1D.h @@ -13,7 +13,7 @@ class Data1D; // One-Dimensional Data with Statistics -class SampledData1D : public Data1DBase, public Serialisable<> +class SampledData1D : public Data1DBase, public Serialisable { public: SampledData1D(); diff --git a/src/math/sampledDouble.h b/src/math/sampledDouble.h index 06fd6f3db3..bd2fb6bcfe 100644 --- a/src/math/sampledDouble.h +++ b/src/math/sampledDouble.h @@ -11,7 +11,7 @@ class LineParser; class ProcessPool; // Double value with sampling -class SampledDouble : public Serialisable<> +class SampledDouble : public Serialisable { public: SampledDouble(); diff --git a/src/math/sampledVector.h b/src/math/sampledVector.h index 3f3101192a..a9a6484683 100644 --- a/src/math/sampledVector.h +++ b/src/math/sampledVector.h @@ -11,7 +11,7 @@ class CoreData; class LineParser; // Vector of double values with sampling -class SampledVector : public Serialisable<> +class SampledVector : public Serialisable { public: SampledVector(); diff --git a/src/math/vector3.h b/src/math/vector3.h index 377c60b0e2..6839ad0900 100644 --- a/src/math/vector3.h +++ b/src/math/vector3.h @@ -9,7 +9,7 @@ #include // 3D Real Vector -class Vector3 : public Serialisable<> +class Vector3 : public Serialisable { public: Vector3() = default; diff --git a/src/math/vector3i.h b/src/math/vector3i.h index 524a308e92..5b3316dd73 100644 --- a/src/math/vector3i.h +++ b/src/math/vector3i.h @@ -12,7 +12,7 @@ class NodeValue; class ExpressionVariable; // 3D Real Vector -class Vector3i : public Serialisable<> +class Vector3i : public Serialisable { public: Vector3i() = default; diff --git a/src/nodes/edge.h b/src/nodes/edge.h index dcb21ac37d..4d69360cf8 100644 --- a/src/nodes/edge.h +++ b/src/nodes/edge.h @@ -12,7 +12,7 @@ class Graph; // Edge Definition -class EdgeDefinition : public Serialisable<> +class EdgeDefinition : public Serialisable { public: EdgeDefinition() = default; @@ -29,7 +29,7 @@ class EdgeDefinition : public Serialisable<> }; // Edge -class Edge : public Serialisable<> +class Edge : public Serialisable { friend class LoopEdge; diff --git a/src/nodes/epsr.h b/src/nodes/epsr.h index 8802fb10ee..d23f9b9e2c 100644 --- a/src/nodes/epsr.h +++ b/src/nodes/epsr.h @@ -18,7 +18,7 @@ class AtomType; class PartialSet; -class EPSRNamedTargetWeights : public Serialisable<> +class EPSRNamedTargetWeights : public Serialisable { public: EPSRNamedTargetWeights() = default; diff --git a/src/nodes/node.h b/src/nodes/node.h index 662256b2b9..6708a4d5ad 100644 --- a/src/nodes/node.h +++ b/src/nodes/node.h @@ -24,7 +24,7 @@ class DissolveGraph; class PairPotential; // Node Base -class Node : public Serialisable<> +class Node : public Serialisable { public: Node() {} diff --git a/src/nodes/number.h b/src/nodes/number.h index 2c6e64ba72..13bc9ff32c 100644 --- a/src/nodes/number.h +++ b/src/nodes/number.h @@ -8,7 +8,7 @@ #include // Node Number -class Number : public Serialisable<> +class Number : public Serialisable { public: using NumberVariant = std::variant; diff --git a/src/nodes/parameter.h b/src/nodes/parameter.h index 805a118ce3..c50b71b7ea 100644 --- a/src/nodes/parameter.h +++ b/src/nodes/parameter.h @@ -39,7 +39,7 @@ struct ParameterLink }; // Base type for all parameter templates to inherit from -class ParameterBase : public Serialisable<> +class ParameterBase : public Serialisable { public: ParameterBase(Node *parent, std::string_view name, std::string_view description, std::type_index storedDataType); diff --git a/src/templates/doubleKeyedMap.h b/src/templates/doubleKeyedMap.h index 644cd78fba..d0cfa17571 100644 --- a/src/templates/doubleKeyedMap.h +++ b/src/templates/doubleKeyedMap.h @@ -17,7 +17,7 @@ * removing the critical dependence of an immutably ordered vector of AtomTypes. */ using DoubleKeyedMapKey = std::pair; -template class DoubleKeyedMap : public Serialisable<> +template class DoubleKeyedMap : public Serialisable { public: DoubleKeyedMap(bool mirrored = false) : mirroredAreEquivalent_(mirrored) {} From d5fda3b2f202159129b8fc1eb4c16b5116b20fd6 Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Tue, 23 Jun 2026 16:01:39 +0100 Subject: [PATCH 2/5] Remove CoreData from deserialise()rs. --- src/classes/configuration.cpp | 2 +- src/classes/configuration.h | 4 +-- src/classes/isotopologueSet.cpp | 2 +- src/classes/isotopologueSet.h | 4 +-- src/classes/pairPotential.h | 2 +- src/keywords/base.h | 4 +-- src/keywords/bool.cpp | 2 +- src/keywords/bool.h | 2 +- src/keywords/configuration.cpp | 5 +-- src/keywords/configuration.h | 2 +- src/keywords/configurationVector.cpp | 37 +++++++++++---------- src/keywords/configurationVector.h | 2 +- src/keywords/double.cpp | 2 +- src/keywords/double.h | 2 +- src/keywords/enumOptions.h | 2 +- src/keywords/expression.cpp | 2 +- src/keywords/expression.h | 2 +- src/keywords/function1D.cpp | 2 +- src/keywords/function1D.h | 2 +- src/keywords/integer.cpp | 2 +- src/keywords/integer.h | 2 +- src/keywords/isotopologueSet.cpp | 2 +- src/keywords/isotopologueSet.h | 2 +- src/keywords/optionalDouble.cpp | 2 +- src/keywords/optionalDouble.h | 2 +- src/keywords/optionalInt.cpp | 2 +- src/keywords/optionalInt.h | 2 +- src/keywords/range.cpp | 2 +- src/keywords/range.h | 2 +- src/keywords/rangeVector.cpp | 2 +- src/keywords/rangeVector.h | 2 +- src/keywords/species.cpp | 5 +-- src/keywords/species.h | 2 +- src/keywords/speciesSite.cpp | 49 ++++++++++++++-------------- src/keywords/speciesSite.h | 2 +- src/keywords/speciesSiteVector.cpp | 2 +- src/keywords/speciesSiteVector.h | 2 +- src/keywords/speciesVector.cpp | 23 ++++++------- src/keywords/speciesVector.h | 2 +- src/keywords/stdString.cpp | 2 +- src/keywords/stdString.h | 2 +- src/keywords/store.cpp | 4 +-- src/keywords/store.h | 2 +- src/keywords/vec3Double.cpp | 2 +- src/keywords/vec3Double.h | 2 +- src/keywords/vec3Integer.cpp | 2 +- src/keywords/vec3Integer.h | 2 +- src/nodes/serialisableData.h | 16 ++++----- 48 files changed, 116 insertions(+), 111 deletions(-) diff --git a/src/classes/configuration.cpp b/src/classes/configuration.cpp index c16e5e8d52..9c933ddce6 100644 --- a/src/classes/configuration.cpp +++ b/src/classes/configuration.cpp @@ -62,7 +62,7 @@ void Configuration::serialise(std::string tag, SerialisedValue &target) const } // Read values from a serialisable value -void Configuration::deserialise(const SerialisedValue &node, const CoreData &data) +void Configuration::deserialise(const SerialisedValue &node) { setTemperature(toml::find_or(node, "temperature", defaultTemperature_)); requestedSizeFactor_ = toml::find_or(node, "sizeFactor", defaultSizeFactor_); diff --git a/src/classes/configuration.h b/src/classes/configuration.h index da491da7cd..7b96683b84 100644 --- a/src/classes/configuration.h +++ b/src/classes/configuration.h @@ -23,7 +23,7 @@ class ProcessPool; class Species; // Configuration -class Configuration : public Serialisable +class Configuration : public Serialisable { public: Configuration(); @@ -252,5 +252,5 @@ class Configuration : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &data) override; + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/classes/isotopologueSet.cpp b/src/classes/isotopologueSet.cpp index 110e4abcc8..ed5b90d1fb 100644 --- a/src/classes/isotopologueSet.cpp +++ b/src/classes/isotopologueSet.cpp @@ -102,7 +102,7 @@ void IsotopologueSet::serialise(std::string tag, SerialisedValue &target) const } // Read values from a serialisable value -void IsotopologueSet::deserialise(const SerialisedValue &node, const CoreData &coreData) +void IsotopologueSet::deserialise(const SerialisedValue &node) { clear(); diff --git a/src/classes/isotopologueSet.h b/src/classes/isotopologueSet.h index b0040d271e..8f29de028f 100644 --- a/src/classes/isotopologueSet.h +++ b/src/classes/isotopologueSet.h @@ -12,7 +12,7 @@ class Isotopologue; class LineParser; // IsotopologueSet - Isotopologues for one or more Species -class IsotopologueSet : public Serialisable, ResolvableContext +class IsotopologueSet : public Serialisable, ResolvableContext { public: IsotopologueSet() = default; @@ -54,7 +54,7 @@ class IsotopologueSet : public Serialisable, ResolvableContext // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; // Resolve internal resolvable name references with supplied data void resolve(const std::map &speciesInScope) override; }; diff --git a/src/classes/pairPotential.h b/src/classes/pairPotential.h index 42dfdffa4c..1d237efc5a 100644 --- a/src/classes/pairPotential.h +++ b/src/classes/pairPotential.h @@ -13,7 +13,7 @@ class AtomType; // PairPotential Definition -class PairPotential : Serialisable<> +class PairPotential : public Serialisable { public: PairPotential(std::string_view nameI = {}, std::string_view nameJ = {}); diff --git a/src/keywords/base.h b/src/keywords/base.h index 6673dd1435..ea7142dbb8 100644 --- a/src/keywords/base.h +++ b/src/keywords/base.h @@ -24,7 +24,7 @@ class Species; class SpeciesSite; // Keyword Base Class -class KeywordBase : public Serialisable +class KeywordBase : public Serialisable { public: KeywordBase(const std::type_index typeIndex); @@ -72,7 +72,7 @@ class KeywordBase : public Serialisable // Express as a serialisable value virtual void serialise(std::string tag, SerialisedValue &target) const override = 0; // Read values from a serialisable value - virtual void deserialise(const SerialisedValue &node, const CoreData &coreData) override {}; + virtual void deserialise(const SerialisedValue &node) override {}; /* * Keyword Types diff --git a/src/keywords/bool.cpp b/src/keywords/bool.cpp index 75aba6a5d7..ffe542e56d 100644 --- a/src/keywords/bool.cpp +++ b/src/keywords/bool.cpp @@ -56,4 +56,4 @@ bool BoolKeyword::serialise(LineParser &parser, std::string_view keywordName, st void BoolKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_; } // Read values from a serialisable value -void BoolKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) { data_ = node.as_boolean(); } +void BoolKeyword::deserialise(const SerialisedValue &node) { data_ = node.as_boolean(); } diff --git a/src/keywords/bool.h b/src/keywords/bool.h index 3b84faa3f4..ef2f3a40b5 100644 --- a/src/keywords/bool.h +++ b/src/keywords/bool.h @@ -42,5 +42,5 @@ class BoolKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/keywords/configuration.cpp b/src/keywords/configuration.cpp index 49a30b127a..822166c4f2 100644 --- a/src/keywords/configuration.cpp +++ b/src/keywords/configuration.cpp @@ -61,7 +61,8 @@ void ConfigurationKeyword::serialise(std::string tag, SerialisedValue &target) c } // Read values from a serialisable value -void ConfigurationKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void ConfigurationKeyword::deserialise(const SerialisedValue &node) { - data_ = coreData.findConfiguration(std::string_view(std::string(node.as_string()))); + // TODO DISSOLVE2 Broken, but to be removed anyway. + // data_ = coreData.findConfiguration(std::string_view(std::string(node.as_string()))); } diff --git a/src/keywords/configuration.h b/src/keywords/configuration.h index 2d83850fb3..2cae8fade3 100644 --- a/src/keywords/configuration.h +++ b/src/keywords/configuration.h @@ -38,7 +38,7 @@ class ConfigurationKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; /* * Object Management diff --git a/src/keywords/configurationVector.cpp b/src/keywords/configurationVector.cpp index a391976534..22f39bbe75 100644 --- a/src/keywords/configurationVector.cpp +++ b/src/keywords/configurationVector.cpp @@ -75,25 +75,26 @@ void ConfigurationVectorKeyword::serialise(std::string tag, SerialisedValue &tar } // Read values from a serialisable value -void ConfigurationVectorKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void ConfigurationVectorKeyword::deserialise(const SerialisedValue &node) { - toVector(node, - [&coreData, this](const auto &name) - { - auto *cfg = coreData.findConfiguration(std::string_view(std::string(name.as_string()))); - if (!cfg) - throw toml::type_error( - std::format("Error defining Configuration targets - no Configuration named '{}' exists.\n", - std::string(name.as_string())), - name.location()); - - // Check that the configuration isn't already present - if (std::find(data_.begin(), data_.end(), cfg) != data_.end()) - throw toml::type_error(std::format("Configuration '{}' has already been referenced.\n", cfg->name()), - name.location()); - - data_.push_back(cfg); - }); + // TODO DISSOLVE2 Broken, but to be removed anyway. + // toVector(node, + // [&coreData, this](const auto &name) + // { + // auto *cfg = coreData.findConfiguration(std::string_view(std::string(name.as_string()))); + // if (!cfg) + // throw toml::type_error( + // std::format("Error defining Configuration targets - no Configuration named '{}' exists.\n", + // std::string(name.as_string())), + // name.location()); + // + // // Check that the configuration isn't already present + // if (std::find(data_.begin(), data_.end(), cfg) != data_.end()) + // throw toml::type_error(std::format("Configuration '{}' has already been referenced.\n", cfg->name()), + // name.location()); + // + // data_.push_back(cfg); + // }); } // Has not changed from initial value diff --git a/src/keywords/configurationVector.h b/src/keywords/configurationVector.h index f492f521b2..d868776c2a 100644 --- a/src/keywords/configurationVector.h +++ b/src/keywords/configurationVector.h @@ -49,7 +49,7 @@ class ConfigurationVectorKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; // Has not changed from initial value bool isDefault() const override; }; diff --git a/src/keywords/double.cpp b/src/keywords/double.cpp index de9ac5559d..3155023bc5 100644 --- a/src/keywords/double.cpp +++ b/src/keywords/double.cpp @@ -77,7 +77,7 @@ bool DoubleKeyword::serialise(LineParser &parser, std::string_view keywordName, void DoubleKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_; } // Read values from a serialisable value -void DoubleKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) { data_ = toml::get(node); } +void DoubleKeyword::deserialise(const SerialisedValue &node) { data_ = toml::get(node); } // Has not changed from initial value bool DoubleKeyword::isDefault() const { return data_ == default_; } diff --git a/src/keywords/double.h b/src/keywords/double.h index 320bbf7945..0cac7fb7c0 100644 --- a/src/keywords/double.h +++ b/src/keywords/double.h @@ -50,5 +50,5 @@ class DoubleKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/keywords/enumOptions.h b/src/keywords/enumOptions.h index 9c70ee0150..578495634f 100644 --- a/src/keywords/enumOptions.h +++ b/src/keywords/enumOptions.h @@ -113,5 +113,5 @@ template class EnumOptionsKeyword : public EnumOptionsBaseKeyword // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override { target[tag] = optionData_.keyword(data_); } // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override { data_ = optionData_.deserialise(node); } + void deserialise(const SerialisedValue &node) override { data_ = optionData_.deserialise(node); } }; diff --git a/src/keywords/expression.cpp b/src/keywords/expression.cpp index 8c16dae7d1..0b52a7baa1 100644 --- a/src/keywords/expression.cpp +++ b/src/keywords/expression.cpp @@ -43,7 +43,7 @@ bool ExpressionKeyword::serialise(LineParser &parser, std::string_view keywordNa void ExpressionKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_.expressionString(); } // Read values from a serialisable value -void ExpressionKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void ExpressionKeyword::deserialise(const SerialisedValue &node) { setData(std::string_view(std::string(node.as_string()))); } diff --git a/src/keywords/expression.h b/src/keywords/expression.h index b24d66b731..fc3bd070d3 100644 --- a/src/keywords/expression.h +++ b/src/keywords/expression.h @@ -44,5 +44,5 @@ class ExpressionKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/keywords/function1D.cpp b/src/keywords/function1D.cpp index 73fd13df82..182033a8fc 100644 --- a/src/keywords/function1D.cpp +++ b/src/keywords/function1D.cpp @@ -68,7 +68,7 @@ void Function1DKeyword::serialise(std::string tag, SerialisedValue &target) cons } // Read values from a serialisable value -void Function1DKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void Function1DKeyword::deserialise(const SerialisedValue &node) { data_.setFormAndParameters(Functions1D::forms().deserialise(node.at("type")), toml::find>(node, "parameters")); diff --git a/src/keywords/function1D.h b/src/keywords/function1D.h index f10d7cd591..39a0ffc81f 100644 --- a/src/keywords/function1D.h +++ b/src/keywords/function1D.h @@ -43,5 +43,5 @@ class Function1DKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/keywords/integer.cpp b/src/keywords/integer.cpp index d3bac41589..ce2e4b3994 100644 --- a/src/keywords/integer.cpp +++ b/src/keywords/integer.cpp @@ -77,7 +77,7 @@ bool IntegerKeyword::serialise(LineParser &parser, std::string_view keywordName, void IntegerKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_; } // Read values from a serialisable value -void IntegerKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) { data_ = node.as_integer(); } +void IntegerKeyword::deserialise(const SerialisedValue &node) { data_ = node.as_integer(); } // Has not changed from initial value bool IntegerKeyword::isDefault() const { return data_ == default_; } diff --git a/src/keywords/integer.h b/src/keywords/integer.h index 7248a06bff..9de3a2d449 100644 --- a/src/keywords/integer.h +++ b/src/keywords/integer.h @@ -47,7 +47,7 @@ class IntegerKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; // Has not changed from initial value bool isDefault() const override; }; diff --git a/src/keywords/isotopologueSet.cpp b/src/keywords/isotopologueSet.cpp index 699ebd3e8d..24517273aa 100644 --- a/src/keywords/isotopologueSet.cpp +++ b/src/keywords/isotopologueSet.cpp @@ -80,7 +80,7 @@ void IsotopologueSetKeyword::removeReferencesTo(Isotopologue *iso) { data_.remov void IsotopologueSetKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_; } // Read values from a serialisable value -void IsotopologueSetKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void IsotopologueSetKeyword::deserialise(const SerialisedValue &node) { data_.deserialise(node, coreData); } diff --git a/src/keywords/isotopologueSet.h b/src/keywords/isotopologueSet.h index 2a90960f48..0a7f760ebe 100644 --- a/src/keywords/isotopologueSet.h +++ b/src/keywords/isotopologueSet.h @@ -17,7 +17,7 @@ class IsotopologueSetKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; /* * Data diff --git a/src/keywords/optionalDouble.cpp b/src/keywords/optionalDouble.cpp index 398a3c14c5..71c8147a4e 100644 --- a/src/keywords/optionalDouble.cpp +++ b/src/keywords/optionalDouble.cpp @@ -97,7 +97,7 @@ void OptionalDoubleKeyword::serialise(std::string tag, SerialisedValue &target) } // Read values from a serialisable value -void OptionalDoubleKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void OptionalDoubleKeyword::deserialise(const SerialisedValue &node) { setData(toml::get(node)); } diff --git a/src/keywords/optionalDouble.h b/src/keywords/optionalDouble.h index a3406665cb..af543cd31a 100644 --- a/src/keywords/optionalDouble.h +++ b/src/keywords/optionalDouble.h @@ -56,7 +56,7 @@ class OptionalDoubleKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; // Has not changed from initial value bool isDefault() const override; }; diff --git a/src/keywords/optionalInt.cpp b/src/keywords/optionalInt.cpp index aef8266c5c..0065b656a2 100644 --- a/src/keywords/optionalInt.cpp +++ b/src/keywords/optionalInt.cpp @@ -97,7 +97,7 @@ void OptionalIntegerKeyword::serialise(std::string tag, SerialisedValue &target) } // Read values from a serialisable value -void OptionalIntegerKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void OptionalIntegerKeyword::deserialise(const SerialisedValue &node) { setData(toml::get(node)); } diff --git a/src/keywords/optionalInt.h b/src/keywords/optionalInt.h index 02f838536d..3be20dc0a5 100644 --- a/src/keywords/optionalInt.h +++ b/src/keywords/optionalInt.h @@ -56,5 +56,5 @@ class OptionalIntegerKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/keywords/range.cpp b/src/keywords/range.cpp index 6072632064..934c0b7ac2 100644 --- a/src/keywords/range.cpp +++ b/src/keywords/range.cpp @@ -115,7 +115,7 @@ bool RangeKeyword::serialise(LineParser &parser, std::string_view keywordName, s void RangeKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_; } // Read values from a serialisable value -void RangeKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) { data_.deserialise(node); } +void RangeKeyword::deserialise(const SerialisedValue &node) { data_.deserialise(node); } // Has not changed from initial value bool RangeKeyword::isDefault() const { return data_ == default_; } diff --git a/src/keywords/range.h b/src/keywords/range.h index 6c544239bd..ece196ba7d 100644 --- a/src/keywords/range.h +++ b/src/keywords/range.h @@ -61,7 +61,7 @@ class RangeKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; // Has not changed from initial value bool isDefault() const override; }; diff --git a/src/keywords/rangeVector.cpp b/src/keywords/rangeVector.cpp index 996f0bff01..13f722a665 100644 --- a/src/keywords/rangeVector.cpp +++ b/src/keywords/rangeVector.cpp @@ -69,7 +69,7 @@ void RangeVectorKeyword::serialise(std::string tag, SerialisedValue &target) con } // Read values from a serialisable value -void RangeVectorKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void RangeVectorKeyword::deserialise(const SerialisedValue &node) { toVector(node, [this](const auto &item) { data_.emplace_back(toml::find(item, "min"), toml::find(item, "max")); }); diff --git a/src/keywords/rangeVector.h b/src/keywords/rangeVector.h index 0d12601889..57588b74cc 100644 --- a/src/keywords/rangeVector.h +++ b/src/keywords/rangeVector.h @@ -40,7 +40,7 @@ class RangeVectorKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; // Has not changed from initial value bool isDefault() const override; }; diff --git a/src/keywords/species.cpp b/src/keywords/species.cpp index f534146e7e..3e0a98804f 100644 --- a/src/keywords/species.cpp +++ b/src/keywords/species.cpp @@ -56,7 +56,8 @@ void SpeciesKeyword::removeReferencesTo(Species *sp) void SpeciesKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_->name(); } // Read values from a serialisable value -void SpeciesKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void SpeciesKeyword::deserialise(const SerialisedValue &node) { - data_ = coreData.findSpecies(DissolveSys::niceName(std::string(node.as_string()))); + // TODO DISSOLVE2 Broken, but to be removed anyway. + // data_ = coreData.findSpecies(DissolveSys::niceName(std::string(node.as_string()))); } diff --git a/src/keywords/species.h b/src/keywords/species.h index c5e36e06db..c283f9f6ef 100644 --- a/src/keywords/species.h +++ b/src/keywords/species.h @@ -38,7 +38,7 @@ class SpeciesKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; /* * Object Management diff --git a/src/keywords/speciesSite.cpp b/src/keywords/speciesSite.cpp index 6ca12a4e0f..75fa305582 100644 --- a/src/keywords/speciesSite.cpp +++ b/src/keywords/speciesSite.cpp @@ -94,29 +94,30 @@ void SpeciesSiteKeyword::serialise(std::string tag, SerialisedValue &target) con } // Read values from a serialisable value -void SpeciesSiteKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void SpeciesSiteKeyword::deserialise(const SerialisedValue &node) { - KeywordBase::deserialise(node, coreData); - std::string species = toml::find(node, "species"); - std::string site = toml::find(node, "site"); - // Find target Species (first argument) - Species *sp = coreData.findSpecies(species); - if (!sp) - { - throw toml::type_error(std::format("Error setting SpeciesSite - no Species named '{}' exists.\n", species), - node.location()); - } - - // Find specified Site (second argument) in the Species - data_ = sp->findSite(site); - if (!data_) - throw toml::type_error( - std::format("Error setting SpeciesSite - no such site named '{}' exists in Species '{}'.\n", site, sp->name()), - node.location()); - - if (axesRequired_ && (!data_->hasAxes())) - throw toml::type_error( - std::format("Can't select site '{}' for keyword '{}', as the keyword requires axes specifications to be present.\n", - data_->name(), name()), - node.location()); + // TODO DISSOLVE2 Broken, but to be removed anyway. + // KeywordBase::deserialise(node, coreData); + // std::string species = toml::find(node, "species"); + // std::string site = toml::find(node, "site"); + // // Find target Species (first argument) + // Species *sp = coreData.findSpecies(species); + // if (!sp) + // { + // throw toml::type_error(std::format("Error setting SpeciesSite - no Species named '{}' exists.\n", species), + // node.location()); + // } + // + // // Find specified Site (second argument) in the Species + // data_ = sp->findSite(site); + // if (!data_) + // throw toml::type_error( + // std::format("Error setting SpeciesSite - no such site named '{}' exists in Species '{}'.\n", site, sp->name()), + // node.location()); + // + // if (axesRequired_ && (!data_->hasAxes())) + // throw toml::type_error( + // std::format("Can't select site '{}' for keyword '{}', as the keyword requires axes specifications to be present.\n", + // data_->name(), name()), + // node.location()); } diff --git a/src/keywords/speciesSite.h b/src/keywords/speciesSite.h index b25cae9e64..7f40d427c0 100644 --- a/src/keywords/speciesSite.h +++ b/src/keywords/speciesSite.h @@ -46,7 +46,7 @@ class SpeciesSiteKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; /* * Object Management diff --git a/src/keywords/speciesSiteVector.cpp b/src/keywords/speciesSiteVector.cpp index 6794414119..6a22bc7aaf 100644 --- a/src/keywords/speciesSiteVector.cpp +++ b/src/keywords/speciesSiteVector.cpp @@ -104,7 +104,7 @@ void SpeciesSiteVectorKeyword::serialise(std::string tag, SerialisedValue &targe } // Read values from a serialisable value -void SpeciesSiteVectorKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void SpeciesSiteVectorKeyword::deserialise(const SerialisedValue &node) { toVector(node, [this, &coreData](const auto &item) diff --git a/src/keywords/speciesSiteVector.h b/src/keywords/speciesSiteVector.h index 7590490ee0..527613f81e 100644 --- a/src/keywords/speciesSiteVector.h +++ b/src/keywords/speciesSiteVector.h @@ -57,7 +57,7 @@ class SpeciesSiteVectorKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; // Has not changed from initial value bool isDefault() const override; }; diff --git a/src/keywords/speciesVector.cpp b/src/keywords/speciesVector.cpp index f8e8b7e421..6f5b1541fc 100644 --- a/src/keywords/speciesVector.cpp +++ b/src/keywords/speciesVector.cpp @@ -68,18 +68,19 @@ void SpeciesVectorKeyword::serialise(std::string tag, SerialisedValue &target) c } // Read values from a serialisable value -void SpeciesVectorKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) +void SpeciesVectorKeyword::deserialise(const SerialisedValue &node) { - toVector(node, - [&coreData, this](const auto &item) - { - auto title = toml::get(item); - auto *species = coreData.findSpecies(title); - if (!species) - throw toml::type_error(std::format("No Species named '{}' exists.\n", title), item.location()); - - data_.push_back(species); - }); + // TODO DISSOLVE2 Broken, but to be removed anyway. + // toVector(node, + // [&coreData, this](const auto &item) + // { + // auto title = toml::get(item); + // auto *species = coreData.findSpecies(title); + // if (!species) + // throw toml::type_error(std::format("No Species named '{}' exists.\n", title), item.location()); + // + // data_.push_back(species); + // }); } // Has not changed from initial value diff --git a/src/keywords/speciesVector.h b/src/keywords/speciesVector.h index f74b387e0b..a8d07d5924 100644 --- a/src/keywords/speciesVector.h +++ b/src/keywords/speciesVector.h @@ -47,7 +47,7 @@ class SpeciesVectorKeyword : public KeywordBase public: // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; // Has not changed from initial value bool isDefault() const override; // Express as a serialisable value diff --git a/src/keywords/stdString.cpp b/src/keywords/stdString.cpp index 3417c3fad2..6d58d5e580 100644 --- a/src/keywords/stdString.cpp +++ b/src/keywords/stdString.cpp @@ -42,7 +42,7 @@ bool StringKeyword::serialise(LineParser &parser, std::string_view keywordName, void StringKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_; } // Read values from a serialisable value -void StringKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) { data_ = node.as_string(); } +void StringKeyword::deserialise(const SerialisedValue &node) { data_ = node.as_string(); } // Has not changed from initial value bool StringKeyword::isDefault() const { return data_ == default_; } diff --git a/src/keywords/stdString.h b/src/keywords/stdString.h index 1a394ecffb..06dd8cb94a 100644 --- a/src/keywords/stdString.h +++ b/src/keywords/stdString.h @@ -37,7 +37,7 @@ class StringKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; // Has not changed from initial value bool isDefault() const override; }; diff --git a/src/keywords/store.cpp b/src/keywords/store.cpp index d70ce00461..717a345826 100644 --- a/src/keywords/store.cpp +++ b/src/keywords/store.cpp @@ -267,11 +267,11 @@ SerialisedValue KeywordStore::serialiseOnto(SerialisedValue node) const } // Pull keywords from entries in table -void KeywordStore::deserialiseFrom(const SerialisedValue &node, const CoreData &coreData) +void KeywordStore::deserialiseFrom(const SerialisedValue &node) { for (const auto §ion : sections_) for (const auto &group : section.groups()) for (const auto &[keyword, keywordType] : group.keywords()) if (node.contains(toml_format(keyword->name()))) - keyword->deserialise(node.at(toml_format(keyword->name())), coreData); + keyword->deserialise(node.at(toml_format(keyword->name()))); } diff --git a/src/keywords/store.h b/src/keywords/store.h index cc20d71fa6..4127e2f2af 100644 --- a/src/keywords/store.h +++ b/src/keywords/store.h @@ -265,7 +265,7 @@ class KeywordStore // Apply the terms in the keyword store to a node SerialisedValue serialiseOnto(SerialisedValue node) const; // Pull keywords from entries in table - void deserialiseFrom(const SerialisedValue &node, const CoreData &coreData); + void deserialiseFrom(const SerialisedValue &node); /* * Object Management diff --git a/src/keywords/vec3Double.cpp b/src/keywords/vec3Double.cpp index ddbbcc0b68..a501681fc6 100644 --- a/src/keywords/vec3Double.cpp +++ b/src/keywords/vec3Double.cpp @@ -104,4 +104,4 @@ bool Vec3DoubleKeyword::isDefault() const { return data_ == default_; } void Vec3DoubleKeyword::serialise(std::string tag, SerialisedValue &target) const { data_.serialise(tag, target); } // Read values from a serialisable value -void Vec3DoubleKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) { data_.deserialise(node); } +void Vec3DoubleKeyword::deserialise(const SerialisedValue &node) { data_.deserialise(node); } diff --git a/src/keywords/vec3Double.h b/src/keywords/vec3Double.h index 6c6f207c37..78244ba50d 100644 --- a/src/keywords/vec3Double.h +++ b/src/keywords/vec3Double.h @@ -68,5 +68,5 @@ class Vec3DoubleKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/keywords/vec3Integer.cpp b/src/keywords/vec3Integer.cpp index 1777b723e7..fd99dd375e 100644 --- a/src/keywords/vec3Integer.cpp +++ b/src/keywords/vec3Integer.cpp @@ -97,7 +97,7 @@ bool Vec3IntegerKeyword::serialise(LineParser &parser, std::string_view keywordN void Vec3IntegerKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_; } // Read values from a serialisable value -void Vec3IntegerKeyword::deserialise(const SerialisedValue &node, const CoreData &coreData) { data_.deserialise(node); } +void Vec3IntegerKeyword::deserialise(const SerialisedValue &node) { data_.deserialise(node); } // Has not changed from initial value bool Vec3IntegerKeyword::isDefault() const { return data_ == default_; } diff --git a/src/keywords/vec3Integer.h b/src/keywords/vec3Integer.h index 767f7e6b2d..516eec5e0a 100644 --- a/src/keywords/vec3Integer.h +++ b/src/keywords/vec3Integer.h @@ -66,5 +66,5 @@ class Vec3IntegerKeyword : public KeywordBase // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node, const CoreData &coreData) override; + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/nodes/serialisableData.h b/src/nodes/serialisableData.h index 06ee6594ef..f8a61f88e9 100644 --- a/src/nodes/serialisableData.h +++ b/src/nodes/serialisableData.h @@ -41,12 +41,12 @@ template class SerialisableClass : public SerialisableData // Optional Vector of Serialisable SerialisableClass(std::string_view key, DataClass &targetData) requires(is_optional && is_instance_of_v && - std::is_base_of_v, typename DataClass::value_type::value_type>) + std::is_base_of_v) : SerialisableData(key), data_(targetData), dataSerialiser_( [&]() { - return Serialisable::fromVector(data_.value(), + return Serialisable::fromVector(data_.value(), [&](const auto &item) { SerialisedValue outer; @@ -58,7 +58,7 @@ template class SerialisableClass : public SerialisableData [&](const SerialisedValue &value) { targetData.emplace(); - Serialisable::toVector(value, [&](const auto &node) + Serialisable::toVector(value, [&](const auto &node) { data_->emplace_back().deserialise(node); }); }), dataChecker_([&]() { return targetData.has_value() && !targetData.value().empty(); }), @@ -73,7 +73,7 @@ template class SerialisableClass : public SerialisableData } // Optional Serialisable SerialisableClass(std::string_view key, DataClass &targetData) - requires(is_optional && std::is_base_of_v, typename DataClass::value_type>) + requires(is_optional && std::is_base_of_v) : SerialisableData(key), data_(targetData), dataSerialiser_([&]() { return data_.value().into_toml(); }), dataDeserialiser_( [&](const SerialisedValue &value) @@ -92,12 +92,12 @@ template class SerialisableClass : public SerialisableData } // Vector of Serialisable SerialisableClass(std::string_view key, DataClass &targetData) - requires(is_instance_of_v && std::is_base_of_v, typename DataClass::value_type>) + requires(is_instance_of_v && std::is_base_of_v) : SerialisableData(key), data_(targetData), dataSerialiser_( [&]() { - return Serialisable::fromVector(data_, + return Serialisable::fromVector(data_, [&](const auto &item) { SerialisedValue outer; @@ -109,7 +109,7 @@ template class SerialisableClass : public SerialisableData [&](const SerialisedValue &value) { data_.clear(); - Serialisable::toVector(value, [&](const auto &node) { data_.emplace_back().deserialise(node); }); + Serialisable::toVector(value, [&](const auto &node) { data_.emplace_back().deserialise(node); }); }), dataChecker_([&]() { return !targetData.empty(); }), dataResolver_( @@ -143,7 +143,7 @@ template class SerialisableClass : public SerialisableData } // Serialisable SerialisableClass(std::string_view key, DataClass &value) - requires(std::is_base_of_v, DataClass>) + requires(std::is_base_of_v) : SerialisableData(key), data_(value), dataResolver_( [&](const std::map &reachableSpecies) { From 1f09624e143e0ed990a3437dc9abf4b87cd90f5a Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Wed, 24 Jun 2026 14:45:49 +0100 Subject: [PATCH 3/5] Tidy up the rest. --- src/base/serialiser.h | 4 +-- src/classes/isotopologueSet.cpp | 6 ---- src/keywords/expression.cpp | 5 +-- src/keywords/isotopologueSet.cpp | 5 +-- src/keywords/optionalDouble.cpp | 5 +-- src/keywords/optionalInt.cpp | 5 +-- src/keywords/speciesSite.cpp | 3 +- src/keywords/speciesSiteVector.cpp | 21 +------------ src/main/io.cpp | 2 +- src/nodes/serialisableData.h | 49 ++++++++++++++---------------- src/templates/keyedVector.h | 2 ++ 11 files changed, 35 insertions(+), 72 deletions(-) diff --git a/src/base/serialiser.h b/src/base/serialiser.h index 3468c24ac0..c1efe6ac1d 100644 --- a/src/base/serialiser.h +++ b/src/base/serialiser.h @@ -3,11 +3,11 @@ #pragma once -#include #include "templates/keyedVector.h" #include "templates/orderedMap.h" #include "templates/resolvableKeyedVector.h" #include +#include #include // The type we use for the nodes of our serialisation tree @@ -27,7 +27,7 @@ class Serialisable // Express as a serialisable value virtual void serialise(std::string tag, SerialisedValue &target) const = 0; // Read values from a serialisable value - virtual void deserialise(const SerialisedValue &node) { } + virtual void deserialise(const SerialisedValue &node) {} /* Functions that hook into the toml11 library */ // Wrapper for deserialise that toml11 will check for diff --git a/src/classes/isotopologueSet.cpp b/src/classes/isotopologueSet.cpp index ed5b90d1fb..89e20ed7b8 100644 --- a/src/classes/isotopologueSet.cpp +++ b/src/classes/isotopologueSet.cpp @@ -113,12 +113,6 @@ void IsotopologueSet::deserialise(const SerialisedValue &node) toMap(topes, [&](const std::string &isoName, const SerialisedValue &population) { set[isoName] = population.as_floating(); }); }); - - // Need to resolve species - std::map speciesMap; - for (const auto &sp : coreData.species()) - speciesMap[std::string(sp.get()->name())] = sp.get(); - resolve(speciesMap); } // Resolve internal resolvable name references with supplied data diff --git a/src/keywords/expression.cpp b/src/keywords/expression.cpp index 0b52a7baa1..ea7b5140ed 100644 --- a/src/keywords/expression.cpp +++ b/src/keywords/expression.cpp @@ -43,10 +43,7 @@ bool ExpressionKeyword::serialise(LineParser &parser, std::string_view keywordNa void ExpressionKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_.expressionString(); } // Read values from a serialisable value -void ExpressionKeyword::deserialise(const SerialisedValue &node) -{ - setData(std::string_view(std::string(node.as_string()))); -} +void ExpressionKeyword::deserialise(const SerialisedValue &node) { setData(std::string_view(std::string(node.as_string()))); } // Has not changed from initial value bool ExpressionKeyword::isDefault() const { return data_.expressionString() == default_; } diff --git a/src/keywords/isotopologueSet.cpp b/src/keywords/isotopologueSet.cpp index 24517273aa..5758eb440e 100644 --- a/src/keywords/isotopologueSet.cpp +++ b/src/keywords/isotopologueSet.cpp @@ -80,10 +80,7 @@ void IsotopologueSetKeyword::removeReferencesTo(Isotopologue *iso) { data_.remov void IsotopologueSetKeyword::serialise(std::string tag, SerialisedValue &target) const { target[tag] = data_; } // Read values from a serialisable value -void IsotopologueSetKeyword::deserialise(const SerialisedValue &node) -{ - data_.deserialise(node, coreData); -} +void IsotopologueSetKeyword::deserialise(const SerialisedValue &node) { data_.deserialise(node); } // Has not changed from initial value bool IsotopologueSetKeyword::isDefault() const { return false; } diff --git a/src/keywords/optionalDouble.cpp b/src/keywords/optionalDouble.cpp index 71c8147a4e..b6958502bf 100644 --- a/src/keywords/optionalDouble.cpp +++ b/src/keywords/optionalDouble.cpp @@ -97,10 +97,7 @@ void OptionalDoubleKeyword::serialise(std::string tag, SerialisedValue &target) } // Read values from a serialisable value -void OptionalDoubleKeyword::deserialise(const SerialisedValue &node) -{ - setData(toml::get(node)); -} +void OptionalDoubleKeyword::deserialise(const SerialisedValue &node) { setData(toml::get(node)); } // Has not changed from initial value bool OptionalDoubleKeyword::isDefault() const { return !set_ || !data_; } diff --git a/src/keywords/optionalInt.cpp b/src/keywords/optionalInt.cpp index 0065b656a2..f8cc61d1a6 100644 --- a/src/keywords/optionalInt.cpp +++ b/src/keywords/optionalInt.cpp @@ -97,7 +97,4 @@ void OptionalIntegerKeyword::serialise(std::string tag, SerialisedValue &target) } // Read values from a serialisable value -void OptionalIntegerKeyword::deserialise(const SerialisedValue &node) -{ - setData(toml::get(node)); -} +void OptionalIntegerKeyword::deserialise(const SerialisedValue &node) { setData(toml::get(node)); } diff --git a/src/keywords/speciesSite.cpp b/src/keywords/speciesSite.cpp index 75fa305582..653237eebc 100644 --- a/src/keywords/speciesSite.cpp +++ b/src/keywords/speciesSite.cpp @@ -117,7 +117,8 @@ void SpeciesSiteKeyword::deserialise(const SerialisedValue &node) // // if (axesRequired_ && (!data_->hasAxes())) // throw toml::type_error( - // std::format("Can't select site '{}' for keyword '{}', as the keyword requires axes specifications to be present.\n", + // std::format("Can't select site '{}' for keyword '{}', as the keyword requires axes specifications to be + // present.\n", // data_->name(), name()), // node.location()); } diff --git a/src/keywords/speciesSiteVector.cpp b/src/keywords/speciesSiteVector.cpp index 6a22bc7aaf..45ba7fe942 100644 --- a/src/keywords/speciesSiteVector.cpp +++ b/src/keywords/speciesSiteVector.cpp @@ -104,26 +104,7 @@ void SpeciesSiteVectorKeyword::serialise(std::string tag, SerialisedValue &targe } // Read values from a serialisable value -void SpeciesSiteVectorKeyword::deserialise(const SerialisedValue &node) -{ - toVector(node, - [this, &coreData](const auto &item) - { - auto species = coreData.findSpecies(toml::find(item, "species")); - if (species) - { - auto site = species->findSite(toml::find(item, "site")); - if (site) - data_.push_back(site); - else - throw toml::type_error(std::format("Cannot find Site {}", toml::find(item, "site")), - item.location()); - } - else - toml::type_error(std::format("Cannot find Species {}", toml::find(item, "species")), - item.location()); - }); -} +void SpeciesSiteVectorKeyword::deserialise(const SerialisedValue &node) {} // Has not changed from initial value bool SpeciesSiteVectorKeyword::isDefault() const { return data_.empty(); } diff --git a/src/main/io.cpp b/src/main/io.cpp index 29a92c8afa..71372c5a70 100644 --- a/src/main/io.cpp +++ b/src/main/io.cpp @@ -109,7 +109,7 @@ void Dissolve::deserialise(const SerialisedValue &originalNode) { auto *cfg = coreData_.addConfiguration(); cfg->setName(name); - cfg->deserialise(data, coreData_); + cfg->deserialise(data); }); } diff --git a/src/nodes/serialisableData.h b/src/nodes/serialisableData.h index f8a61f88e9..b61b2e3c81 100644 --- a/src/nodes/serialisableData.h +++ b/src/nodes/serialisableData.h @@ -42,24 +42,22 @@ template class SerialisableClass : public SerialisableData SerialisableClass(std::string_view key, DataClass &targetData) requires(is_optional && is_instance_of_v && std::is_base_of_v) - : SerialisableData(key), data_(targetData), - dataSerialiser_( - [&]() - { - return Serialisable::fromVector(data_.value(), - [&](const auto &item) - { - SerialisedValue outer; - item.serialise("inner", outer); - return outer["inner"]; - }); - }), + : SerialisableData(key), data_(targetData), dataSerialiser_( + [&]() + { + return Serialisable::fromVector(data_.value(), + [&](const auto &item) + { + SerialisedValue outer; + item.serialise("inner", outer); + return outer["inner"]; + }); + }), dataDeserialiser_( [&](const SerialisedValue &value) { targetData.emplace(); - Serialisable::toVector(value, [&](const auto &node) - { data_->emplace_back().deserialise(node); }); + Serialisable::toVector(value, [&](const auto &node) { data_->emplace_back().deserialise(node); }); }), dataChecker_([&]() { return targetData.has_value() && !targetData.value().empty(); }), dataResolver_( @@ -93,18 +91,17 @@ template class SerialisableClass : public SerialisableData // Vector of Serialisable SerialisableClass(std::string_view key, DataClass &targetData) requires(is_instance_of_v && std::is_base_of_v) - : SerialisableData(key), data_(targetData), - dataSerialiser_( - [&]() - { - return Serialisable::fromVector(data_, - [&](const auto &item) - { - SerialisedValue outer; - item.serialise("inner", outer); - return outer["inner"]; - }); - }), + : SerialisableData(key), data_(targetData), dataSerialiser_( + [&]() + { + return Serialisable::fromVector(data_, + [&](const auto &item) + { + SerialisedValue outer; + item.serialise("inner", outer); + return outer["inner"]; + }); + }), dataDeserialiser_( [&](const SerialisedValue &value) { diff --git a/src/templates/keyedVector.h b/src/templates/keyedVector.h index 8dd8c9a8fc..4f8fd37d21 100644 --- a/src/templates/keyedVector.h +++ b/src/templates/keyedVector.h @@ -3,8 +3,10 @@ #pragma once +#include #include #include +#include #include // Keyed Vector From 65a3c38d0714b840d2e527f379c6042d9efed32d Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Wed, 24 Jun 2026 14:55:18 +0100 Subject: [PATCH 4/5] Override specifiers. --- src/classes/atom.h | 4 ++-- src/classes/braggReflection.h | 4 ++-- src/classes/pairPotential.h | 2 +- src/classes/pairPotentialOverride.h | 2 +- src/classes/species.h | 2 +- src/classes/structure.h | 2 +- src/expression/variable.h | 2 +- src/math/histogram1D.h | 2 +- src/math/history.h | 4 ++-- src/math/sampledData1D.h | 2 +- src/math/sampledVector.h | 2 +- src/math/vector3.h | 2 +- src/math/vector3i.h | 2 +- src/nodes/epsr.h | 2 +- src/templates/doubleKeyedMap.h | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/classes/atom.h b/src/classes/atom.h index 0840e208ec..531b168281 100644 --- a/src/classes/atom.h +++ b/src/classes/atom.h @@ -140,12 +140,12 @@ template class Atom : public AtomBase, public Serialisable */ public: // Express as a serialisable value - void serialise(std::string tag, SerialisedValue &target) const + void serialise(std::string tag, SerialisedValue &target) const override { target[tag] = {{"index", index_}, {"z", Z_}, {"r", r_}, {"q", q_}}; } // Read values from a serialisable value - void deserialise(const SerialisedValue &node) + void deserialise(const SerialisedValue &node) override { index_ = toml::find(node, "index"); diff --git a/src/classes/braggReflection.h b/src/classes/braggReflection.h index 5e2b16d0ce..ea755c736e 100644 --- a/src/classes/braggReflection.h +++ b/src/classes/braggReflection.h @@ -74,7 +74,7 @@ class BraggReflection : public Serialisable // Write data through specified parser bool serialise(LineParser &parser) const; // Express as a serialisable value - void serialise(std::string tag, SerialisedValue &target) const; + void serialise(std::string tag, SerialisedValue &target) const override; }; // BraggReflectionVector class @@ -105,7 +105,7 @@ class BraggReflectionVector : public Serialisable */ public: // Express as a serialisable value - void serialise(std::string tag, SerialisedValue &target) const; + void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value void deserialise(const SerialisedValue &node) override; }; \ No newline at end of file diff --git a/src/classes/pairPotential.h b/src/classes/pairPotential.h index 1d237efc5a..28b57e3198 100644 --- a/src/classes/pairPotential.h +++ b/src/classes/pairPotential.h @@ -222,5 +222,5 @@ class PairPotential : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/classes/pairPotentialOverride.h b/src/classes/pairPotentialOverride.h index c80b707edd..5041936afd 100644 --- a/src/classes/pairPotentialOverride.h +++ b/src/classes/pairPotentialOverride.h @@ -58,5 +58,5 @@ class PairPotentialOverride : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/classes/species.h b/src/classes/species.h index ff23f999fa..823118604a 100644 --- a/src/classes/species.h +++ b/src/classes/species.h @@ -341,5 +341,5 @@ class Species : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/classes/structure.h b/src/classes/structure.h index 444324fa75..c5917c0af7 100644 --- a/src/classes/structure.h +++ b/src/classes/structure.h @@ -123,5 +123,5 @@ class Structure : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/expression/variable.h b/src/expression/variable.h index 3938bb4379..c9e35cad5d 100644 --- a/src/expression/variable.h +++ b/src/expression/variable.h @@ -48,5 +48,5 @@ class ExpressionVariable : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/math/histogram1D.h b/src/math/histogram1D.h index 6328ffed1f..992c3dcb26 100644 --- a/src/math/histogram1D.h +++ b/src/math/histogram1D.h @@ -97,5 +97,5 @@ class Histogram1D : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/math/history.h b/src/math/history.h index fe48fd65e9..b5ceb8b030 100644 --- a/src/math/history.h +++ b/src/math/history.h @@ -55,7 +55,7 @@ template class History : public Serialisable */ public: // Express as a serialisable value - void serialise(std::string tag, SerialisedValue &target) const + void serialise(std::string tag, SerialisedValue &target) const override { return Serialisable::fromVector(history_, tag, target, [&](const auto &itemPtr) { return itemPtr->into_toml(); }); } @@ -110,7 +110,7 @@ template class PODHistory : public Serialisable */ public: // Express as a serialisable value - void serialise(std::string tag, SerialisedValue &target) const + void serialise(std::string tag, SerialisedValue &target) const override { if (history_.empty()) return; diff --git a/src/math/sampledData1D.h b/src/math/sampledData1D.h index 30c59f928c..fcb08f17e5 100644 --- a/src/math/sampledData1D.h +++ b/src/math/sampledData1D.h @@ -93,5 +93,5 @@ class SampledData1D : public Data1DBase, public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/math/sampledVector.h b/src/math/sampledVector.h index a9a6484683..47e3939a95 100644 --- a/src/math/sampledVector.h +++ b/src/math/sampledVector.h @@ -70,5 +70,5 @@ class SampledVector : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/math/vector3.h b/src/math/vector3.h index 6839ad0900..6e842cd4ce 100644 --- a/src/math/vector3.h +++ b/src/math/vector3.h @@ -140,5 +140,5 @@ class Vector3 : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/math/vector3i.h b/src/math/vector3i.h index 5b3316dd73..90831cbf5f 100644 --- a/src/math/vector3i.h +++ b/src/math/vector3i.h @@ -115,5 +115,5 @@ class Vector3i : public Serialisable // Express as a serialisable value void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value - void deserialise(const SerialisedValue &node); + void deserialise(const SerialisedValue &node) override; }; diff --git a/src/nodes/epsr.h b/src/nodes/epsr.h index d23f9b9e2c..9ecd07c3b7 100644 --- a/src/nodes/epsr.h +++ b/src/nodes/epsr.h @@ -38,7 +38,7 @@ class EPSRNamedTargetWeights : public Serialisable */ public: // Express as a serialisable value - void serialise(std::string tag, SerialisedValue &target) const; + void serialise(std::string tag, SerialisedValue &target) const override; // Read values from a serialisable value void deserialise(const SerialisedValue &node) override; }; diff --git a/src/templates/doubleKeyedMap.h b/src/templates/doubleKeyedMap.h index d0cfa17571..b543408135 100644 --- a/src/templates/doubleKeyedMap.h +++ b/src/templates/doubleKeyedMap.h @@ -171,7 +171,7 @@ template class DoubleKeyedMap : public Serialisable target[tag] = result; }; // Read values from a serialisable value - void deserialise(const SerialisedValue &node) + void deserialise(const SerialisedValue &node) override { data_.clear(); From 6641e6f8c82b3cffd1383170cde411e8e7508ea8 Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Wed, 24 Jun 2026 16:54:45 +0100 Subject: [PATCH 5/5] Unrelated overrides. --- src/classes/atom.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/classes/atom.h b/src/classes/atom.h index 531b168281..525e14954e 100644 --- a/src/classes/atom.h +++ b/src/classes/atom.h @@ -93,7 +93,7 @@ template class Atom : public AtomBase, public Serialisable { public: Atom() = default; - virtual ~Atom() = default; + virtual ~Atom() override = default; /* * Coordinate Manipulation Operators @@ -125,9 +125,9 @@ template class Atom : public AtomBase, public Serialisable return nullptr; } // Return number of bonds - int nBonds() const { return bonds_.size(); } + int nBonds() const override { return bonds_.size(); } // Return indices of other AtomBases to which this one is connected - std::vector connectedAtoms() const + std::vector connectedAtoms() const override { std::vector connections; for (const auto *bond : bonds_)