diff options
author | David Robillard <d@drobilla.net> | 2006-09-30 06:47:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-09-30 06:47:00 +0000 |
commit | 35a5d92cfcf6815553a0939c3e2bf77c1108fd31 (patch) | |
tree | 456351b4b18d48aba25a2db7218df9be09d4047e /src/progs/ingenuity/Loader.cpp | |
parent | d82dcd232f201b531a0be165ee44aede1bc8a1df (diff) | |
download | ingen-35a5d92cfcf6815553a0939c3e2bf77c1108fd31.tar.gz ingen-35a5d92cfcf6815553a0939c3e2bf77c1108fd31.tar.bz2 ingen-35a5d92cfcf6815553a0939c3e2bf77c1108fd31.zip |
Work on RDF serialization (only (partial) saving so far).
git-svn-id: http://svn.drobilla.net/lad/ingen@146 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/Loader.cpp')
-rw-r--r-- | src/progs/ingenuity/Loader.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/progs/ingenuity/Loader.cpp b/src/progs/ingenuity/Loader.cpp index 59d718c7..485e450d 100644 --- a/src/progs/ingenuity/Loader.cpp +++ b/src/progs/ingenuity/Loader.cpp @@ -18,7 +18,7 @@ #include <fstream> #include <cassert> #include <string> -#include "PatchLibrarian.h" +#include "Serializer.h" #include "PatchModel.h" using std::cout; using std::endl; @@ -26,9 +26,9 @@ namespace Ingenuity { Loader::Loader(CountedPtr<ModelEngineInterface> engine) -: _patch_librarian(new PatchLibrarian(engine)) +: _serializer(new Serializer(engine)) { - assert(_patch_librarian != NULL); + assert(_serializer != NULL); // FIXME: rework this so the thread is only present when it's doing something (save mem) start(); @@ -37,7 +37,7 @@ Loader::Loader(CountedPtr<ModelEngineInterface> engine) Loader::~Loader() { - delete _patch_librarian; + delete _serializer; } @@ -45,12 +45,12 @@ void Loader::_whipped() { _mutex.lock(); + + while ( ! _events.empty() ) { + _events.front()(); + _events.pop_front(); + } - Closure& ev = _event; - ev(); - ev.disconnect(); - - _cond.signal(); _mutex.unlock(); } @@ -65,23 +65,29 @@ Loader::load_patch(const string& filename, { _mutex.lock(); - _event = sigc::hide_return(sigc::bind( - sigc::mem_fun(_patch_librarian, &PatchLibrarian::load_patch), - filename, parent_path, name, poly, initial_data, existing)); + _events.push_back(sigc::hide_return(sigc::bind( + sigc::mem_fun(_serializer, &Serializer::load_patch), + filename, parent_path, name, poly, initial_data, existing))); - whip(); - - _cond.wait(_mutex); _mutex.unlock(); + + whip(); } void Loader::save_patch(CountedPtr<PatchModel> model, const string& filename, bool recursive) { - cerr << "FIXME: (loader) save patch\n"; - //cout << "[Loader] Saving patch " << filename << endl; - //set_event(new SavePatchEvent(m_patch_librarian, model, filename, recursive)); + _mutex.lock(); + + _events.push_back(sigc::hide_return(sigc::bind( + sigc::mem_fun(_serializer, &Serializer::save_patch), + model, filename, recursive))); + + _mutex.unlock(); + + whip(); } + } // namespace Ingenuity |