diff options
author | David Robillard <d@drobilla.net> | 2007-02-14 03:28:12 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-02-14 03:28:12 +0000 |
commit | a532829cb5d19aa06ad7f52693e3db24f234741e (patch) | |
tree | 9eeac48c0f9e241d0ca7b613743eb02284f9bab6 /src/engine/Machine.cpp | |
parent | a795ba2553d1663bc29b8e8fa3186efb516f27d4 (diff) | |
download | machina-a532829cb5d19aa06ad7f52693e3db24f234741e.tar.gz machina-a532829cb5d19aa06ad7f52693e3db24f234741e.tar.bz2 machina-a532829cb5d19aa06ad7f52693e3db24f234741e.zip |
Serialization work on Machina.
git-svn-id: http://svn.drobilla.net/lad/machina@306 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/Machine.cpp')
-rw-r--r-- | src/engine/Machine.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/engine/Machine.cpp b/src/engine/Machine.cpp index dbb212c..142ea37 100644 --- a/src/engine/Machine.cpp +++ b/src/engine/Machine.cpp @@ -197,5 +197,29 @@ Machine::learn(SharedPtr<LearnRequest> learn) } +void +Machine::write_state(Raul::RDFWriter& writer) +{ + using Raul::RdfId; + + writer.add_prefix("machina", "http://drobilla.net/ns/machina"); + + writer.write(RdfId(RdfId::RESOURCE, ""), + RdfId(RdfId::RESOURCE, "rdf:type"), + RdfId(RdfId::RESOURCE, "machina:Machine")); + + for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) { + if ( ! (*n)->id() ) + (*n)->set_id(writer.blank_id()); + + (*n)->write_state(writer); + + writer.write(RdfId(RdfId::RESOURCE, ""), + RdfId(RdfId::RESOURCE, "machina:node"), + (*n)->id()); + } +} + + } // namespace Machina |