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 #if !defined (octave_debug_h)
00024 #define octave_debug_h 1
00025
00026 #include <map>
00027 #include <set>
00028 #include "ov.h"
00029 #include "dRowVector.h"
00030
00031 class octave_value_list;
00032 class octave_user_code;
00033
00034
00035
00036 class
00037 OCTINTERP_API
00038 bp_table
00039 {
00040 private:
00041
00042 bp_table (void) : bp_set () { }
00043
00044 ~bp_table (void) { }
00045
00046 public:
00047
00048 typedef std::map<int, int> intmap;
00049
00050 typedef intmap::const_iterator const_intmap_iterator;
00051 typedef intmap::iterator intmap_iterator;
00052
00053 typedef std::map <std::string, intmap> fname_line_map;
00054
00055 typedef fname_line_map::const_iterator const_fname_line_map_iterator;
00056 typedef fname_line_map::iterator fname_line_map_iterator;
00057
00058 static bool instance_ok (void);
00059
00060
00061 static intmap add_breakpoint (const std::string& fname = "",
00062 const intmap& lines = intmap ())
00063 {
00064 return instance_ok ()
00065 ? instance->do_add_breakpoint (fname, lines) : intmap ();
00066 }
00067
00068
00069 static int remove_breakpoint (const std::string& fname = "",
00070 const intmap& lines = intmap ())
00071 {
00072 return instance_ok ()
00073 ? instance->do_remove_breakpoint (fname, lines) : 0;
00074 }
00075
00076
00077 static intmap remove_all_breakpoints_in_file (const std::string& fname,
00078 bool silent = false)
00079 {
00080 return instance_ok ()
00081 ? instance->do_remove_all_breakpoints_in_file (fname, silent) : intmap ();
00082 }
00083
00084
00085 static void remove_all_breakpoints (void)
00086 {
00087 if (instance_ok ())
00088 instance->do_remove_all_breakpoints ();
00089 }
00090
00091
00092
00093 static fname_line_map
00094 get_breakpoint_list (const octave_value_list& fname_list)
00095 {
00096 return instance_ok ()
00097 ? instance->do_get_breakpoint_list (fname_list) : fname_line_map ();
00098 }
00099
00100 static bool
00101 have_breakpoints (void)
00102 {
00103 return instance_ok () ? instance->do_have_breakpoints () : 0;
00104 }
00105
00106 private:
00107
00108 typedef std::set<std::string>::const_iterator const_bp_set_iterator;
00109 typedef std::set<std::string>::iterator bp_set_iterator;
00110
00111
00112 std::set<std::string> bp_set;
00113
00114 static bp_table *instance;
00115
00116 static void cleanup_instance (void) { delete instance; instance = 0; }
00117
00118 intmap do_add_breakpoint (const std::string& fname, const intmap& lines);
00119
00120 int do_remove_breakpoint (const std::string&, const intmap& lines);
00121
00122 intmap do_remove_all_breakpoints_in_file (const std::string& fname,
00123 bool silent);
00124
00125 void do_remove_all_breakpoints (void);
00126
00127 fname_line_map do_get_breakpoint_list (const octave_value_list& fname_list);
00128
00129 bool do_have_breakpoints (void) { return (! bp_set.empty ()); }
00130 };
00131
00132 std::string get_file_line (const std::string& fname, size_t line);
00133
00134 #endif