summaryrefslogtreecommitdiffstats
path: root/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-02-23 19:55:13 +0000
committerDavid Robillard <d@drobilla.net>2013-02-23 19:55:13 +0000
commit6b6cb56b2ceab509569bfca247f108f2be5e25c0 (patch)
tree5a46eee0c3f518fa7bb20e6a8784e5bd3ba04598 /ingen
parent5a6aafff8dda9dddce479a2ad86edb933c9688c3 (diff)
downloadingen-6b6cb56b2ceab509569bfca247f108f2be5e25c0.tar.gz
ingen-6b6cb56b2ceab509569bfca247f108f2be5e25c0.tar.bz2
ingen-6b6cb56b2ceab509569bfca247f108f2be5e25c0.zip
Move Atom implementation out of Raul so it can depend on LV2.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5076 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'ingen')
-rw-r--r--ingen/AtomReader.hpp2
-rw-r--r--ingen/AtomWriter.hpp6
-rw-r--r--ingen/ClashAvoider.hpp6
-rw-r--r--ingen/Configuration.hpp37
-rw-r--r--ingen/Forge.hpp43
-rw-r--r--ingen/Interface.hpp6
-rw-r--r--ingen/Resource.hpp32
-rw-r--r--ingen/URIs.hpp6
-rw-r--r--ingen/client/ClientStore.hpp6
-rw-r--r--ingen/client/ObjectModel.hpp6
-rw-r--r--ingen/client/PluginModel.hpp4
-rw-r--r--ingen/client/PortModel.hpp18
-rw-r--r--ingen/client/SigClientInterface.hpp4
-rw-r--r--ingen/client/ThreadedSigClientInterface.hpp33
14 files changed, 120 insertions, 89 deletions
diff --git a/ingen/AtomReader.hpp b/ingen/AtomReader.hpp
index 8a821194..1cf55bb5 100644
--- a/ingen/AtomReader.hpp
+++ b/ingen/AtomReader.hpp
@@ -49,7 +49,7 @@ public:
bool write(const LV2_Atom* msg);
private:
- void get_atom(const LV2_Atom* in, Raul::Atom& out);
+ void get_atom(const LV2_Atom* in, Atom& out);
const char* atom_to_uri(const LV2_Atom* atom);
boost::optional<Raul::Path> atom_to_path(const LV2_Atom* atom);
diff --git a/ingen/AtomWriter.hpp b/ingen/AtomWriter.hpp
index 3dab20ec..4b5555b1 100644
--- a/ingen/AtomWriter.hpp
+++ b/ingen/AtomWriter.hpp
@@ -66,9 +66,9 @@ public:
void disconnect_all(const Raul::Path& graph,
const Raul::Path& path);
- void set_property(const Raul::URI& subject,
- const Raul::URI& predicate,
- const Raul::Atom& value);
+ void set_property(const Raul::URI& subject,
+ const Raul::URI& predicate,
+ const Atom& value);
void set_response_id(int32_t id);
diff --git a/ingen/ClashAvoider.hpp b/ingen/ClashAvoider.hpp
index ac3f7e07..60affa2a 100644
--- a/ingen/ClashAvoider.hpp
+++ b/ingen/ClashAvoider.hpp
@@ -74,9 +74,9 @@ public:
virtual void disconnect_all(const Raul::Path& graph,
const Raul::Path& path);
- virtual void set_property(const Raul::URI& subject_path,
- const Raul::URI& predicate,
- const Raul::Atom& value);
+ virtual void set_property(const Raul::URI& subject_path,
+ const Raul::URI& predicate,
+ const Atom& value);
virtual void del(const Raul::URI& uri);
diff --git a/ingen/Configuration.hpp b/ingen/Configuration.hpp
index 6002a178..ffa9723e 100644
--- a/ingen/Configuration.hpp
+++ b/ingen/Configuration.hpp
@@ -25,10 +25,9 @@
#include <map>
#include <string>
+#include "ingen/Atom.hpp"
#include "ingen/Forge.hpp"
#include "ingen/URIMap.hpp"
-
-#include "raul/Atom.hpp"
#include "raul/Exception.hpp"
namespace Ingen {
@@ -60,13 +59,13 @@ public:
* @param type Type
* @param value Default value
*/
- Configuration& add(const std::string& key,
- const std::string& name,
- char letter,
- const std::string& desc,
- Scope scope,
- const Raul::Atom::TypeID type,
- const Raul::Atom& value);
+ Configuration& add(const std::string& key,
+ const std::string& name,
+ char letter,
+ const std::string& desc,
+ Scope scope,
+ const LV2_URID type,
+ const Atom& value);
void print_usage(const std::string& program, std::ostream& os);
@@ -108,8 +107,8 @@ public:
std::list<std::string> load_default(const std::string& app,
const std::string& filename);
- const Raul::Atom& option(const std::string& long_name) const;
- bool set(const std::string& long_name, const Raul::Atom& value);
+ const Atom& option(const std::string& long_name) const;
+ bool set(const std::string& long_name, const Atom& value);
const std::list<std::string>& files() const { return _files; }
@@ -118,19 +117,19 @@ private:
public:
Option(const std::string& k, const std::string& n, char l,
const std::string& d, Scope s,
- const Raul::Atom::TypeID type, const Raul::Atom& def)
+ const LV2_URID type, const Atom& def)
: key(k), name(n), letter(l)
, desc(d), scope(s)
, type(type), value(def)
{}
- std::string key;
- std::string name;
- char letter;
- std::string desc;
- Scope scope;
- Raul::Atom::TypeID type;
- Raul::Atom value;
+ std::string key;
+ std::string name;
+ char letter;
+ std::string desc;
+ Scope scope;
+ LV2_URID type;
+ Atom value;
};
struct OptionNameOrder {
diff --git a/ingen/Forge.hpp b/ingen/Forge.hpp
index e92a9501..de32b3e8 100644
--- a/ingen/Forge.hpp
+++ b/ingen/Forge.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
+ Copyright 2007-2013 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -19,20 +19,53 @@
#include <string>
-#include "raul/Atom.hpp"
+#include "ingen/Atom.hpp"
+#include "lv2/lv2plug.in/ns/ext/atom/forge.h"
namespace Ingen {
class URIMap;
-/** Forge for Raul Atoms.
+/** Forge for Atoms.
* @ingroup IngenShared
*/
-class Forge : public Raul::Forge {
+class Forge : public LV2_Atom_Forge {
public:
explicit Forge(URIMap& map);
- std::string str(const Raul::Atom& atom);
+ std::string str(const Atom& atom);
+
+ Atom make() { return Atom(); }
+ Atom make(int32_t v) { return Atom(sizeof(v), Int, &v); }
+ Atom make(float v) { return Atom(sizeof(v), Float, &v); }
+ Atom make(bool v) {
+ const int32_t iv = v ? 1 : 0;
+ return Atom(sizeof(int32_t), Bool, &iv);
+ }
+
+ Atom make_urid(int32_t v) { return Atom(sizeof(int32_t), URID, &v); }
+
+ Atom alloc(uint32_t size, uint32_t type, const void* val) {
+ return Atom(size, type, val);
+ }
+
+ Atom alloc(const char* v) {
+ const size_t len = strlen(v);
+ return Atom(len + 1, String, v);
+ }
+
+ Atom alloc(const std::string& v) {
+ return Atom(v.length() + 1, String, v.c_str());
+ }
+
+ Atom alloc_uri(const char* v) {
+ const size_t len = strlen(v);
+ return Atom(len + 1, URI, v);
+ }
+
+ Atom alloc_uri(const std::string& v) {
+ return Atom(v.length() + 1, URI, v.c_str());
+ }
private:
URIMap& _map;
diff --git a/ingen/Interface.hpp b/ingen/Interface.hpp
index 023221bd..0fc90d42 100644
--- a/ingen/Interface.hpp
+++ b/ingen/Interface.hpp
@@ -81,9 +81,9 @@ public:
virtual void disconnect_all(const Raul::Path& graph,
const Raul::Path& path) = 0;
- virtual void set_property(const Raul::URI& subject,
- const Raul::URI& predicate,
- const Raul::Atom& value) = 0;
+ virtual void set_property(const Raul::URI& subject,
+ const Raul::URI& predicate,
+ const Atom& value) = 0;
/** Set the ID to use to respond to the next message.
* Setting the ID to -1 will disable responses.
diff --git a/ingen/Resource.hpp b/ingen/Resource.hpp
index e741a633..756419d8 100644
--- a/ingen/Resource.hpp
+++ b/ingen/Resource.hpp
@@ -20,8 +20,8 @@
#include <map>
#include <string>
+#include "ingen/Atom.hpp"
#include "ingen/URIs.hpp"
-#include "raul/Atom.hpp"
#include "raul/Deletable.hpp"
#include "raul/URI.hpp"
@@ -70,10 +70,10 @@ public:
}
/** A property value (an Atom with a context). */
- class Property : public Raul::Atom {
+ class Property : public Atom {
public:
- Property(const Raul::Atom& atom, Graph ctx=Graph::DEFAULT)
- : Raul::Atom(atom)
+ Property(const Atom& atom, Graph ctx=Graph::DEFAULT)
+ : Atom(atom)
, _ctx(ctx)
{}
@@ -93,16 +93,16 @@ public:
* This is only useful for properties with a single value. If the
* requested property has several values, the first will be returned.
*/
- virtual const Raul::Atom& get_property(const Raul::URI& uri) const;
+ virtual const Atom& get_property(const Raul::URI& uri) const;
/** Set (replace) a property value.
*
* This will first erase any properties with the given @p uri, so after
* this call exactly one property with predicate @p uri will be set.
*/
- virtual const Raul::Atom& set_property(
+ virtual const Atom& set_property(
const Raul::URI& uri,
- const Raul::Atom& value,
+ const Atom& value,
Graph ctx=Graph::DEFAULT);
/** Add a property value.
@@ -111,21 +111,21 @@ public:
* predicate @p uri and values other than @p value exist, this will result
* in multiple values for the property.
*/
- virtual void add_property(const Raul::URI& uri,
- const Raul::Atom& value,
- Graph ctx=Graph::DEFAULT);
+ virtual void add_property(const Raul::URI& uri,
+ const Atom& value,
+ Graph ctx = Graph::DEFAULT);
/** Remove a property.
*
* If @p value is ingen:wildcard then any property with @p uri for a
* predicate will be removed.
*/
- virtual void remove_property(const Raul::URI& uri,
- const Raul::Atom& value);
+ virtual void remove_property(const Raul::URI& uri,
+ const Atom& value);
/** Return true iff a property is set. */
- virtual bool has_property(const Raul::URI& uri,
- const Raul::Atom& value) const;
+ virtual bool has_property(const Raul::URI& uri,
+ const Atom& value) const;
/** Set (replace) several properties at once.
*
@@ -150,7 +150,7 @@ public:
* This can be used by derived classes to implement special behaviour for
* particular properties (e.g. ingen:value for ports).
*/
- virtual void on_property(const Raul::URI& uri, const Raul::Atom& value) {}
+ virtual void on_property(const Raul::URI& uri, const Atom& value) {}
/** Get the ingen type from a set of Properties.
*
@@ -175,7 +175,7 @@ public:
Properties& properties() { return _properties; }
protected:
- const Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value) const;
+ const Atom& set_property(const Raul::URI& uri, const Atom& value) const;
URIs& _uris;
diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp
index a09037e6..4cbe62a6 100644
--- a/ingen/URIs.hpp
+++ b/ingen/URIs.hpp
@@ -17,9 +17,9 @@
#ifndef INGEN_URIS_HPP
#define INGEN_URIS_HPP
+#include "ingen/Atom.hpp"
#include "ingen/Forge.hpp"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
-#include "raul/Atom.hpp"
#include "raul/Noncopyable.hpp"
#include "raul/URI.hpp"
@@ -46,9 +46,9 @@ public:
struct Quark : public Raul::URI {
Quark(Ingen::Forge& forge, URIMap* map, const char* str);
operator LV2_URID() const { return id; }
- operator Raul::Atom() const { return atom; }
+ operator Atom() const { return atom; }
uint32_t id;
- Raul::Atom atom;
+ Atom atom;
};
Ingen::Forge& forge;
diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp
index e9c85ba9..f53217b4 100644
--- a/ingen/client/ClientStore.hpp
+++ b/ingen/client/ClientStore.hpp
@@ -84,9 +84,9 @@ public:
void move(const Raul::Path& old_path,
const Raul::Path& new_path);
- void set_property(const Raul::URI& subject_path,
- const Raul::URI& predicate,
- const Raul::Atom& value);
+ void set_property(const Raul::URI& subject_path,
+ const Raul::URI& predicate,
+ const Atom& value);
void connect(const Raul::Path& tail,
const Raul::Path& head);
diff --git a/ingen/client/ObjectModel.hpp b/ingen/client/ObjectModel.hpp
index 52655949..66c3db7c 100644
--- a/ingen/client/ObjectModel.hpp
+++ b/ingen/client/ObjectModel.hpp
@@ -59,9 +59,9 @@ public:
bool is_a(const Raul::URI& type) const;
- const Raul::Atom& get_property(const Raul::URI& key) const;
+ const Atom& get_property(const Raul::URI& key) const;
- void on_property(const Raul::URI& uri, const Raul::Atom& value);
+ void on_property(const Raul::URI& uri, const Atom& value);
const Raul::Path& path() const { return _path; }
const Raul::Symbol& symbol() const { return _symbol; }
@@ -73,7 +73,7 @@ public:
// Signals
INGEN_SIGNAL(new_child, void, SPtr<ObjectModel>);
INGEN_SIGNAL(removed_child, void, SPtr<ObjectModel>);
- INGEN_SIGNAL(property, void, const Raul::URI&, const Raul::Atom&);
+ INGEN_SIGNAL(property, void, const Raul::URI&, const Atom&);
INGEN_SIGNAL(destroyed, void);
INGEN_SIGNAL(moved, void);
diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp
index dea85651..7f409f02 100644
--- a/ingen/client/PluginModel.hpp
+++ b/ingen/client/PluginModel.hpp
@@ -55,7 +55,7 @@ public:
Type type() const { return _type; }
- virtual const Raul::Atom& get_property(const Raul::URI& key) const;
+ virtual const Atom& get_property(const Raul::URI& key) const;
Raul::Symbol default_block_symbol() const;
std::string human_name() const;
@@ -91,7 +91,7 @@ public:
// Signals
INGEN_SIGNAL(changed, void);
- INGEN_SIGNAL(property, void, const Raul::URI&, const Raul::Atom&);
+ INGEN_SIGNAL(property, void, const Raul::URI&, const Atom&);
protected:
friend class ClientStore;
diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp
index 568975fc..84a5d0d8 100644
--- a/ingen/client/PortModel.hpp
+++ b/ingen/client/PortModel.hpp
@@ -45,11 +45,11 @@ public:
bool supports(const Raul::URI& value_type) const;
- inline uint32_t index() const { return _index; }
- inline const Raul::Atom& value() const { return get_property(_uris.ingen_value); }
- inline bool connected() const { return (_connections > 0); }
- inline bool is_input() const { return (_direction == Direction::INPUT); }
- inline bool is_output() const { return (_direction == Direction::OUTPUT); }
+ inline uint32_t index() const { return _index; }
+ inline const Atom& value() const { return get_property(_uris.ingen_value); }
+ inline bool connected() const { return (_connections > 0); }
+ inline bool is_input() const { return (_direction == Direction::INPUT); }
+ inline bool is_output() const { return (_direction == Direction::OUTPUT); }
bool port_property(const Raul::URI& uri) const;
@@ -65,12 +65,12 @@ public:
inline bool operator==(const PortModel& pm) const { return (path() == pm.path()); }
- void on_property(const Raul::URI& uri, const Raul::Atom& value);
+ void on_property(const Raul::URI& uri, const Atom& value);
// Signals
- INGEN_SIGNAL(value_changed, void, const Raul::Atom&);
- INGEN_SIGNAL(voice_changed, void, uint32_t, const Raul::Atom&);
- INGEN_SIGNAL(activity, void, const Raul::Atom&);
+ INGEN_SIGNAL(value_changed, void, const Atom&);
+ INGEN_SIGNAL(voice_changed, void, uint32_t, const Atom&);
+ INGEN_SIGNAL(activity, void, const Atom&);
INGEN_SIGNAL(connection, void, SPtr<PortModel>);
INGEN_SIGNAL(disconnection, void, SPtr<PortModel>);
diff --git a/ingen/client/SigClientInterface.hpp b/ingen/client/SigClientInterface.hpp
index 900a9923..2210d4f4 100644
--- a/ingen/client/SigClientInterface.hpp
+++ b/ingen/client/SigClientInterface.hpp
@@ -58,7 +58,7 @@ public:
INGEN_SIGNAL(connection, void, Raul::Path, Raul::Path)
INGEN_SIGNAL(disconnection, void, Raul::Path, Raul::Path)
INGEN_SIGNAL(disconnect_all, void, Raul::Path, Raul::Path)
- INGEN_SIGNAL(property_change, void, Raul::URI, Raul::URI, Raul::Atom)
+ INGEN_SIGNAL(property_change, void, Raul::URI, Raul::URI, Atom)
/** Fire pending signals. Only does anything on derived classes (that may queue) */
virtual bool emit_signals() { return false; }
@@ -106,7 +106,7 @@ protected:
void disconnect_all(const Raul::Path& graph, const Raul::Path& path)
{ EMIT(disconnect_all, graph, path); }
- void set_property(const Raul::URI& subject, const Raul::URI& key, const Raul::Atom& value)
+ void set_property(const Raul::URI& subject, const Raul::URI& key, const Atom& value)
{ EMIT(property_change, subject, key, value); }
void set_response_id(int32_t id) {}
diff --git a/ingen/client/ThreadedSigClientInterface.hpp b/ingen/client/ThreadedSigClientInterface.hpp
index d4e5f6d6..562c5fca 100644
--- a/ingen/client/ThreadedSigClientInterface.hpp
+++ b/ingen/client/ThreadedSigClientInterface.hpp
@@ -25,11 +25,10 @@
#include <sigc++/sigc++.h>
#include <glibmm/thread.h>
-#include "raul/Atom.hpp"
-#include "raul/SRSWQueue.hpp"
-
+#include "ingen/Atom.hpp"
#include "ingen/Interface.hpp"
#include "ingen/client/SigClientInterface.hpp"
+#include "raul/SRSWQueue.hpp"
/** Returns nothing and takes no parameters (because they have all been bound) */
typedef sigc::slot<void> Closure;
@@ -104,7 +103,7 @@ public:
void disconnect_all(const Raul::Path& graph, const Raul::Path& path)
{ push_sig(sigc::bind(disconnect_all_slot, graph, path)); }
- void set_property(const Raul::URI& subject, const Raul::URI& key, const Raul::Atom& value)
+ void set_property(const Raul::URI& subject, const Raul::URI& key, const Atom& value)
{ push_sig(sigc::bind(property_change_slot, subject, key, value)); }
/** Process all queued events - Called from GTK thread to emit signals. */
@@ -145,21 +144,21 @@ private:
Raul::SRSWQueue<Closure> _sigs;
- sigc::slot<void> bundle_begin_slot;
- sigc::slot<void> bundle_end_slot;
- sigc::slot<void, int32_t, Status, std::string> response_slot;
- sigc::slot<void, std::string> error_slot;
- sigc::slot<void, Raul::URI, Raul::URI, Raul::Symbol> new_plugin_slot;
+ sigc::slot<void> bundle_begin_slot;
+ sigc::slot<void> bundle_end_slot;
+ sigc::slot<void, int32_t, Status, std::string> response_slot;
+ sigc::slot<void, std::string> error_slot;
+ sigc::slot<void, Raul::URI, Raul::URI, Raul::Symbol> new_plugin_slot;
sigc::slot<void, Raul::URI, Resource::Properties,
- Resource::Graph> put_slot;
+ Resource::Graph> put_slot;
sigc::slot<void, Raul::URI, Resource::Properties,
- Resource::Properties> delta_slot;
- sigc::slot<void, Raul::Path, Raul::Path> connection_slot;
- sigc::slot<void, Raul::URI> object_deleted_slot;
- sigc::slot<void, Raul::Path, Raul::Path> object_moved_slot;
- sigc::slot<void, Raul::Path, Raul::Path> disconnection_slot;
- sigc::slot<void, Raul::Path, Raul::Path> disconnect_all_slot;
- sigc::slot<void, Raul::URI, Raul::URI, Raul::Atom> property_change_slot;
+ Resource::Properties> delta_slot;
+ sigc::slot<void, Raul::Path, Raul::Path> connection_slot;
+ sigc::slot<void, Raul::URI> object_deleted_slot;
+ sigc::slot<void, Raul::Path, Raul::Path> object_moved_slot;
+ sigc::slot<void, Raul::Path, Raul::Path> disconnection_slot;
+ sigc::slot<void, Raul::Path, Raul::Path> disconnect_all_slot;
+ sigc::slot<void, Raul::URI, Raul::URI, Atom> property_change_slot;
};
} // namespace Client