36 if( sensivity_count == 0 )
38 printf(
"Cannot create a KS with sensitity 0 ! \n");
158 for( i = 0 ; i < ks->sensivity_count ; i++ )
160 if( ( de->key == ks->sensivity_keys[i] )
161 && ( ks->sensivity_array[i] == 0 ) )
171 for( i = 0 ; i < ks->sensivity_count ; i++ )
173 if( de->key == ks->sensivity_keys[i] )
188 ks->sensivity_array[local_id]++;
216 if( ks->sensivity_count )
227 for( i = 0 ; i < ks->sensivity_count ; i++ )
237 ks->sensivity_array[i]--;
uint64_t * sensivity_array
struct Buffered_FIFO * data_entries
struct Knowledge_system_job Knowledge_system_job_new(struct Knowledge_system *ks)
Knowledge_system_job_new.
struct Data_entry ** entries
struct Knowledge_system_job Knowledge_system_submit_data_entry(struct Knowledge_system *ks, struct Data_entry *de)
Knowledge_system_submit_data_entry.
The Knowledge_system structure.
void Buffered_FIFO_release(struct Buffered_FIFO *fifo, void(*free_func)(void *))
releases a FIFO
This is a struct defining a FIFO It is composed of several Buffered_FIFO_chunk.
void * Buffered_FIFO_push(struct Buffered_FIFO *fifo, void *elem)
Pushes an element into a FIFO.
void * Buffered_FIFO_pop(struct Buffered_FIFO *fifo, void *dest)
Pops an element from a FIFO.
void Knowledge_system_set_serial(struct Knowledge_system *ks, int is_serial)
sets the parallelism mode for this KS
int MALP_Spinlock_unlock(MALP_Spinlock *mutex)
Unlocks the given MALP_Spinlock.
struct representing a job that does the actual data processing (created by Knowledge_system) ...
The MALP_blackboard structure.
void(* process)(struct MALP_blackboard *bb, struct Data_entry **de, uint32_t entry_count, void *arg)
void Knowledge_system_set_process(struct Knowledge_system *ks, void(*process)(struct MALP_blackboard *bb, struct Data_entry **de, uint32_t entry_count, void *arg), void *arg)
sets the processing function to a Knowledge_system
int MALP_Spinlock_lock(MALP_Spinlock *mutex)
Locks the given MALP_Spinlock.
int Knowledge_system_has_unsatisfied_sensivities(struct Knowledge_system *ks)
Knowledge_system_has_unsatisfied_sensivities.
void Knowledge_system_release(struct Knowledge_system *ks)
Knowledge_system release.
void(* process)(struct MALP_blackboard *bb, struct Data_entry **de, uint32_t entry_count, void *arg)
uint64_t ks_type
the type of Knowledge_system
void Buffered_FIFO_init(struct Buffered_FIFO *fifo, uint64_t chunk_size, size_t elem_size)
Initializes a Buffered_FIFO.
Struct defining a piece of data that can exist on the blackboard.
uint64_t * sensivity_keys
void Knowledge_system_job_release(struct Knowledge_system_job *ksj)
Knowledge_system_job_release.
void Knowledge_system_init(struct Knowledge_system *ks, uint64_t type, uint64_t *sensivity_keys, uint32_t sensivity_count, void(*process)(struct MALP_blackboard *bb, struct Data_entry **de, uint32_t entry_count, void *arg), void *arg)
Initializes a Knowledge_system.