core/vgui/vgui_blackbox_tableau.h
Go to the documentation of this file.
00001 // This is core/vgui/vgui_blackbox_tableau.h
00002 #ifndef vgui_blackbox_tableau_h_
00003 #define vgui_blackbox_tableau_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief  Tableau for event record and playback.
00010 // \author Philip C. Pritchett, Robotics Research Group, University of Oxford
00011 // \date   13 Oct 99
00012 //
00013 //  Contains classes  vgui_blackbox_tableau  vgui_blackbox_tableau_new
00014 //
00015 // \verbatim
00016 //  Modifications
00017 //   13-OCT-1999  P.Pritchett - Initial version.
00018 //   26-APR-2002  K.Y.McGaul  - Converted to and added doxygen style comments.
00019 //   01-OCT-2002  K.Y.McGaul  - Moved vgui_blackbox to vgui_blackbox_tableau.
00020 //                            - Removed 'playback' - doesn't seem to be used.
00021 // \endverbatim
00022 
00023 #include "vgui_blackbox_tableau_sptr.h"
00024 #include <vgui/vgui_wrapper_tableau.h>
00025 #include <vgui/vgui_event.h>
00026 #include <vcl_vector.h>
00027 
00028 //: Tableau for event record and playback.
00029 //
00030 // The user can control event recording and playback by pressing the
00031 // following keys inside the rendering area:
00032 //
00033 // - `,'  start/stop record
00034 // - `.'           playback
00035 // - `s'   playback w. dump
00036 // - `/'       print events
00037 // - `#'       clear events
00038 class vgui_blackbox_tableau : public vgui_wrapper_tableau
00039 {
00040  public:
00041   //: Constructor - don't use this, use vgui_blackbox_tableau_new.
00042   vgui_blackbox_tableau(vgui_tableau_sptr const&);
00043 
00044   //: Handle all events used by this tableau.
00045   //  In particular, this tableau uses the key-strokes ',' (start/stop
00046   //  record), '.' (playback), 's' (playback w. dump), '/' (print
00047   //  events), '#' (clear events).
00048   //  Other events are passed to the child tableau.
00049   virtual bool handle(const vgui_event& event);
00050 
00051   //: Return the name of this tableau ('vgui_blackbox_tableau').
00052   virtual vcl_string type_name() const;
00053 
00054  protected:
00055   //: Destructor - called by smart-pointer vgui_blackbox_tableau_sptr.
00056  ~vgui_blackbox_tableau();
00057 
00058   //: True if events are being recorded.
00059   bool recording;
00060 
00061   //: List of recorded events.
00062   vcl_vector<vgui_event> events;
00063 };
00064 
00065 //: Create a smart-pointer to a vgui_blackbox_tableau.
00066 struct vgui_blackbox_tableau_new : public vgui_blackbox_tableau_sptr
00067 {
00068   typedef vgui_blackbox_tableau_sptr base;
00069 
00070   //: Constructor - creates a smart-pointer to a vgui_blackbox_tableau.
00071   //  Takes the single child tableau as a parameter.
00072   vgui_blackbox_tableau_new(vgui_tableau_sptr const& a) : base(new vgui_blackbox_tableau(a)) { }
00073 };
00074 
00075 #endif // vgui_blackbox_tableau_h_