/* Chrysalide - Outil d'analyse de fichiers binaires * singleton.h - prototypes pour la réduction du nombre d'instances d'un même type * * Copyright (C) 2021-2024 Cyrille Bagard * * This file is part of Chrysalide. * * Chrysalide is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Chrysalide 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Foobar. If not, see . */ #ifndef _GLIBEXT_SINGLETON_H #define _GLIBEXT_SINGLETON_H #include #include "helpers.h" /* ------------------ INTERFACE POUR CANDIDAT A UNE CENTRALISATION ------------------ */ #define G_TYPE_SINGLETON_CANDIDATE (g_singleton_candidate_get_type()) DECLARE_INTERFACE(GSingletonCandidate, g_singleton_candidate, G, SINGLETON_CANDIDATE); /* Indique si le candidat est figé. */ bool g_singleton_candidate_is_read_only(const GSingletonCandidate *); /* Crée une copie modifiable d'un object unique. */ GSingletonCandidate *g_singleton_candidate_dup(const GSingletonCandidate *); /* ------------------------- COLLECTION D'INSTANCES UNIQUES ------------------------- */ #define G_TYPE_SINGLETON_FACTORY (g_singleton_factory_get_type()) DECLARE_GTYPE(GSingletonFactory, g_singleton_factory, G, SINGLETON_FACTORY); /* Crée un compacteur d'instances de types. */ GSingletonFactory *g_singleton_factory_new(void); /* Fournit l'instance unique correspondant à un objet. */ GSingletonCandidate *g_singleton_factory_get_instance(GSingletonFactory *, GSingletonCandidate *); #endif /* _GLIBEXT_SINGLETON_H */