[LAD] "enhanced event port" LV2 extension proposal

Dave Robillard dave at drobilla.net
Thu Dec 6 03:48:22 UTC 2007


On Wed, 2007-12-05 at 09:25 +0000, Krzysztof Foltman wrote:
> /******* functions in IURIRegistryObserver_funcs are only implemented by
> the plugin when it wants notifications about new types ****************/
> 
> struct IURIRegistryObserver;
> 
> struct IURIRegistryObserver_funcs
> {
>   // function in a plugin called by host on new URI registration
>   void (*mapping_added)(struct IURIRegistryObserver *observer, int id,
> const char *uri);
> };
> 
> struct IURIRegistryObserver
> {
>   struct IURIRegistryObserver_funcs *functions;
>   // plugin may place it in a larger structure, and cast a pointer
> };
> 
> /* functions implemented by host, used for mapping URIs and numbers */
> 
> struct IURIRegistry_funcs
> {
>   // returns -1 if new registrations are not supported
>   int (*uri_to_id)(struct IURIRegistry *registry, const char *uri, bool
> create_if_absent);
> 
>   // returns pointer to the URI (host-owned), or NULL
>   const char *(*id_to_uri)(struct IURIRegistry *registry, int id);
> 
>   // might be a do-nothing if the host doesn't support registering uris
> on the fly
> 
>   void (*add_observer)(struct IURIRegistryObserver *observer);
> 
>   // might be a do-nothing if the host doesn't support registering uris
> on the fly
>   void (*remove_observer)(struct IURIRegistryObserver *observer);
> };
> 
> /* structure returned by get_registry */
> struct IURIRegistry
> {
>   struct IURIRegistry_funcs *functions;
>   // host may place it in a larger structure, and cast a pointer
> };
> 
> // structure on host side
> struct IURIRegistries_funcs
> {
>   struct IURIRegistry *get_registry(const char *uri);
> };
> 
> // structure on host side
> struct IURIRegistries
> {
>   IURIRegistries_funcs *functions;
>   // host may place it in a larger structure, and cast a pointer
> };
> 
> Or to C++:
> 
> class IURIRegistryObserver
> {
>   virtual void mapping_added(int id, const char *uri) = 0;
> };
> 
> class IURIRegistry
> {
>   virtual int uri_to_id(const char *uri, bool create_if_absent) = 0;
>   virtual const char *id_to_uri(int id) = 0;
>   virtual void add_observer(IURIRegistryObserver *observer) {}
>   virtual remove_observer(IURIRegistryObserver *observer) {}
> };
> 
> class IURIRegistries
> {
>   virtual IURIRegistry *get_registry(const char *registry_uri) = 0;
> };

There are times when 'GoF Patterns in Java' style is appropriate for
discussion solutions.

This isn't one of them.

-DR-





More information about the Linux-audio-dev mailing list