Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
tempmem.h
Go to the documentation of this file.
1 /*************************************************************************
2  * PLEASE SEE THE FILE "license.txt" (INCLUDED WITH THIS SOFTWARE PACKAGE)
3  * FOR LICENSE AND COPYRIGHT INFORMATION.
4  *************************************************************************/
5 
6 /* ---------------------------------------------------------------------
7  tempmem.h
8 
9  Find_slot() looks for an existing slot for a given id/attr pair, and
10  returns it if found. If no such slot exists, it returns NIL.
11  Make_slot() looks for an existing slot for a given id/attr pair,
12  returns it if found, and otherwise creates a new slot and returns it.
13 
14  Mark_slot_as_changed() is called by the preference manager whenever
15  the preferences for a slot change. This updates the list of
16  changed_slots and highest_goal_whose_context_changed for use by the
17  decider.
18 
19  Old slots are garbage collected as follows: whenever we notice that
20  the last preference has been removed from a slot, we call
21  mark_slot_for_possible_removal(). We don't deallocate the slot
22  right away, because there might still be wmes in it, or we might
23  be about to add a new preference to it (through some later action
24  of the same production firing, for example). At the end of the phase,
25  we call remove_garbage_slots(), which scans through each marked slot
26  and garbage collects it if it has no wmes or preferences.
27 --------------------------------------------------------------------- */
28 
29 #ifndef TEMPMEM_H
30 #define TEMPMEM_H
31 
32 #ifdef __cplusplus
33 //extern "C"
34 //{
35 #endif
36 
37 typedef char Bool;
38 typedef union symbol_union Symbol;
39 typedef struct slot_struct slot;
40 typedef struct agent_struct agent;
41 
42 extern slot *find_slot (Symbol *id, Symbol *attr);
43 extern slot *make_slot (agent* thisAgent, Symbol *id, Symbol *attr);
44 extern void mark_slot_as_changed (agent* thisAgent, slot *s);
45 extern void mark_slot_for_possible_removal (agent* thisAgent, slot *s);
46 extern void remove_garbage_slots (agent* thisAgent);
47 
48 #ifdef __cplusplus
49 //}
50 #endif
51 
52 #endif