Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
xml.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  xml.h
8  * =======================================================================
9  *
10  * Contains methods for generating XML objects in response to kernel commands.
11  *
12  * The commands are modelled after the existing kernel functions which are tied to generating
13  * string output. In the past we added code to some of those functions so they'd
14  * generate string output and also XML output (as a string: <aaa>...</aaa>). To capture
15  * the XML output a caller would register for the XML callback, generate the XML as a string,
16  * parse the XML back to an object and return it.
17  *
18  * These methods generate XML as an object, so there are no strings being created
19  * and subsequently parsed and no need to "intercept" the XML callback channel (which is
20  * really for XML trace output to the debugger, not for results from commands).
21  * This new approach is more efficient to both create and to subsequently use.
22 
23 ======================================================================= */
24 
25 #ifndef SOAR_XML_H
26 #define SOAR_XML_H
27 
28 typedef struct agent_struct agent;
29 typedef struct wme_struct wme;
30 typedef union symbol_union Symbol;
31 
32 void xml_create( agent* pAgent );
33 void xml_reset( agent* pAgent );
34 void xml_destroy( agent* pAgent );
35 
36 void xml_begin_tag( agent* pAgent, char const* pTag ) ;
37 void xml_end_tag( agent* pAgent, char const* pTag ) ;
38 
39 void xml_move_current_to_parent( agent* pAgent ) ;
40 void xml_move_current_to_child( agent* pAgent, int index ) ;
41 void xml_move_current_to_last_child( agent* pAgent ) ;
42 
43 void xml_att_val( agent* pAgent, char const* pAttribute, uint64_t value ) ;
44 void xml_att_val( agent* pAgent, char const* pAttribute, int value ) ;
45 void xml_att_val( agent* pAgent, char const* pAttribute, int64_t value ) ;
46 void xml_att_val( agent* pAgent, char const* pAttribute, double value ) ;
47 void xml_att_val( agent* pAgent, char const* pAttribute, char const* pValue ) ;
48 void xml_att_val( agent* pAgent, char const* pAttribute, Symbol* pSymbol ) ;
49 
50 void xml_object( agent* pAgent, char const* pTag ) ;
51 void xml_object( agent* pAgent, char const* pTag, char const* pAttribute, char const* pValue ) ;
52 void xml_object( agent* pAgent, char const* pTag, char const* pAttribute, uint64_t value ) ;
53 void xml_object( agent* pAgent, char const* pTag, char const* pAttribute, int64_t value ) ;
54 void xml_object( agent* pAgent, char const* pTag, char const* pAttribute, double value ) ;
55 
56 #define XML_WME_NO_TIMETAG false
57 void xml_object( agent* pAgent, wme* pWME, bool printTimetag = true ) ;
58 
59 void xml_generate_warning( agent* pAgent, const char* pMessage);
60 void xml_generate_error( agent* pAgent, const char* pMessage);
61 void xml_generate_message( agent* pAgent, const char* pMessage);
62 void xml_generate_verbose( agent* pAgent, const char* pMessage);
63 
64 void xml_invoke_callback( agent* pAgent );
65 
66 // BADBAD: The kernel should not use these methods. This method should probably be in a different header.
67 namespace soarxml
68 {
69  class ElementXML;
70 }
71 
72 soarxml::ElementXML* xml_get_xml( agent* pAgent );
73 void xml_begin_command_mode( agent* pAgent );
74 soarxml::ElementXML* xml_end_command_mode( agent* pAgent );
75 
76 #endif