Changeset e4d549a in ingen


Ignore:
Timestamp:
Oct 24, 2015, 3:13:22 PM (2 years ago)
Author:
David Robillard <d@…>
Branches:
groups, master, nodeless, parallel, parameters, sequencefix, tasks
Children:
557f9d42
Parents:
732bfb33
Message:

Set prefixes on the wire to reduce traffic

git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5779 a436a847-0d15-0410-975c-d299462d15a1

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ingen/SocketWriter.hpp

    r732bfb33 re4d549a  
    4747    void bundle_end();
    4848
    49     int       fd()        { return _socket->fd(); }
    50     Raul::URI uri() const { return _uri; }
     49    int         fd()        { return _socket->fd(); }
     50    Raul::URI   uri() const { return _uri; }
     51    SerdWriter* writer()    { return _writer; }
    5152
    5253protected:
  • src/SocketWriter.cpp

    r732bfb33 re4d549a  
    2626#endif
    2727
     28#define USTR(s) ((const uint8_t*)(s))
     29
    2830namespace Ingen {
    2931
     
    3739    }
    3840    return ret;
     41}
     42
     43static SerdStatus
     44write_prefix(void* handle, const SerdNode* name, const SerdNode* uri)
     45{
     46    SocketWriter* writer = (SocketWriter*)handle;
     47    serd_writer_set_prefix(writer->writer(), name, uri);
     48    return SERD_SUCCESS;
    3949}
    4050
     
    5464    serd_uri_parse(_base.buf, &_base_uri);
    5565
    56     _env    = serd_env_new(&_base);
     66    // Set up serialisation environment
     67    _env = serd_env_new(&_base);
     68    serd_env_set_prefix_from_strings(_env, USTR("atom"),  USTR("http://lv2plug.in/ns/ext/atom#"));
     69    serd_env_set_prefix_from_strings(_env, USTR("patch"), USTR("http://lv2plug.in/ns/ext/patch#"));
     70    serd_env_set_prefix_from_strings(_env, USTR("doap"),  USTR("http://usefulinc.com/ns/doap#"));
     71    serd_env_set_prefix_from_strings(_env, USTR("ingen"), USTR(INGEN_NS));
     72    serd_env_set_prefix_from_strings(_env, USTR("lv2"),   USTR("http://lv2plug.in/ns/lv2core#"));
     73    serd_env_set_prefix_from_strings(_env, USTR("midi"),  USTR("http://lv2plug.in/ns/ext/midi#"));
     74    serd_env_set_prefix_from_strings(_env, USTR("owl"),   USTR("http://www.w3.org/2002/07/owl#"));
     75    serd_env_set_prefix_from_strings(_env, USTR("rdf"),   USTR("http://www.w3.org/1999/02/22-rdf-syntax-ns#"));
     76    serd_env_set_prefix_from_strings(_env, USTR("rdfs"),  USTR("http://www.w3.org/2000/01/rdf-schema#"));
     77    serd_env_set_prefix_from_strings(_env, USTR("xsd"),   USTR("http://www.w3.org/2001/XMLSchema#"));
     78
     79    // Make a Turtle writer that writes directly to the socket
    5780    _writer = serd_writer_new(
    5881        SERD_TURTLE,
     
    6386        this);
    6487
     88    // Write namespace prefixes to reduce traffic
     89    serd_env_foreach(_env, write_prefix, this);
     90
     91    // Configure sratom to write directly to the writer (and thus the socket)
    6592    sratom_set_sink(_sratom,
    6693                    (const char*)_base.buf,
Note: See TracChangeset for help on using the changeset viewer.