/* Pinos * Copyright (C) 2015 Wim Taymans * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef __PINOS_REGISTRY_H__ #define __PINOS_REGISTRY_H__ #ifdef __cplusplus extern "C" { #endif #define PINOS_REGISTRY_URI "http://pinos.org/ns/registry" #define PINOS_REGISTRY_PREFIX PINOS_REGISTRY_URI "#" #include #include #include #include typedef struct _PinosRegistry PinosRegistry; typedef struct { uint32_t core; uint32_t daemon; uint32_t registry; uint32_t node; uint32_t port; uint32_t link; uint32_t node_factory; uint32_t client; uint32_t monitor; uint32_t spa_node; uint32_t spa_clock; uint32_t spa_monitor; } PinosURI; /** * PinosRegistry: * * Pinos registry struct. */ struct _PinosRegistry { PinosObject object; SpaIDMap *map; PinosURI uri; PinosMap objects; PinosSignal object_added; PinosSignal object_removed; }; void pinos_registry_init (PinosRegistry *reg); static inline void pinos_registry_add_object (PinosRegistry *reg, PinosObject *object) { object->id = pinos_map_insert_new (®->objects, object); pinos_signal_emit (®->object_added, reg, object); } static inline void pinos_registry_remove_object (PinosRegistry *reg, PinosObject *object) { pinos_signal_emit (®->object_removed, reg, object); pinos_map_remove (®->objects, object->id); } PinosObject * pinos_registry_iterate_objects (PinosRegistry *reg, uint32_t type, void **state); #define pinos_registry_iterate_nodes(reg,state) \ pinos_registry_iterate_objects(reg, (reg)->uri.node,state) #define pinos_registry_iterate_node_factoriess(reg,state) \ pinos_registry_iterate_objects(reg, (reg)->uri.node_factory,state) #ifdef __cplusplus } #endif #endif /* __PINOS_REGISTRY_H__ */