diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-05-21 16:48:11 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-05-21 16:48:11 (GMT) |
commit | acd355c4c5ae25fb9cac64b8dc17407a2bcc979b (patch) | |
tree | d5b43201049116cd9734ff554e61ed8a7e0084cc /src/arch/sharing/instance.c | |
parent | 4691a434a34a19317156a761967f719e408b73bb (diff) |
Refined the whole share system for operands.
Diffstat (limited to 'src/arch/sharing/instance.c')
-rw-r--r-- | src/arch/sharing/instance.c | 64 |
1 files changed, 58 insertions, 6 deletions
diff --git a/src/arch/sharing/instance.c b/src/arch/sharing/instance.c index 39dacec..05081bb 100644 --- a/src/arch/sharing/instance.c +++ b/src/arch/sharing/instance.c @@ -71,7 +71,7 @@ static void g_shared_instance_default_init(GSharedInstanceInterface *iface) * * ******************************************************************************/ -bool g_shared_instance_init(GSharedInstance *instance, const GSharedInstance *template) +bool g_shared_instance_apply_template(GSharedInstance *instance, const GSharedInstance *template) { bool result; /* Bilan à retourner */ GSharedInstanceIface *iface; /* Interface utilisée */ @@ -83,7 +83,7 @@ bool g_shared_instance_init(GSharedInstance *instance, const GSharedInstance *te * à la différence d'une opération de copie minimaliste. */ - result = iface->init(instance, template); + result = iface->apply_template(instance, template); return result; @@ -103,7 +103,7 @@ bool g_shared_instance_init(GSharedInstance *instance, const GSharedInstance *te * * ******************************************************************************/ -void g_shared_instance_quickly_copy(const GSharedInstance *instance, GSharedInstance *template) +void g_shared_instance_define_template(const GSharedInstance *instance, GSharedInstance *template) { GSharedInstanceIface *iface; /* Interface utilisée */ @@ -114,7 +114,59 @@ void g_shared_instance_quickly_copy(const GSharedInstance *instance, GSharedInst * Ce genre de traitement est réservé à la phase d'initialisation. */ - iface->qck_copy(instance, template); + iface->define_template(instance, template); + +} + + +/****************************************************************************** +* * +* Paramètres : instance = objet partagé à modifier. * +* * +* Description : Incrémente le compteur de références d'un élément partagé. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_shared_instance_ref(GSharedInstance *instance) +{ + GSharedInstanceIface *iface; /* Interface utilisée */ + GShareManager *manager; /* Gestionnaire associé */ + + iface = G_SHARED_INSTANCE_GET_IFACE(instance); + + manager = iface->get_manager(instance); + + g_share_manager_get(manager, instance); + +} + + +/****************************************************************************** +* * +* Paramètres : instance = objet partagé à modifier. * +* * +* Description : Décrémente le compteur de références d'un élément partagé. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_shared_instance_unref(GSharedInstance *instance) +{ + GSharedInstanceIface *iface; /* Interface utilisée */ + GShareManager *manager; /* Gestionnaire associé */ + + iface = G_SHARED_INSTANCE_GET_IFACE(instance); + + manager = iface->get_manager(instance); + + g_share_manager_put(manager, instance); } @@ -201,7 +253,7 @@ void g_shared_instance_dec_references(GSharedInstance *instance) * * ******************************************************************************/ -int g_shared_instance_quickly_compare(const GSharedInstance **a, const GSharedInstance **b) +int g_shared_instance_compare(const GSharedInstance * const *a, const GSharedInstance * const *b) { int result; /* Bilan à faire remonter */ GSharedInstanceIface *iface; /* Interface utilisée */ @@ -214,7 +266,7 @@ int g_shared_instance_quickly_compare(const GSharedInstance **a, const GSharedIn iface = G_SHARED_INSTANCE_GET_IFACE(*b); - result = iface->qck_cmp(b, a) * -1; + result = iface->compare(b, a) * -1; return result; |