Mercurial > hg > svcore
diff data/model/Model.h @ 1731:601851995f4b by-id
Introduce Model to ById
author | Chris Cannam |
---|---|
date | Fri, 21 Jun 2019 13:37:00 +0100 |
parents | 78fe29adfd16 |
children | 87b4c596c0ef |
line wrap: on
line diff
--- a/data/model/Model.h Thu Jun 20 14:57:39 2019 +0100 +++ b/data/model/Model.h Fri Jun 21 13:37:00 2019 +0100 @@ -19,6 +19,7 @@ #include <vector> #include <QObject> +#include "base/ById.h" #include "base/XmlExportable.h" #include "base/Playable.h" #include "base/BaseTypes.h" @@ -27,14 +28,12 @@ class ZoomConstraint; class AlignmentModel; -typedef int ModelId; - /** * Model is the base class for all data models that represent any sort * of data on a time scale based on an audio frame rate. */ - class Model : public QObject, + public WithId<Model>, public XmlExportable, public Playable { @@ -132,13 +131,6 @@ virtual bool isSparse() const { return false; } /** - * Return an id for this model. The id is guaranteed to be a - * unique identifier for this model among all models that may ever - * exist within this single run of the application. - */ - ModelId getId() const { return m_id; } - - /** * Mark the model as abandoning. This means that the application * no longer needs it, so it can stop doing any background * calculations it may be involved in. Note that as far as the @@ -339,7 +331,6 @@ protected: Model() : - m_id(getNextId()), m_sourceModel(0), m_alignment(0), m_abandoning(false), @@ -350,15 +341,15 @@ Model(const Model &); Model &operator=(const Model &); - const ModelId m_id; Model *m_sourceModel; AlignmentModel *m_alignment; QString m_typeUri; bool m_abandoning; bool m_aboutToDelete; sv_frame_t m_extendTo; - - int getNextId(); }; +typedef Model::Id ModelId; +typedef StaticById<Model, ModelId> ModelById; + #endif