diff options
Diffstat (limited to 'src/progs/ingenuity')
-rw-r--r-- | src/progs/ingenuity/ThreadedLoader.cpp | 41 | ||||
-rw-r--r-- | src/progs/ingenuity/ThreadedLoader.h | 19 |
2 files changed, 34 insertions, 26 deletions
diff --git a/src/progs/ingenuity/ThreadedLoader.cpp b/src/progs/ingenuity/ThreadedLoader.cpp index 83b3d6b5..e63e7f54 100644 --- a/src/progs/ingenuity/ThreadedLoader.cpp +++ b/src/progs/ingenuity/ThreadedLoader.cpp @@ -18,7 +18,6 @@ #include <fstream> #include <cassert> #include <string> -#include "Loader.h" #include "PatchModel.h" using std::cout; using std::endl; @@ -26,11 +25,9 @@ namespace Ingenuity { ThreadedLoader::ThreadedLoader(SharedPtr<ModelEngineInterface> engine) -: _loader(new Loader(engine)) -, _serializer(new Serializer()) + : _deprecated_loader(engine) + , _loader(engine) { - assert(_loader != NULL); - // FIXME: rework this so the thread is only present when it's doing something (save mem) start(); } @@ -38,7 +35,6 @@ ThreadedLoader::ThreadedLoader(SharedPtr<ModelEngineInterface> engine) ThreadedLoader::~ThreadedLoader() { - delete _loader; } @@ -67,13 +63,26 @@ ThreadedLoader::load_patch(bool merge, { _mutex.lock(); - _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(_loader, &Loader::load), - data_base_uri, - engine_parent, - (engine_name) ? engine_name.get() : "", - "", - engine_data ))); + // FIXME: Filthy hack to load deprecated patches based on file extension + if (data_base_uri.substr(data_base_uri.length()-3) == ".om") { + _events.push_back(sigc::hide_return(sigc::bind( + sigc::mem_fun(_deprecated_loader, &DeprecatedLoader::load_patch), + data_base_uri, + engine_parent, + (engine_name) ? engine_name.get() : "", + (engine_poly) ? engine_poly.get() : 1, + engine_data, + false))); + } else { + _events.push_back(sigc::hide_return(sigc::bind( + sigc::mem_fun(_loader, &Loader::load), + data_base_uri, + engine_parent, + (engine_name) ? engine_name.get() : "", + // FIXME: poly here + "", + engine_data ))); + } _mutex.unlock(); @@ -102,9 +111,9 @@ ThreadedLoader::save_patch_event(SharedPtr<PatchModel> model, const string& file if (recursive) cerr << "FIXME: Recursive save." << endl; - _serializer->start_to_filename(filename); - _serializer->serialize(model); - _serializer->finish(); + _serializer.start_to_filename(filename); + _serializer.serialize(model); + _serializer.finish(); } diff --git a/src/progs/ingenuity/ThreadedLoader.h b/src/progs/ingenuity/ThreadedLoader.h index d5901a74..82080c94 100644 --- a/src/progs/ingenuity/ThreadedLoader.h +++ b/src/progs/ingenuity/ThreadedLoader.h @@ -28,14 +28,12 @@ #include "ModelEngineInterface.h" #include "ObjectModel.h" #include "Serializer.h" +#include "DeprecatedLoader.h" +#include "Loader.h" using std::string; using std::list; using boost::optional; -namespace Ingen { namespace Client { - class Loader; - class PatchModel; -} } using namespace Ingen::Client; namespace Ingenuity { @@ -58,8 +56,8 @@ public: ThreadedLoader(SharedPtr<ModelEngineInterface> engine); ~ThreadedLoader(); - Loader& loader() const { return *_loader; } - Serializer& serializer() const { return *_serializer; } + //Loader& loader() const { return *_loader; } + //Serializer& serializer() const { return *_serializer; } // FIXME: there's a pattern here.... // (same core interface as Loader/Serializer) @@ -83,10 +81,11 @@ private: void _whipped(); - Loader* const _loader; - Serializer* const _serializer; - Mutex _mutex; - list<Closure> _events; + DeprecatedLoader _deprecated_loader; + Loader _loader; + Serializer _serializer; + Mutex _mutex; + list<Closure> _events; }; |