メインページ   クラス階層   構成   ファイル一覧   構成メンバ   ファイルメンバ  

oct-shlib.h

解説を見る。
00001 /*
00002 
00003 Copyright (C) 1999 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 2, or (at your option) any
00010 later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, write to the Free
00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021 */
00022 
00023 #if !defined (octave_shlib_h)
00024 #define octave_shlib_h 1
00025 
00026 #include <string>
00027 
00028 #include "oct-time.h"
00029 
00030 // This just provides a way to avoid infinite recursion when building
00031 // octave_shlib objects.
00032 
00033 class
00034 octave_xshlib
00035 {
00036 public:
00037 
00038   octave_xshlib (void) { }
00039 };
00040 
00041 class
00042 octave_shlib
00043 {
00044 public:
00045 
00046   typedef std::string (*name_mangler) (const std::string&);
00047 
00048   typedef void (*close_hook) (const std::string&);
00049 
00050   octave_shlib (void) : rep (make_shlib ()) { }
00051 
00052   octave_shlib (const std::string& f, bool warn_future)
00053     : rep (make_shlib ())
00054   {
00055     open (f, warn_future);
00056   }
00057 
00058   virtual ~octave_shlib (void)
00059     {
00060       if (rep && --rep->count == 0)
00061         {
00062           delete rep;
00063           rep = 0;
00064         }
00065     }
00066 
00067   octave_shlib (const octave_shlib& sl)
00068     {
00069       rep = sl.rep;
00070       rep->count++;
00071     }
00072 
00073   octave_shlib& operator = (const octave_shlib& sl)
00074     {
00075       if (rep != sl.rep)
00076         {
00077           if (--rep->count == 0)
00078             delete rep;
00079 
00080           rep = sl.rep;
00081           rep->count++;
00082         }
00083 
00084       return *this;
00085     }
00086 
00087   bool operator == (const octave_shlib& sl) const
00088     { return (rep == sl.rep); }
00089 
00090   operator bool () const { return is_open (); }
00091 
00092   virtual void open (const std::string& f, bool warn_future = false)
00093     { rep->open (f, warn_future); }
00094   
00095   virtual void *search (const std::string& nm, name_mangler mangler = 0)
00096     { return rep->search (nm, mangler); }
00097 
00098   virtual void close (close_hook cl_hook = 0)
00099     { rep->close (cl_hook); }
00100 
00101   virtual bool remove (const std::string& fcn_name)
00102     { return rep->remove (fcn_name); }
00103 
00104   virtual bool is_out_of_date (void) const
00105     { return rep->is_out_of_date (); }
00106 
00107   virtual int number_of_functions_loaded (void) const
00108     { return rep->number_of_functions_loaded (); }
00109 
00110   virtual std::string file_name (void) const
00111     { return rep->file_name (); }
00112 
00113   virtual octave_time time_loaded (void) const
00114     { return rep->time_loaded (); }
00115 
00116 protected:
00117 
00118   octave_shlib (const octave_xshlib&) : rep (0) { }
00119 
00120   virtual bool is_open (void) const { return rep->is_open (); }
00121 
00122   static octave_shlib *make_shlib (void);
00123 
00124   union
00125     {
00126       octave_shlib *rep;
00127       int count;
00128     };
00129 };
00130 
00131 #endif
00132 
00133 /*
00134 ;;; Local Variables: ***
00135 ;;; mode: C++ ***
00136 ;;; End: ***
00137 */

Wed Dec 29 11:52:11 2004に生成されました。 doxygen1.2.18
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送