Loopp/src/state/stately.hxx

40 lines
1.2 KiB
C++
Raw Normal View History

2013-09-03 18:29:10 +02:00
#ifndef LUPPP_STATELY_H
#define LUPPP_STATELY_H
2013-09-03 18:29:10 +02:00
/** Stately
* This class is inherited from by all classes that have state.
2013-09-03 18:29:10 +02:00
*
* save() should be overriden if the object needs to save its state
* reset() should be overriden if the object can clear its state
*
* The flexibility allows eg LooperClips to request buffers to tranfser audio
2013-09-03 18:29:10 +02:00
* data into the GUI thread for disk serialization, and scales for future
* classes which also need to request memory in order to save in a RT safe way.
**/
class Stately
2013-09-03 18:29:10 +02:00
{
public:
Stately();
2013-09-03 18:29:10 +02:00
/// this function being called resets the state of the instance to blank
virtual void reset();
2013-09-03 18:29:10 +02:00
/// this function is called when the user initiates a save action
virtual void save();
/// this function *must* be called by each sub-class when it is *finished*
/// a successful save action. Once each Stately is done, the final save is OK-ed.
static void done();
/// this function notes that a stately could *not* successfully save: buffer
/// size mismatch in LooperClip for example.
static void error();
private:
static int savesDone;
2013-09-03 18:29:10 +02:00
};
#endif // LUPPP_STATELY_H
2013-09-03 18:29:10 +02:00