summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-17 18:03:53 +0000
committerDavid Robillard <d@drobilla.net>2012-05-17 18:03:53 +0000
commit3e4272d71264ef1a251d154c0b1f4dce8a725554 (patch)
tree6bbbfd7b541fdae47d9651ebeecd917a9a605271
parentdc1680b0b1338b7edbcbff89fe77b0e1c14017a3 (diff)
downloadingen-3e4272d71264ef1a251d154c0b1f4dce8a725554.tar.gz
ingen-3e4272d71264ef1a251d154c0b1f4dce8a725554.tar.bz2
ingen-3e4272d71264ef1a251d154c0b1f4dce8a725554.zip
Eliminate static variable.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4424 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/serialisation/Parser.cpp32
-rw-r--r--src/serialisation/serialisation.cpp6
-rw-r--r--src/serialisation/wscript15
3 files changed, 36 insertions, 17 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 8f00ae91..5406ab24 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -44,8 +44,6 @@ using namespace std;
using namespace Raul;
using namespace Ingen::Shared;
-static const Sord::Node nil;
-
typedef set<Sord::Node> RDFNodes;
namespace Ingen {
@@ -110,6 +108,7 @@ get_properties(Ingen::Shared::World* world,
lv2_atom_forge_init(&forge, map);
lv2_atom_forge_set_sink(&forge, sratom_forge_sink, sratom_forge_deref, &out);
+ const Sord::Node nil;
Resource::Properties props;
for (Sord::Iter i = model.find(subject, nil, nil); !i.end(); ++i) {
if (!skip_property(i.get_predicate())) {
@@ -228,7 +227,8 @@ parse_node(Ingen::Shared::World* world,
{
const URIs& uris = world->uris();
- Sord::URI ingen_prototype(*world->rdf_world(), NS_INGEN "prototype");
+ const Sord::URI ingen_prototype(*world->rdf_world(), NS_INGEN "prototype");
+ const Sord::Node nil;
Sord::Iter i = model.find(subject, ingen_prototype, nil);
if (i.end() || i.get_object().type() != Sord::Node::URI) {
@@ -295,6 +295,7 @@ parse_patch(Ingen::Shared::World* world,
const URIs& uris = world->uris();
const Sord::Node& patch = subject_node;
+ const Sord::Node nil;
uint32_t patch_poly = 0;
@@ -407,8 +408,9 @@ parse_edge(Ingen::Shared::World* world,
const Sord::Node& subject,
const Raul::Path& parent)
{
- Sord::URI ingen_tail(*world->rdf_world(), NS_INGEN "tail");
- Sord::URI ingen_head(*world->rdf_world(), NS_INGEN "head");
+ const Sord::URI ingen_tail(*world->rdf_world(), NS_INGEN "tail");
+ const Sord::URI ingen_head(*world->rdf_world(), NS_INGEN "head");
+ const Sord::Node nil;
Sord::Iter t = model.find(subject, ingen_tail, nil);
Sord::Iter h = model.find(subject, ingen_head, nil);
@@ -448,7 +450,8 @@ parse_edges(Ingen::Shared::World* world,
const Sord::Node& subject,
const Raul::Path& parent)
{
- Sord::URI ingen_edge(*world->rdf_world(), NS_INGEN "edge");
+ const Sord::URI ingen_edge(*world->rdf_world(), NS_INGEN "edge");
+ const Sord::Node nil;
for (Sord::Iter i = model.find(subject, ingen_edge, nil); !i.end(); ++i) {
parse_edge(world, target, model, i.get_object(), parent);
@@ -486,14 +489,15 @@ parse(Ingen::Shared::World* world,
boost::optional<Raul::Symbol> symbol,
boost::optional<GraphObject::Properties> data)
{
- const Sord::URI patch_class (*world->rdf_world(), NS_INGEN "Patch");
- const Sord::URI node_class (*world->rdf_world(), NS_INGEN "Node");
- const Sord::URI edge_class (*world->rdf_world(), NS_INGEN "Edge");
- const Sord::URI internal_class(*world->rdf_world(), NS_INGEN "Internal");
- const Sord::URI in_port_class (*world->rdf_world(), LV2_CORE__InputPort);
- const Sord::URI out_port_class(*world->rdf_world(), LV2_CORE__OutputPort);
- const Sord::URI lv2_class (*world->rdf_world(), LV2_CORE__Plugin);
- const Sord::URI rdf_type (*world->rdf_world(), NS_RDF "type");
+ const Sord::URI patch_class (*world->rdf_world(), NS_INGEN "Patch");
+ const Sord::URI node_class (*world->rdf_world(), NS_INGEN "Node");
+ const Sord::URI edge_class (*world->rdf_world(), NS_INGEN "Edge");
+ const Sord::URI internal_class(*world->rdf_world(), NS_INGEN "Internal");
+ const Sord::URI in_port_class (*world->rdf_world(), LV2_CORE__InputPort);
+ const Sord::URI out_port_class(*world->rdf_world(), LV2_CORE__OutputPort);
+ const Sord::URI lv2_class (*world->rdf_world(), LV2_CORE__Plugin);
+ const Sord::URI rdf_type (*world->rdf_world(), NS_RDF "type");
+ const Sord::Node nil;
// Parse explicit subject patch
if (subject.is_valid()) {
diff --git a/src/serialisation/serialisation.cpp b/src/serialisation/serialisation.cpp
index e234db5d..c5144600 100644
--- a/src/serialisation/serialisation.cpp
+++ b/src/serialisation/serialisation.cpp
@@ -22,8 +22,8 @@
using namespace Ingen;
-struct IngenSerialisationModule : public Shared::Module {
- void load(Shared::World* world) {
+struct IngenSerialisationModule : public Ingen::Shared::Module {
+ virtual void load(Ingen::Shared::World* world) {
world->set_parser(SharedPtr<Serialisation::Parser>(
new Serialisation::Parser(*world)));
world->set_serialiser(SharedPtr<Serialisation::Serialiser>(
@@ -33,7 +33,7 @@ struct IngenSerialisationModule : public Shared::Module {
extern "C" {
-Shared::Module*
+Ingen::Shared::Module*
ingen_module_load() {
return new IngenSerialisationModule();
}
diff --git a/src/serialisation/wscript b/src/serialisation/wscript
index 49698b6c..23924970 100644
--- a/src/serialisation/wscript
+++ b/src/serialisation/wscript
@@ -13,3 +13,18 @@ def build(bld):
install_path = '${LIBDIR}',
use = 'libingen_shared')
autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD SRATOM')
+
+ if bld.env['BUILD_TESTS']:
+ obj = bld(features = 'c cshlib cxx cxxshlib',
+ source = ['Parser.cpp',
+ 'Serialiser.cpp',
+ 'serialisation.cpp'],
+ export_includes = ['../..'],
+ includes = ['.', '../..'],
+ name = 'libingen_serialisation_profiled',
+ target = 'ingen_serialisation_profiled',
+ install_path = '',
+ use = 'libingen_shared_profiled',
+ lib = bld.env['INGEN_TEST_LIBS'],
+ cxxflags = bld.env['INGEN_TEST_CXXFLAGS'])
+ autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD SRATOM')