changeset 12122:f4689107dd8c

Explicitly disallow copying in some classes.
author Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
date Sat, 22 Jan 2011 02:21:52 -0500
parents 62b7ea59a6ff
children 9ea6f69259d7
files liboctave/ChangeLog liboctave/SparseCmplxQR.h liboctave/oct-fftw.h liboctave/oct-sort.h liboctave/sparse-base-chol.h src/ChangeLog src/DLD-FUNCTIONS/__init_fltk__.cc src/c-file-ptr-stream.h src/gl-render.cc src/lex.ll src/mex.cc src/oct-procbuf.h src/pt-cbinop.h src/symtab.h src/txt-eng-ft.cc src/txt-eng-ft.h src/unwind-prot.h src/zfstream.h
diffstat 18 files changed, 269 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Fri Jan 21 20:22:42 2011 +0100
+++ b/liboctave/ChangeLog	Sat Jan 22 02:21:52 2011 -0500
@@ -1,3 +1,14 @@
+2011-01-21  Pascal Dupuis <Pascal.Dupuis@worldonline.be>
+
+	* oct-fftw.h (class octave_fftw_planner): Disallow copying
+	(class octave_float_fftw_planner): Likewise.
+	* oct-sort.h (class octave_sort): Likewise.
+	(struct oct_sort::MergeState): Likewise.
+	* SparseCmplxQR.h (class SparseComplexQR::SparseComplexQR_rep):
+	Likewise.
+	* sparse-base-chol.h (class sparse_base_cho::sparse_base_chol_rep):
+	Likewise.
+
 2011-01-21  John W. Eaton  <jwe@octave.org>
 
 	* CMatrix.cc (xgemm): Initialize output matrix for call to ZHERK.
--- a/liboctave/SparseCmplxQR.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/liboctave/SparseCmplxQR.h	Sat Jan 22 02:21:52 2011 -0500
@@ -73,6 +73,14 @@
 
     CXSPARSE_ZNAME (n) *N;
 #endif
+  private:
+
+    // No copying!
+
+    SparseComplexQR_rep (const SparseComplexQR_rep&);
+
+    SparseComplexQR_rep operator = (const SparseComplexQR_rep&);
+
   };
 private:
   SparseComplexQR_rep *rep;
--- a/liboctave/oct-fftw.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/liboctave/oct-fftw.h	Sat Jan 22 02:21:52 2011 -0500
@@ -100,6 +100,12 @@
 
 private:
 
+  // No copying!
+
+  octave_fftw_planner (const octave_fftw_planner&);
+
+  octave_fftw_planner& operator = (const octave_fftw_planner&);
+
   static octave_fftw_planner *instance;
 
   fftw_plan
@@ -229,6 +235,12 @@
 
 private:
 
+  // No copying!
+
+  octave_float_fftw_planner (const octave_float_fftw_planner&);
+
+  octave_float_fftw_planner& operator = (const octave_float_fftw_planner&);
+
   static octave_float_fftw_planner *instance;
 
   fftwf_plan
--- a/liboctave/oct-sort.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/liboctave/oct-sort.h	Sat Jan 22 02:21:52 2011 -0500
@@ -218,6 +218,12 @@
     // and keeping all the info explicit simplifies the code.
     octave_idx_type n;
     struct s_slice pending[MAX_MERGE_PENDING];
+
+    // No copying!
+
+    MergeState (const MergeState&);
+
+    MergeState& operator = (const MergeState&);
   };
 
   compare_fcn_type compare;
@@ -322,6 +328,12 @@
   void nth_element (T *data, octave_idx_type nel,
                     octave_idx_type lo, octave_idx_type up,
                     Comp comp);
+
+  // No copying!
+
+  octave_sort (const octave_sort&);
+
+  octave_sort& operator = (const octave_sort&);
 };
 
 template <class T>
--- a/liboctave/sparse-base-chol.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/liboctave/sparse-base-chol.h	Sat Jan 22 02:21:52 2011 -0500
@@ -97,8 +97,11 @@
 
     void drop_zeros (const cholmod_sparse* S);
 
-    // No assignment
-    sparse_base_chol_rep& operator = (const sparse_base_chol_rep& a);
+    // No copying!
+
+    sparse_base_chol_rep (const sparse_base_chol_rep&);
+
+    sparse_base_chol_rep& operator = (const sparse_base_chol_rep&);
   };
 #else
   class sparse_base_chol_rep
@@ -142,8 +145,11 @@
 
     octave_idx_type init (const chol_type& a, bool natural = true);
 
-    // No assignment
-    sparse_base_chol_rep& operator = (const sparse_base_chol_rep& a);
+    // No copying!
+
+    sparse_base_chol_rep (const sparse_base_chol_rep&);
+
+    sparse_base_chol_rep& operator = (const sparse_base_chol_rep&);
   };
 #endif
 
--- a/src/ChangeLog	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/ChangeLog	Sat Jan 22 02:21:52 2011 -0500
@@ -1,3 +1,38 @@
+2011-01-22  Pascal Dupuis <Pascal.Dupuis@worldonline.be>
+
+	* DLD-FUNCTIONS/__init_fltk__.cc (fltk_uimenu): Disallow copying.
+	(class plot_window): Likewise.
+	* c-file-ptr-stream.h (class c_file_ptr_buf): Likewise.
+	(class c_file_ptr_stream): Likewise.
+	(class c_zfile_ptr_buf): Likewise.
+	* gl-render.cc (class opengl_tesselator): Likewise.
+	(class patch_tesselator): Likewise.
+	* lex.ll (class flex_stream_reader): Likewise.
+	* mex.cc (class mex): Likewise.
+	* oct-procbuf.h (class octave_procbuf): Likewise.
+	* pt-cbinop.h (class tree_compound_binary_expression): Likewise.
+	* symtab.h (class scope_id_cache): Likewise.
+	(class symbol_table): Likewise.
+	* txt-eng-ft.h (class ft_manager): Likewise.
+	(class ft_render): Likewise.
+	* unwind-prot.h (class unwind_protect::elem): Likewise.
+	(class unwind_protect::fcn_arg_elem): Likewise.
+	(class unwind_protect::method_elem): Likewise.
+	(class unwind_protect::restore_var_elem): Likewise.
+	(class unwind_protect::delete_ptr_elem): Likewise.
+	(class unwind_protect): Likewise.
+	* zfstream.h (class gzfilebuf): Likewise.
+
+	* mex.cc (class mxArray_octave_value): Disallow assignment.
+	(class mxArray_matlab): Likewise.
+	(class mxArray_number): Likewise.
+	(class mxArray_sparse): Likewise.
+	(class mxArray_struct): Likewise.
+	(class mxArray_cell): Likewise.
+
+	* unwind-prot.h (unwind_protect::elem::elem):
+	Provide default constructor.
+
 2011-01-21  Konstantinos Poulios  <logari81@googlemail.com>
 
 	* src/graphics.cc (axes::properties::set_xlabel,
--- a/src/DLD-FUNCTIONS/__init_fltk__.cc	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/DLD-FUNCTIONS/__init_fltk__.cc	Sat Jan 22 02:21:52 2011 -0500
@@ -608,6 +608,13 @@
     }
 
 private:
+
+  // No copying!
+
+  fltk_uimenu (const fltk_uimenu&);
+
+  fltk_uimenu operator = (const fltk_uimenu&);
+
   Fl_Menu_Bar* menubar;
 };
 
@@ -870,6 +877,13 @@
   }
 
 private:
+
+  // No copying!
+
+  plot_window (const plot_window&);
+
+  plot_window& operator = (const plot_window&);
+
   // window name -- this must exists for the duration of the window's
   // life
   std::string window_label;
--- a/src/c-file-ptr-stream.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/c-file-ptr-stream.h	Sat Jan 22 02:21:52 2011 -0500
@@ -92,6 +92,12 @@
 private:
 
   int_type underflow_common (bool);
+
+  // No copying!
+
+  c_file_ptr_buf (const c_file_ptr_buf&);
+
+  c_file_ptr_buf& operator = (const c_file_ptr_buf&);
 };
 
 // FIXME -- the following three classes could probably share
@@ -122,6 +128,12 @@
 private:
 
   BUF_T *buf;
+
+  // No copying!
+
+  c_file_ptr_stream (const c_file_ptr_stream&);
+
+  c_file_ptr_stream& operator = (const c_file_ptr_stream&);
 };
 
 typedef c_file_ptr_stream<std::istream, FILE *, c_file_ptr_buf> i_c_file_ptr_stream;
@@ -199,6 +211,12 @@
 private:
 
   int_type underflow_common (bool);
+
+  // No copying!
+
+  c_zfile_ptr_buf (const c_zfile_ptr_buf&);
+
+  c_zfile_ptr_buf& operator = (const c_zfile_ptr_buf&);
 };
 
 typedef c_file_ptr_stream<std::istream, gzFile, c_zfile_ptr_buf> i_c_zfile_ptr_stream;
--- a/src/gl-render.cc	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/gl-render.cc	Sat Jan 22 02:21:52 2011 -0500
@@ -323,6 +323,13 @@
     { reinterpret_cast<opengl_tesselator *> (t)->error (err); }
 
 private:
+
+  // No copying!
+
+  opengl_tesselator (const opengl_tesselator&);  
+
+  opengl_tesselator operator = (const opengl_tesselator&);  
+
   GLUtesselator *glu_tess;
   bool fill;
 };
@@ -527,6 +534,13 @@
     }
 
 private:
+
+  // No copying!
+
+  patch_tesselator (const patch_tesselator&);
+
+  patch_tesselator& operator = (const patch_tesselator&);
+
   opengl_renderer *renderer;
   int color_mode;       // 0: uni,  1: flat, 2: interp
   int light_mode;       // 0: none, 1: flat, 2: gouraud
--- a/src/lex.ll	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/lex.ll	Sat Jan 22 02:21:52 2011 -0500
@@ -1881,6 +1881,13 @@
   int ungetc (int c) { ::xunput (c, buf); return 0; }
 
 private:
+
+  // No copying!
+
+  flex_stream_reader (const flex_stream_reader&);
+
+  flex_stream_reader& operator = (const flex_stream_reader&);	
+
   char *buf;
 };
 
--- a/src/mex.cc	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/mex.cc	Sat Jan 22 02:21:52 2011 -0500
@@ -715,6 +715,11 @@
   mutable char *class_name;
   mutable mwSize ndims;
   mutable mwSize *dims;
+
+  // No assignment!  FIXME -- should this be implemented?  Note that we
+  // do have a copy constructor.
+
+  mxArray_octave_value& operator = (const mxArray_octave_value&);
 };
 
 // The base class for the Matlab-style representation, used to handle
@@ -1093,6 +1098,11 @@
   {
     error ("invalid type for operation");
   }
+
+  // No assignment!  FIXME -- should this be implemented?  Note that we
+  // do have a copy constructor.
+
+  mxArray_matlab& operator = (const mxArray_matlab&);
 };
 
 // Matlab-style numeric, character, and logical data.
@@ -1476,6 +1486,11 @@
 
   void *pr;
   void *pi;
+
+  // No assignment!  FIXME -- should this be implemented?  Note that we
+  // do have a copy constructor.
+
+  mxArray_number& operator = (const mxArray_number&);
 };
 
 // Matlab-style sparse arrays.
@@ -1641,6 +1656,11 @@
     if (jc)
       memcpy (jc, val.jc, (val.get_n () + 1) * sizeof (mwIndex));
   }
+
+  // No assignment!  FIXME -- should this be implemented?  Note that we
+  // do have a copy constructor.
+
+  mxArray_sparse& operator = (const mxArray_sparse&);
 };
 
 // Matlab-style struct arrays.
@@ -1881,6 +1901,11 @@
         data[i] = ptr ? ptr->dup () : 0;
       }
   }
+
+  // No assignment!  FIXME -- should this be implemented?  Note that we
+  // do have a copy constructor.
+
+  mxArray_struct& operator = (const mxArray_struct& val);
 };
 
 // Matlab-style cell arrays.
@@ -1958,6 +1983,11 @@
         data[i] = ptr ? ptr->dup () : 0;
       }
   }
+
+  // No assignment!  FIXME -- should this be implemented?  Note that we
+  // do have a copy constructor.
+
+  mxArray_cell& operator = (const mxArray_cell&);
 };
 
 // ------------------------------------------------------------------
@@ -2375,6 +2405,12 @@
 #endif
 
   }
+
+  // No copying!
+
+  mex (const mex&);
+
+  mex& operator = (const mex&);
 };
 
 // List of memory resources we allocated.
--- a/src/oct-procbuf.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/oct-procbuf.h	Sat Jan 22 02:21:52 2011 -0500
@@ -64,6 +64,14 @@
   pid_t proc_pid;
 
   octave_procbuf *next;
+
+private:
+
+  // No copying!
+
+  octave_procbuf (const octave_procbuf&);
+
+  octave_procbuf& operator = (const octave_procbuf&);
 };
 
 extern void symbols_of_oct_procbuf (void);
--- a/src/pt-cbinop.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/pt-cbinop.h	Sat Jan 22 02:21:52 2011 -0500
@@ -59,6 +59,13 @@
   tree_expression *op_lhs;
   tree_expression *op_rhs;
   octave_value::compound_binary_op etype;
+
+  // No copying!
+
+  tree_compound_binary_expression (const tree_compound_binary_expression&);
+
+  tree_compound_binary_expression& operator =
+    (const tree_compound_binary_expression&);
 };
 
 // a "virtual constructor"
--- a/src/symtab.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/symtab.h	Sat Jan 22 02:21:52 2011 -0500
@@ -100,6 +100,12 @@
 
   private:
 
+    // No copying!
+
+    scope_id_cache (const scope_id_cache&);
+
+    scope_id_cache& operator = (const scope_id_cache&);
+
     static scope_id_cache *instance;
 
     // The next available scope not in the free list.
@@ -1885,6 +1891,12 @@
 
 private:
 
+  // No copying!
+
+  symbol_table (const symbol_table&);
+
+  symbol_table& operator = (const symbol_table&);
+
   typedef std::map<std::string, symbol_record>::const_iterator table_const_iterator;
   typedef std::map<std::string, symbol_record>::iterator table_iterator;
 
--- a/src/txt-eng-ft.cc	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/txt-eng-ft.cc	Sat Jan 22 02:21:52 2011 -0500
@@ -64,9 +64,17 @@
               : 0); }
 
 private:
+
   static ft_manager *instance;
 
 private:
+
+  // No copying!
+
+  ft_manager (const ft_manager&);
+
+  ft_manager& operator = (const ft_manager&);
+
   ft_manager (void)
     {
       if (FT_Init_FreeType (&library))
--- a/src/txt-eng-ft.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/txt-eng-ft.h	Sat Jan 22 02:21:52 2011 -0500
@@ -81,6 +81,12 @@
 private:
   int rotation_to_mode (double rotation) const;
 
+  // No copying!
+
+  ft_render (const ft_render&);
+
+  ft_render& operator = (const ft_render&);
+
 private:
   FT_Face face;
   Matrix bbox;
--- a/src/unwind-prot.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/unwind-prot.h	Sat Jan 22 02:21:52 2011 -0500
@@ -43,10 +43,21 @@
     elem *next;
 
   public:
+    elem (void) : next (0) { }
+
     virtual void run (void) { }
+
     virtual ~elem (void) { }
 
     friend class unwind_protect;
+
+  private:
+
+    // No copying!
+
+    elem (const elem&);
+
+    elem& operator = (const elem&);
   };
 
   // An element that merely runs a void (*)(void) function.
@@ -76,6 +87,13 @@
     void run (void) { e_fcn (e_arg); }
 
   private:
+
+    // No copying!
+
+    fcn_arg_elem (const fcn_arg_elem&);
+
+    fcn_arg_elem& operator = (const fcn_arg_elem&);
+
     void (*e_fcn) (T);
     T e_arg;
   };
@@ -109,6 +127,12 @@
     void run (void) { (e_obj->*e_method) (); }
 
   private:
+    // No copying! XXX
+
+    method_elem (const method_elem&);
+
+    method_elem operator = (const method_elem&);
+
     T *e_obj;
     void (T::*e_method) (void);
   };
@@ -125,6 +149,13 @@
     void run (void) { *e_ptr = e_val; }
 
   private:
+
+    // No copying!
+
+    restore_var_elem (const restore_var_elem&);
+
+    restore_var_elem& operator = (const restore_var_elem&);
+
     T *e_ptr, e_val;
   };
 
@@ -140,7 +171,14 @@
     void run (void) { delete e_ptr; }
 
   private:
+
     T *e_ptr;
+
+    // No copying!
+
+    delete_ptr_elem (const delete_ptr_elem&);
+
+    delete_ptr_elem operator = (const delete_ptr_elem&);
   };
 
   unwind_protect (void) : head () { }
@@ -267,6 +305,12 @@
 private:
 
   elem *head;
+
+  // No copying!
+
+  unwind_protect (const unwind_protect&);
+
+  unwind_protect& operator = (const unwind_protect&);
 };
 
 // Like unwind_protect, but this one will guard against the possibility of seeing
--- a/src/zfstream.h	Fri Jan 21 20:22:42 2011 +0100
+++ b/src/zfstream.h	Sat Jan 22 02:21:52 2011 -0500
@@ -199,6 +199,13 @@
 //  virtual int_type pbackfail(int_type c = traits_type::eof());
 
 private:
+
+  // No copying!
+
+  gzfilebuf (const gzfilebuf&);
+
+  gzfilebuf& operator = (const gzfilebuf&);
+
   /**
    *  @brief  Allocate internal buffer.
    *