Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
utilities.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 /* utilities.h */
7 
8 #ifndef UTILITIES_H
9 #define UTILITIES_H
10 
11 #include <list>
12 #include <map>
13 
14 #include "soar_db.h"
15 
16 /*
17 * This procedure parses a string to determine if it is a
18 * lexeme for an identifier or context variable.
19 *
20 * Many interface routines take identifiers as arguments.
21 * These ids can be given as normal ids, or as special variables
22 * such as <s> for the current state, etc. This routine reads
23 * (without consuming it) an identifier or context variable,
24 * and returns a pointer (Symbol *) to the id. (In the case of
25 * context variables, the instantiated variable is returned. If
26 * any error occurs (e.g., no such id, no instantiation of the
27 * variable), an error message is printed and NIL is returned.
28 *
29 * Results:
30 * Pointer to a symbol for the variable or NIL.
31 *
32 * Side effects:
33 * None.
34 *
35 ===============================
36 */
37 extern bool read_id_or_context_var_from_string (agent* agnt, const char * the_lexeme, Symbol * * result_id);
38 extern void get_lexeme_from_string (agent* agnt, const char * the_lexeme);
39 extern void get_context_var_info ( agent* agnt, Symbol **dest_goal, Symbol **dest_attr_of_slot, Symbol **dest_current_value);
41 
42 #ifdef REAL_TIME_BEHAVIOR
43 /* RMJ */
44 extern void init_real_time (agent* thisAgent);
45 extern struct timeval *current_real_time;
46 #endif // REAL_TIME_BEHAVIOR
47 
48 #ifdef ATTENTION_LAPSE
49 /* RMJ */
50 extern void wake_from_attention_lapse ();
51 extern void init_attention_lapse ();
52 extern void start_attention_lapse (int64_t duration);
53 #endif // ATTENTION_LAPSE
54 
55 // formerly in misc.h:
57 // String functions
59 
60 // Determine if a string represents a natural number (i.e. all numbers)
61 extern bool is_whole_number(const std::string &str);
62 extern bool is_whole_number(const char * str);
63 
65 // Misc
67 
68 // get a numeric value from a symbol
69 extern double get_number_from_symbol( Symbol *sym );
70 
72 // Statistics database
74 
76 {
77  public:
79 
83 
92 
93  stats_statement_container( agent *new_agent );
94 };
95 
96 // Store statistics in to database
97 extern void stats_db_store(agent* thisAgent, const uint64_t& dc_time, const uint64_t& dc_wm_changes, const uint64_t& dc_firing_counts);
98 
99 extern void stats_close( agent *my_agent );
100 
101 // Useful for converting enumerations to string
102 #define stringify( name ) # name
103 
104 /* derived_kernel_time := Total of the time spent in the phases of the decision cycle,
105 excluding Input Function, Output function, and pre-defined callbacks.
106 This computed time should be roughly equal to total_kernel_time,
107 as determined above. */
108 uint64_t get_derived_kernel_time_usec(agent* thisAgent);
109 
110 
111 #endif //UTILITIES_H