Mercurial > hg > octave-lyh
comparison 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 |
comparison
equal
deleted
inserted
replaced
8901:821f0242e8c1 | 8902:5d5db7a347c6 |
---|---|
627 OCTINTERP_API | 627 OCTINTERP_API |
628 octave_stream_list | 628 octave_stream_list |
629 { | 629 { |
630 protected: | 630 protected: |
631 | 631 |
632 octave_stream_list (void) : list () { } | 632 octave_stream_list (void) : list (), lookup_cache (list.end ()) { } |
633 | 633 |
634 public: | 634 public: |
635 | 635 |
636 ~octave_stream_list (void) { } | 636 ~octave_stream_list (void) { } |
637 | 637 |
647 | 647 |
648 static int remove (int fid, const std::string& who = std::string ()); | 648 static int remove (int fid, const std::string& who = std::string ()); |
649 static int remove (const octave_value& fid, | 649 static int remove (const octave_value& fid, |
650 const std::string& who = std::string ()); | 650 const std::string& who = std::string ()); |
651 | 651 |
652 static void clear (void); | 652 static void clear (bool flush = true); |
653 | 653 |
654 static string_vector get_info (int fid); | 654 static string_vector get_info (int fid); |
655 static string_vector get_info (const octave_value& fid); | 655 static string_vector get_info (const octave_value& fid); |
656 | 656 |
657 static std::string list_open_files (void); | 657 static std::string list_open_files (void); |
663 private: | 663 private: |
664 | 664 |
665 typedef std::map<int, octave_stream> ostrl_map; | 665 typedef std::map<int, octave_stream> ostrl_map; |
666 | 666 |
667 ostrl_map list; | 667 ostrl_map list; |
668 | |
669 mutable ostrl_map::const_iterator lookup_cache; | |
668 | 670 |
669 static octave_stream_list *instance; | 671 static octave_stream_list *instance; |
670 | 672 |
671 int do_insert (octave_stream& os); | 673 int do_insert (octave_stream& os); |
672 | 674 |
675 const std::string& who = std::string ()) const; | 677 const std::string& who = std::string ()) const; |
676 | 678 |
677 int do_remove (int fid, const std::string& who = std::string ()); | 679 int do_remove (int fid, const std::string& who = std::string ()); |
678 int do_remove (const octave_value& fid, const std::string& who = std::string ()); | 680 int do_remove (const octave_value& fid, const std::string& who = std::string ()); |
679 | 681 |
680 void do_clear (void); | 682 void do_clear (bool flush = true); |
681 | 683 |
682 string_vector do_get_info (int fid) const; | 684 string_vector do_get_info (int fid) const; |
683 string_vector do_get_info (const octave_value& fid) const; | 685 string_vector do_get_info (const octave_value& fid) const; |
684 | 686 |
685 std::string do_list_open_files (void) const; | 687 std::string do_list_open_files (void) const; |