Ingen  0.5.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Ingen::Resource Class Reference

An object with a URI described by properties. More...

#include <Resource.hpp>

+ Inheritance diagram for Ingen::Resource:
+ Collaboration diagram for Ingen::Resource:

Classes

class  Properties
 
class  Property
 A property value (an Atom with a context). More...
 

Public Types

enum  Graph {
  DEFAULT,
  EXTERNAL,
  INTERNAL
}
 

Public Member Functions

 Resource (const URIs &uris, const Raul::URI &uri)
 
Resourceoperator= (const Resource &rhs)
 
virtual const Atomget_property (const Raul::URI &uri) const
 Get a single property value. More...
 
virtual const Atomset_property (const Raul::URI &uri, const Atom &value, Graph ctx=Graph::DEFAULT)
 Set (replace) a property value. More...
 
virtual const Atomset_property (const Raul::URI &uri, const URIs::Quark &value, Graph ctx=Graph::DEFAULT)
 Set (replace) a property value. More...
 
virtual bool add_property (const Raul::URI &uri, const Atom &value, Graph ctx=Graph::DEFAULT)
 Add a property value. More...
 
virtual void remove_property (const Raul::URI &uri, const Atom &value)
 Remove a property. More...
 
virtual void remove_property (const Raul::URI &uri, const URIs::Quark &value)
 Remove a property. More...
 
virtual bool has_property (const Raul::URI &uri, const Atom &value) const
 Return true iff a property is set with a specific value. More...
 
virtual bool has_property (const Raul::URI &uri, const URIs::Quark &value) const
 Return true iff a property is set with a specific value. More...
 
void set_properties (const Properties &p)
 Set (replace) several properties at once. More...
 
void add_properties (const Properties &p)
 Add several properties at once. More...
 
void remove_properties (const Properties &p)
 Remove several properties at once. More...
 
virtual void on_property (const Raul::URI &uri, const Atom &value)
 Hook called whenever a property is added. More...
 
virtual void on_property_removed (const Raul::URI &uri, const Atom &value)
 Hook called whenever a property value is removed. More...
 
virtual void set_uri (const Raul::URI &uri)
 
Properties properties (Resource::Graph ctx) const
 Get all the properties with a given context. More...
 
const URIsuris () const
 
const Raul::URI & uri () const
 
const Propertiesproperties () const
 
Propertiesproperties ()
 

Static Public Member Functions

static Raul::URI graph_to_uri (Graph g)
 
static Graph uri_to_graph (const char *uri)
 
static bool type (const URIs &uris, const Properties &properties, bool &graph, bool &block, bool &port, bool &is_output)
 Get the ingen type from a set of Properties. More...
 

Protected Member Functions

const Atomset_property (const Raul::URI &uri, const Atom &value) const
 

Protected Attributes

const URIs_uris
 

Detailed Description

An object with a URI described by properties.

Member Function Documentation

§ get_property()

const Atom & Ingen::Resource::get_property ( const Raul::URI &  uri) const
virtual

Get a single property value.

This is only useful for properties with a single value. If the requested property has several values, the first will be returned.

Reimplemented in Ingen::Server::NodeImpl, Ingen::Client::ObjectModel, and Ingen::Client::PluginModel.

Referenced by Ingen::Client::PluginModel::get_property(), and Ingen::Serialiser::serialise().

§ set_property() [1/2]

const Atom & Ingen::Resource::set_property ( const Raul::URI &  uri,
const Atom value,
Resource::Graph  ctx = Graph::DEFAULT 
)
virtual

Set (replace) a property value.

This will first erase any properties with the given uri, so after this call exactly one property with predicate uri will be set.

Referenced by Ingen::Server::InternalBlock::duplicate(), Ingen::Client::PluginModel::get_property(), Ingen::Server::LV2Block::save_preset(), Ingen::Serialiser::serialise(), and Ingen::Client::ObjectModel::set().

§ set_property() [2/2]

const Atom & Ingen::Resource::set_property ( const Raul::URI &  uri,
const URIs::Quark value,
Resource::Graph  ctx = Graph::DEFAULT 
)
virtual

Set (replace) a property value.

This will first erase any properties with the given uri, so after this call exactly one property with predicate uri will be set.

§ add_property()

bool Ingen::Resource::add_property ( const Raul::URI &  uri,
const Atom value,
Graph  ctx = Graph::DEFAULT 
)
virtual

Add a property value.

This will not remove any existing values, so if properties with predicate uri and values other than value exist, this will result in multiple values for the property.

Returns
True iff a new property was added.

Referenced by Ingen::Server::LV2Block::instantiate().

§ remove_property() [1/2]

void Ingen::Resource::remove_property ( const Raul::URI &  uri,
const Atom value 
)
virtual

Remove a property.

If value is patch:wildcard then any property with uri for a predicate will be removed.

§ remove_property() [2/2]

void Ingen::Resource::remove_property ( const Raul::URI &  uri,
const URIs::Quark value 
)
virtual

Remove a property.

If value is patch:wildcard then any property with uri for a predicate will be removed.

§ has_property() [1/2]

bool Ingen::Resource::has_property ( const Raul::URI &  uri,
const Atom value 
) const
virtual

Return true iff a property is set with a specific value.

Referenced by Ingen::Client::PortModel::on_property(), and Ingen::Serialiser::serialise().

§ has_property() [2/2]

bool Ingen::Resource::has_property ( const Raul::URI &  uri,
const URIs::Quark value 
) const
virtual

Return true iff a property is set with a specific value.

§ set_properties()

void Ingen::Resource::set_properties ( const Properties p)

Set (replace) several properties at once.

This will erase all properties with keys in p, though multiple values for one property may exist in p will all be set (unlike simply calling set_property in a loop which would only set one value).

Referenced by Ingen::Server::GraphImpl::duplicate().

§ add_properties()

void Ingen::Resource::add_properties ( const Properties p)

Add several properties at once.

§ remove_properties()

void Ingen::Resource::remove_properties ( const Properties p)

Remove several properties at once.

This removes all matching properties (both key and value), or all properties with a matching key if the value in p is patch:wildcard.

§ on_property()

virtual void Ingen::Resource::on_property ( const Raul::URI &  uri,
const Atom value 
)
inlinevirtual

Hook called whenever a property is added.

This can be used by derived classes to implement special behaviour for particular properties (e.g. ingen:value for ports).

Reimplemented in Ingen::Client::PortModel, Ingen::Server::DuplexPort, and Ingen::Client::ObjectModel.

§ on_property_removed()

virtual void Ingen::Resource::on_property_removed ( const Raul::URI &  uri,
const Atom value 
)
inlinevirtual

Hook called whenever a property value is removed.

If all values for a key are removed, then value will be the wildcard.

This can be used by derived classes to implement special behaviour for particular properties (e.g. ingen:value for ports).

Reimplemented in Ingen::Client::ObjectModel.

§ type()

bool Ingen::Resource::type ( const URIs uris,
const Properties properties,
bool &  graph,
bool &  block,
bool &  port,
bool &  is_output 
)
static

Get the ingen type from a set of Properties.

If some coherent ingen type is found, true is returned and the appropriate output parameter set to true. Otherwise false is returned.

Referenced by Ingen::Server::LV2Block::apply_state(), Ingen::Server::LV2Block::instantiate(), and Ingen::Server::LV2Block::LV2Block().

§ properties()

Resource::Properties Ingen::Resource::properties ( Resource::Graph  ctx) const

The documentation for this class was generated from the following files: