Hi all,
available at this URL:
http://www.pure-data.org/Members/fbar/patches/memento-0.2.tgz/view
is that:
_ Memento _
ver. 0.2
This is a work-in-progress collection of a unified preset system for Pd patches. It tries to loosely follow the Memento [1] design pattern from the Gang of Four book.
I propose that a Memento here is realised as a directory in a data pool inside a [pool] object. Currently the pool is hardcoded to be named "RRADICAL". This could change, but maybe it doesn't need to. Inside the Memento, several numbered subfolders are created to store the actual substates.
The Memento is only changed or read through the [originator] abstraction. [originator] has two arguments:
1) the name of a Memento 2) $0
Methods of [originator]:
* create Memento-name: creates a new Memento, discards the old. * set anything: sets all variables to the values currently in the pool. For use after loading a file with the [caretaker] * substate X: Select substate X (float).
It is not allowed to bypass [originator] to change the values inside the RRADICAL pool, with one exception:
The [caretaker] abstraction is responsible for saving and loading pool data from harddisk. [caretaker] takes a filename to save and load as argument. A GUI for it is provided in [careGUI].
Methods of [caretaker]:
* file filename: sets filename to save/load. * save poolname: saves the contents of the pool named "poolname". For rradical patches poolname currently has to be "RRADICAL" * load poolname: loads the contents, same as save, but the other way around.
Communication between [originator] and anything that wants to save anything is done through the [commun] abstraction.
[commun] arguments:
1) the name of a variable ("key") 2) $0
[commun] accepts anything and spits out anything if [originator] tells it too (with [originator]'s "set" message).
Both $0 arguments above are mandatory to keep Memento reusable, which is the first goal all in RRADical patches.
_ Usage _
Every abstraction, that wants to take part in saving its settings with Memento needs to: 1) include an [originator Memento $0] objects 2) cross-wrap all variables with [commun id $0] objects. Because of a bug, for wrapping symbols a [symbol] objects has to be added after [commun]'s outlet.
Example patches are mainpatch.pd and listsymbol.pd
A single [caretaker] or [careGUI] in the parent patch then can save and reload settings in the pool to disk.
_ ChangeLog _
0.1 * Initial release
0.2 * Use numbered subfolders as states * More examples, careGUI.pd
_ Bugs _
* Plenty.
* [glue] strips off type identifiers like "symbol", so you currently have to take care of types yourself. Only lists and floats work out of the box currently.
* THe "API" is is bound to change.
_ License _
Undecided, probably GPL, but for sure Open Source (tm)
Comments highly welcome at pd-list or pd-dev.
ciao