Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef IWAKISI_H
00027 #define IWAKISI_H
00028 
00029 #include "iwaki.h"
00030 #include <iostream>
00031 #include <deque>
00032 
00033 
00034 
00035 
00036 
00037 
00038 #define NO_EXEC
00039 
00040 #define TICK_BB_VAR "tick"
00041 #define TICK_FORMAT "int"
00042 
00043 #define OUTPUT_IM_STRING "output_im_string"
00044 #define OUTPUT_IM_FORMAT "{int, string}"
00045 #define INVITE_IM_STRING "invite_im_string"
00046 #define INVITE_IM_FORMAT "{int, string}"
00047 
00048 #define ACTION_DISPATCH_BB_VAR "action_dispatch"
00049 #define ACTION_STATUS_BB_VAR "action_status"
00050 
00051 #define ACTION_TIMING_BB_VAR "action_timing"
00052 #define ACTION_TIMING_RESPONSE_BB_VAR "action_timing_response"
00053 #define ACTION_TIMING_RESPONSE_FORMAT "{int, float}"
00054 
00055 
00056 #define BB_USER_RECORD "user_record"
00057 #define BB_USER_RECORD_TYPE User
00058 #define MAX_UI_MSGS 100
00059 #define MAX_LOGFILE_SIZE 100000000
00060 #define MAX_ELEMENT_AGE 1000
00061 #define MAX_UI_TICK_ID 100000
00062 
00063 #define ABORT_ACTION_NAME "abort_action"
00064 
00065 enum UICommand {uiQuit, uiNone};
00066 enum VerbosityLevel {Brief, Verbose, WithBodyElements};
00067 
00071 class TextUI{
00072   public:
00073         
00074     TextUI(): verbosity(Brief), msgPaneHeight(5), minTreeHeight(3), tick_id(0) { }
00075 
00076   public:
00077     UICommand update(InteractionManager &im, int ch);
00078     void init();
00079     void close();
00080     void printPlanTree(PlanTree &tr, const int &tree_height);
00081     void printHeader();
00082     void printMessages(const int &msg_height);
00083     void printKeyboardBuffer();
00084     void push_msg(const string &msg);
00085     void processBodyElementDescriptions();
00086     void setBodyElementDescriptions(Node &aNode);
00087     void updateBodyElementDescriptions(Node &aNode);
00088     void updateBodyElementDescription(Node &aNode, int element_id);
00089     string makeFutureActionDescription(BodyElement &element);
00090     string makePastActionDescription(BodyElement &element);
00091     string makeActionDescription(BodyElement &element, int active_element, int element_id);
00092     std::map<string, int> getAtomSubtypeCounts(Conjunction &gBindings);
00093     void printGlobals(Conjunction &gBindings);
00094   public:
00095     VerbosityLevel verbosity;
00096     int msgPaneHeight;
00097     int minTreeHeight;
00098     std::list< string > messages;
00099     int tick_id;
00100     string keyboardBuffer;
00101 };
00102 
00103 
00104 
00105 bool executeAction(Action &an_action);
00106 void hndAction(Action &an_action, ActionStatus &astat);
00107 
00108 
00109 void hndActionCompletionStatus(ActionStatus &astat);
00110 
00111 #endif // GIM_H