diff src/oct-stream.h @ 8902:5d5db7a347c6

erase closed files from file list & cache lookup
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 03 Mar 2009 08:01:07 +0100
parents a1dbe9d80eee
children eb63fbe60fab
line wrap: on
line diff
--- a/src/oct-stream.h
+++ b/src/oct-stream.h
@@ -629,7 +629,7 @@
 {
 protected:
 
-  octave_stream_list (void) : list () { }
+  octave_stream_list (void) : list (), lookup_cache (list.end ()) { }
 
 public:
 
@@ -649,7 +649,7 @@
   static int remove (const octave_value& fid,
 		     const std::string& who = std::string ());
 
-  static void clear (void);
+  static void clear (bool flush = true);
 
   static string_vector get_info (int fid);
   static string_vector get_info (const octave_value& fid);
@@ -666,6 +666,8 @@
 
   ostrl_map list;
 
+  mutable ostrl_map::const_iterator lookup_cache;
+
   static octave_stream_list *instance;
 
   int do_insert (octave_stream& os);
@@ -677,7 +679,7 @@
   int do_remove (int fid, const std::string& who = std::string ());
   int do_remove (const octave_value& fid, const std::string& who = std::string ());
 
-  void do_clear (void);
+  void do_clear (bool flush = true);
 
   string_vector do_get_info (int fid) const;
   string_vector do_get_info (const octave_value& fid) const;