Multi-ApplicationOnlineProfiling  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Key_Entry.h
Go to the documentation of this file.
1 /* ############################ MALP License ############################## */
2 /* # Fri Jan 18 14:00:00 CET 2013 # */
3 /* # Copyright or (C) or Copr. Commissariat a l'Energie Atomique # */
4 /* # # */
5 /* # This software is governed by the CeCILL-C license under French law # */
6 /* # and abiding by the rules of distribution of free software. You can # */
7 /* # use, modify and/ or redistribute the software under the terms of # */
8 /* # the CeCILL-C license as circulated by CEA, CNRS and INRIA at the # */
9 /* # following URL http://www.cecill.info. # */
10 /* # # */
11 /* # The fact that you are presently reading this means that you have # */
12 /* # had knowledge of the CeCILL-C license and that you accept its # */
13 /* # terms. # */
14 /* # # */
15 /* # Authors: # */
16 /* # - BESNARD Jean-Baptiste jean-baptiste.besnard@cea.fr # */
17 /* # # */
18 /* ######################################################################## */
19 #ifndef KEY_ENTRY_H
20 #define KEY_ENTRY_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "Spinlock.h"
27 #include "Chained_List.h"
28 
29 struct Knowledge_system;
30 
35 struct Key_entry
36 {
39  uint64_t key;
40  uint8_t freed;
41 };
42 
43 
50 void Key_entry_init( struct Key_entry *ke, uint64_t key );
51 
57 void Key_entry_release( struct Key_entry *ke );
58 
65 void Key_entry_push_ks( struct Key_entry *ke, struct Knowledge_system *ks );
66 
73 void Key_entry_pop_ks( struct Key_entry *ke, struct Knowledge_system *ks );
74 
82 struct Knowledge_system ** Key_entry_get_ks( struct Key_entry *ke, struct Knowledge_system *ks );
83 
89 void Key_entry_clear_ks( struct Key_entry *ke );
90 
97 int Key_entry_get_count( struct Key_entry *ke );
98 
106 int Key_entry_has_KS_type( struct Key_entry *ke, uint64_t type );
107 
115 void Key_entry_walk( struct Key_entry *ke, int (*handler)( struct Knowledge_system *, void *), void *arg );
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif
122 
123 
struct Chained_List target_ks
the list of Knowledge_system identified by this key entry
Definition: Key_Entry.h:37
The Knowledge_system structure.
void Key_entry_push_ks(struct Key_entry *ke, struct Knowledge_system *ks)
associates a Knowledge_system to a key entry
Definition: Key_Entry.c:93
void Key_entry_clear_ks(struct Key_entry *ke)
Clear all references to Ks in this entry.
Definition: Key_Entry.c:138
void Key_entry_pop_ks(struct Key_entry *ke, struct Knowledge_system *ks)
Removes an association between a Knowledge_system and its key.
Definition: Key_Entry.c:123
uint64_t key
the key identifier
Definition: Key_Entry.h:39
MALP_Spinlock lock
a lock for concurrent access
Definition: Key_Entry.h:38
void Key_entry_init(struct Key_entry *ke, uint64_t key)
Init a key entry with given key.
Definition: Key_Entry.c:26
void Key_entry_walk(struct Key_entry *ke, int(*handler)(struct Knowledge_system *, void *), void *arg)
Call a handler on every Ks of a key entry.
Definition: Key_Entry.c:213
This a structure wrapps the use of chained_list This is the main chain list structure to use...
Definition: Chained_List.h:273
volatile unsigned int MALP_Spinlock
The type of spinlocks in MALP.
Definition: Spinlock.h:63
int Key_entry_has_KS_type(struct Key_entry *ke, uint64_t type)
Check if a KS type is present in a key entry.
Definition: Key_Entry.c:181
struct Knowledge_system ** Key_entry_get_ks(struct Key_entry *ke, struct Knowledge_system *ks)
Search in the key entry if a Knowledge_system is associated with it.
Definition: Key_Entry.c:67
The Key_entry struct.
Definition: Key_Entry.h:35
void Key_entry_release(struct Key_entry *ke)
Clears a key entry.
Definition: Key_Entry.c:35
uint8_t freed
set to one when the entry is released, 0 otherwise
Definition: Key_Entry.h:40
int Key_entry_get_count(struct Key_entry *ke)
Get the number of Ks in this entry.
Definition: Key_Entry.c:153