diff base/PlayParameterRepository.h @ 1742:52705a328b34 by-id

Rejig ById so as to put everything in a single pool, so that at the core you can go from numeric id (untyped) to anything the object can be dynamic_cast to. Useful for building other abstractions like PlayParameter-type registrations that don't know about e.g. Models. Probably some more tweaking needed. Also add tests
author Chris Cannam
date Fri, 28 Jun 2019 17:36:30 +0100
parents c01cbe41aeb5
children 77543124651b
line wrap: on
line diff
--- a/base/PlayParameterRepository.h	Thu Jun 27 13:08:10 2019 +0100
+++ b/base/PlayParameterRepository.h	Fri Jun 28 17:36:30 2019 +0100
@@ -35,11 +35,37 @@
 
     virtual ~PlayParameterRepository();
 
-    void addPlayable(const Playable *playable);
-    void removePlayable(const Playable *playable);
-    void copyParameters(const Playable *from, const Playable *to);
+    /**
+     * Register a playable.
+     * 
+     * The id must be of an object that is registered with the ById
+     * store and that can be dynamic_cast to Playable.
+     */
+    void addPlayable(int playableId);
 
-    PlayParameters *getPlayParameters(const Playable *playable);
+    /**
+     * Unregister a playable.
+     * 
+     * The id must be of an object that is registered with the ById
+     * store and that can be dynamic_cast to Playable.
+     */
+    void removePlayable(int playableId);
+
+    /**
+     * Copy the play parameters from one playable to another.
+     * 
+     * The ids must be of objects that are registered with the ById
+     * store and that can be dynamic_cast to Playable.
+     */
+    void copyParameters(int fromId, int toId);
+
+    /**
+     * Retrieve the play parameters for a playable.
+     * 
+     * The id must be of an object that is registered with the ById
+     * store and that can be dynamic_cast to Playable.
+     */
+    PlayParameters *getPlayParameters(int playableId);
 
     void clear();
 
@@ -64,14 +90,14 @@
 
 signals:
     void playParametersChanged(PlayParameters *);
-    void playClipIdChanged(const Playable *, QString);
+    void playClipIdChanged(int playableId, QString);
 
 protected slots:
     void playParametersChanged();
     void playClipIdChanged(QString);
 
 protected:
-    typedef std::map<const Playable *, PlayParameters *> PlayableParameterMap;
+    typedef std::map<int, PlayParameters *> PlayableParameterMap;
     PlayableParameterMap m_playParameters;
 
     static PlayParameterRepository *m_instance;