summaryrefslogtreecommitdiff
path: root/src/glibext/tpmem-int.h
blob: b1b7eec1443977b49a095ad1c0173fe9bcd284db (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
70
71
72
73
74
75
76
77
78

/* Chrysalide - Outil d'analyse de fichiers binaires
 * tpmem-int.h - définitions internes propres à la mémorisation des types d'objets mis en cache
 *
 * Copyright (C) 2020-2025 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 Chrysalide.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef _GLIBEXT_TPMEM_INT_H
#define _GLIBEXT_TPMEM_INT_H


#include "tpmem.h"


/* Conservation d'une référence sur un type */
typedef struct _gtype_ref_info_t
{
    GType gtype;                            /* Type pour la GLib           */
    gpointer gclass;                        /* Lien vers sa classe         */

    /**
     * La GLib n'est pas très claire sur la taille de GType comme le montre le
     * code issu de <sources>/gobject/gtype.h :
     *
     *    #if     GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined __cplusplus
     *    typedef gsize                           GType;
     *    #else   // for historic reasons, C++ links against gulong GTypes
     *    typedef gulong                          GType;
     *    #endif
     *
     * Et :
     *
     *    typedef unsigned $glib_size_type_define gsize;
     *
     * On prend donc le parti de conserver ces types sous forme de valeurs 64 bits
     * lors des enregistrements.
     */

} gtype_ref_info_t;


/* Définition d'une mémoire de types d'objets (instance) */
struct _GTypeMemory
{
    GObject parent;                         /* A laisser en premier        */

    gtype_ref_info_t *gtypes;               /* Types des objets reconnus   */
    size_t count;                           /* Quantité de ces objets      */
    GMutex mutex;                           /* Contrôle d'accès à la liste */

};

/* Définition d'une mémoire de types d'objets (classe) */
struct _GTypeMemoryClass
{
    GObjectClass parent;                    /* A laisser en premier        */

};



#endif  /* _GLIBEXT_TPMEM_INT_H */