diff options
author | David Robillard <d@drobilla.net> | 2006-12-09 07:43:15 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-12-09 07:43:15 +0000 |
commit | d5e8ce8127784fc67953ab3b6247e911be697cc2 (patch) | |
tree | 41ed069b23a9cab56b4443cf699b26080a590ae5 /src/progs/ingenuity/Loader.cpp | |
parent | d2d755b0db3b4779d581c7a70841609257250c12 (diff) | |
download | ingen-d5e8ce8127784fc67953ab3b6247e911be697cc2.tar.gz ingen-d5e8ce8127784fc67953ab3b6247e911be697cc2.tar.bz2 ingen-d5e8ce8127784fc67953ab3b6247e911be697cc2.zip |
Preliminary patch loading (just loads nodes from RDF).
git-svn-id: http://svn.drobilla.net/lad/ingen@214 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/Loader.cpp')
-rw-r--r-- | src/progs/ingenuity/Loader.cpp | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/src/progs/ingenuity/Loader.cpp b/src/progs/ingenuity/Loader.cpp deleted file mode 100644 index 89245dff..00000000 --- a/src/progs/ingenuity/Loader.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "Loader.h" -#include <fstream> -#include <cassert> -#include <string> -#include "Serializer.h" -#include "PatchModel.h" -using std::cout; using std::endl; - -namespace Ingenuity { - - -Loader::Loader(SharedPtr<ModelEngineInterface> engine) -: _serializer(new Serializer(engine)) -{ - assert(_serializer != NULL); - - // FIXME: rework this so the thread is only present when it's doing something (save mem) - start(); -} - - -Loader::~Loader() -{ - delete _serializer; -} - - -void -Loader::_whipped() -{ - _mutex.lock(); - - while ( ! _events.empty() ) { - _events.front()(); - _events.pop_front(); - } - - _mutex.unlock(); -} - -void -Loader::load_patch(bool merge, - const string& data_base_uri, - const Path& data_path, - MetadataMap engine_data, - optional<const Path&> engine_parent, - optional<const string&> engine_name, - optional<size_t> engine_poly) -{ - _mutex.lock(); - - _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(_serializer, &Serializer::load_patch), - merge, data_base_uri, data_path, - engine_data, engine_parent, engine_name, engine_poly))); - - _mutex.unlock(); - - whip(); -} - - -void -Loader::save_patch(SharedPtr<PatchModel> model, const string& filename, bool recursive) -{ - _mutex.lock(); - - _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(this, &Loader::save_patch_event), - model, filename, recursive))); - - _mutex.unlock(); - - whip(); -} - - -void -Loader::save_patch_event(SharedPtr<PatchModel> model, const string& filename, bool recursive) -{ - if (recursive) - cerr << "FIXME: Recursive save." << endl; - - _serializer->start_to_filename(filename); - _serializer->serialize(model); - _serializer->finish(); -} - - -} // namespace Ingenuity |