summaryrefslogtreecommitdiff
path: root/src/arch/operands/proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/operands/proxy.c')
-rw-r--r--src/arch/operands/proxy.c75
1 files changed, 71 insertions, 4 deletions
diff --git a/src/arch/operands/proxy.c b/src/arch/operands/proxy.c
index bf26a4f..992c481 100644
--- a/src/arch/operands/proxy.c
+++ b/src/arch/operands/proxy.c
@@ -44,11 +44,14 @@ static void g_proxy_operand_dispose(GProxyOperand *);
static void g_proxy_operand_finalize(GProxyOperand *);
/* Compare un opérande avec un autre. */
-static int g_proxy_operand_compare(const GProxyOperand *, const GProxyOperand *);
+static int g_proxy_operand_compare(const GProxyOperand *, const GProxyOperand *, bool);
/* Traduit un opérande en version humainement lisible. */
static void g_proxy_operand_print(const GProxyOperand *, GBufferLine *);
+/* Fournit l'empreinte d'un candidat à une centralisation. */
+static guint g_proxy_operand_hash(const GProxyOperand *, bool);
+
/* --------------------- TRANSPOSITIONS VIA CACHE DES OPERANDES --------------------- */
@@ -98,6 +101,8 @@ static void g_proxy_operand_class_init(GProxyOperandClass *klass)
operand->compare = (operand_compare_fc)g_proxy_operand_compare;
operand->print = (operand_print_fc)g_proxy_operand_print;
+ operand->hash = (operand_hash_fc)g_proxy_operand_hash;
+
operand->unserialize = (unserialize_operand_fc)g_proxy_operand_unserialize;
operand->serialize = (serialize_operand_fc)g_proxy_operand_serialize;
@@ -190,8 +195,9 @@ GArchOperand *g_proxy_operand_new(GProxyFeeder *feeder)
/******************************************************************************
* *
-* Paramètres : a = premier opérande à consulter. *
-* b = second opérande à consulter. *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* lock = précise le besoin en verrouillage. *
* *
* Description : Compare un opérande avec un autre. *
* *
@@ -201,12 +207,36 @@ GArchOperand *g_proxy_operand_new(GProxyFeeder *feeder)
* *
******************************************************************************/
-static int g_proxy_operand_compare(const GProxyOperand *a, const GProxyOperand *b)
+static int g_proxy_operand_compare(const GProxyOperand *a, const GProxyOperand *b, bool lock)
{
int result; /* Bilan à retourner */
+ lockable_obj_extra_t *ea; /* Données insérées à consulter*/
+ lockable_obj_extra_t *eb; /* Données insérées à consulter*/
+ GArchOperandClass *class; /* Classe parente normalisée */
+
+ ea = GET_GOBJECT_EXTRA(G_OBJECT(a), lockable_obj_extra_t);
+ eb = GET_GOBJECT_EXTRA(G_OBJECT(b), lockable_obj_extra_t);
+
+ if (lock)
+ {
+ LOCK_GOBJECT_EXTRA(ea);
+ LOCK_GOBJECT_EXTRA(eb);
+ }
result = g_proxy_feeder_compare(a->feeder, b->feeder);
+ if (result == 0)
+ {
+ class = G_ARCH_OPERAND_CLASS(g_proxy_operand_parent_class);
+ result = class->compare(G_ARCH_OPERAND(a), G_ARCH_OPERAND(b), false);
+ }
+
+ if (lock)
+ {
+ UNLOCK_GOBJECT_EXTRA(eb);
+ UNLOCK_GOBJECT_EXTRA(ea);
+ }
+
return result;
}
@@ -234,6 +264,43 @@ static void g_proxy_operand_print(const GProxyOperand *operand, GBufferLine *lin
/******************************************************************************
* *
+* Paramètres : operand = objet dont l'instance se veut unique. *
+* lock = précise le besoin en verrouillage. *
+* *
+* Description : Fournit l'empreinte d'un candidat à une centralisation. *
+* *
+* Retour : Empreinte de l'élément représenté. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static guint g_proxy_operand_hash(const GProxyOperand *operand, bool lock)
+{
+ guint result; /* Valeur à retourner */
+ lockable_obj_extra_t *extra; /* Données insérées à consulter*/
+ GArchOperandClass *class; /* Classe parente normalisée */
+
+ extra = GET_GOBJECT_EXTRA(G_OBJECT(operand), lockable_obj_extra_t);
+
+ if (lock)
+ LOCK_GOBJECT_EXTRA(extra);
+
+ class = G_ARCH_OPERAND_CLASS(g_proxy_operand_parent_class);
+ result = class->hash(G_ARCH_OPERAND(operand), false);
+
+ result ^= g_direct_hash(operand->feeder);
+
+ if (lock)
+ UNLOCK_GOBJECT_EXTRA(extra);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : operand = opérande à consulter. *
* *
* Description : Fournit le fournisseur représenté par l'opérande. *