summaryrefslogtreecommitdiff
path: root/src/arch/sharing/instance-int.h
blob: 0117e05ec9050513f8c7418d4a5210e4ceb2d540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

/* 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 GSharedInstance *);

/* 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 *);

/* Procède à l'initialisation de l'interface de partage. */
typedef int (* qck_compare_shared_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  */

    qck_compare_shared_fc qck_cmp;          /* Comparaison des détails     */

};


/* Redéfinition */
typedef GSharedInstanceIface GSharedInstanceInterface;



#endif  /* _ARCH_SHARING_INSTANCE_INT_H */