diff options
Diffstat (limited to 'src/arch/sharing/instance-int.h')
-rw-r--r-- | src/arch/sharing/instance-int.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/arch/sharing/instance-int.h b/src/arch/sharing/instance-int.h new file mode 100644 index 0000000..0b57cc4 --- /dev/null +++ b/src/arch/sharing/instance-int.h @@ -0,0 +1,73 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * instance-int.h - définitions internes propres aux instances partagées + * + * Copyright (C) 2016 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 <http://www.gnu.org/licenses/>. + */ + + +#ifndef _ARCH_SHARING_INSTANCE_INT_H +#define _ARCH_SHARING_INSTANCE_INT_H + + +#include "instance.h" + + + +/* Initialise un nouvel objet partagé avec des informations. */ +typedef bool (* init_shared_fc) (GSharedInstance *, const void *); + +/* Fournit la valeur du compteur de partage. */ +typedef unsigned int (* get_shared_ref_fc) (const GSharedInstance *); + +/* Incrémente le compteur de partage. */ +typedef void (* inc_shared_ref_fc) (GSharedInstance *); + +/* Décrémente le compteur de partage. */ +typedef void (* dec_shared_ref_fc) (GSharedInstance *); + +/* Indique l'objet partagé correspond à une description donnée. */ +typedef bool (* compare_shared_info_fc) (const GSharedInstance *, const void *); + +/* Détermine si deux instances partagées sont identiques. */ +typedef gboolean (* is_shared_equal_fc) (const GSharedInstance *, const GSharedInstance *); + + +/* Règles de partage d'une instance GObject (interface) */ +struct _GSharedInstanceIface +{ + GTypeInterface base_iface; /* A laisser en premier */ + + init_shared_fc init; /* Initialisation de l'objet */ + + get_shared_ref_fc get_ref; /* Obtention du compteur */ + inc_shared_ref_fc inc_ref; /* Incrémentation du compteur */ + dec_shared_ref_fc dec_ref; /* Décrémentation du compteur */ + + compare_shared_info_fc cmp_info; /* Comparaison des détails */ + is_shared_equal_fc is_equal; /* Comparaison d'instance */ + +}; + + +/* Redéfinition */ +typedef GSharedInstanceIface GSharedInstanceInterface; + + + +#endif /* _ARCH_SHARING_INSTANCE_INT_H */ |