changeset 23012:27e4ec3b0b49

move octave_refcount inside octave namespace * oct-refcount.h (refcount): Move inside octave namespace and rename from octave_refcount. Change all uses. (octave_refcount): Provide (deprecated) backward-compatible using declaration.
author John W. Eaton <jwe@octave.org>
date Fri, 06 Jan 2017 18:06:31 -0500
parents 6b4d2c8355f7
children 5dca1727ce94
files libgui/src/thread-manager.h libinterp/corefcn/gl-render.cc libinterp/corefcn/graphics.in.h libinterp/corefcn/input.h libinterp/corefcn/oct-map.h libinterp/corefcn/oct-stream.h libinterp/corefcn/symtab.h libinterp/octave-value/ov-base.h libinterp/octave-value/ov-classdef.h libinterp/parse-tree/pt-mat.cc liboctave/array/Array.h liboctave/array/Sparse.h liboctave/array/idx-vector.h liboctave/numeric/sparse-chol.cc liboctave/numeric/sparse-qr.cc liboctave/util/oct-mutex.h liboctave/util/oct-refcount.h liboctave/util/oct-shlib.h liboctave/util/url-transfer.h
diffstat 19 files changed, 68 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/thread-manager.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/libgui/src/thread-manager.h	Fri Jan 06 18:06:31 2017 -0500
@@ -47,7 +47,7 @@
 
 protected:
 
-  octave_refcount<int> count;
+  octave::refcount<int> count;
 };
 
 class octave_thread_manager
--- a/libinterp/corefcn/gl-render.cc	Fri Jan 06 17:44:43 2017 -0500
+++ b/libinterp/corefcn/gl-render.cc	Fri Jan 06 18:06:31 2017 -0500
@@ -127,7 +127,7 @@
       int tw, th;
       double tx, ty;
       bool valid;
-      octave_refcount<int> count;
+      octave::refcount<int> count;
     };
 
     texture_rep *rep;
@@ -378,7 +378,7 @@
       float specular_color_refl;
 
       // reference counter
-      octave_refcount<int> count;
+      octave::refcount<int> count;
 
       vertex_data_rep (void)
         : coords (), color (), normal (), alpha (),
--- a/libinterp/corefcn/graphics.in.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/libinterp/corefcn/graphics.in.h	Fri Jan 06 18:06:31 2017 -0500
@@ -405,7 +405,7 @@
 
 private:
   int id;
-  octave_refcount<int> count;
+  octave::refcount<int> count;
   std::string name;
   graphics_handle parent;
   bool hidden;
@@ -2175,7 +2175,7 @@
 
 private:
   std::string name;
-  octave_refcount<int> count;
+  octave::refcount<int> count;
 
 private:
   void gripe_if_tkit_invalid (const std::string& fname) const
@@ -2926,7 +2926,7 @@
 
 protected:
   // A reference count.
-  octave_refcount<int> count;
+  octave::refcount<int> count;
 
   // A flag telling whether this object is a valid object
   // in the backend context.
@@ -6071,7 +6071,7 @@
   virtual void execute (void) = 0;
 
 private:
-  octave_refcount<int> count;
+  octave::refcount<int> count;
 };
 
 class
--- a/libinterp/corefcn/input.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/libinterp/corefcn/input.h	Fri Jan 06 18:06:31 2017 -0500
@@ -138,7 +138,7 @@
 
 private:
 
-  octave_refcount<int> count;
+  octave::refcount<int> count;
 
   int pflag;
 
--- a/libinterp/corefcn/oct-map.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/libinterp/corefcn/oct-map.h	Fri Jan 06 18:06:31 2017 -0500
@@ -45,7 +45,7 @@
     fields_rep (const fields_rep& other)
       : std::map<std::string, octave_idx_type> (other), count (1) { }
 
-    octave_refcount<int> count;
+    octave::refcount<int> count;
 
   private:
     fields_rep& operator = (const fields_rep&); // no assignment!
--- a/libinterp/corefcn/oct-stream.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/libinterp/corefcn/oct-stream.h	Fri Jan 06 18:06:31 2017 -0500
@@ -165,7 +165,7 @@
 private:
 
   // A reference count.
-  octave_refcount<octave_idx_type> count;
+  octave::refcount<octave_idx_type> count;
 
   // The permission bits for the file.  Should be some combination of
   // std::ios::open_mode bits.
--- a/libinterp/corefcn/symtab.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/libinterp/corefcn/symtab.h	Fri Jan 06 18:06:31 2017 -0500
@@ -477,7 +477,7 @@
 
       bool valid;
 
-      octave_refcount<size_t> count;
+      octave::refcount<size_t> count;
     };
 
   public:
@@ -948,7 +948,7 @@
 
       octave_value built_in_function;
 
-      octave_refcount<size_t> count;
+      octave::refcount<size_t> count;
 
     private:
 
--- a/libinterp/octave-value/ov-base.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/libinterp/octave-value/ov-base.h	Fri Jan 06 18:06:31 2017 -0500
@@ -840,7 +840,7 @@
   // NOTE: the declaration is octave_idx_type because with 64-bit indexing,
   // it is well possible to have more than MAX_INT copies of a single value
   // (think of an empty cell array with >2G elements).
-  octave_refcount<octave_idx_type> count;
+  octave::refcount<octave_idx_type> count;
 
   static const char *get_umap_name (unary_mapper_t);
 
--- a/libinterp/octave-value/ov-classdef.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/libinterp/octave-value/ov-classdef.h	Fri Jan 06 18:06:31 2017 -0500
@@ -166,7 +166,7 @@
 
 protected:
   // Reference count
-  octave_refcount<octave_idx_type> refcount;
+  octave::refcount<octave_idx_type> refcount;
 
 protected:
   // Restricted copying
@@ -740,7 +740,7 @@
     std::list<cdef_class> implicit_ctor_list;
 
     // The number of objects of this class.
-    octave_refcount<octave_idx_type> object_count;
+    octave::refcount<octave_idx_type> object_count;
 
     // TRUE if this class is a built-in meta class.
     bool meta;
--- a/libinterp/parse-tree/pt-mat.cc	Fri Jan 06 17:44:43 2017 -0500
+++ b/libinterp/parse-tree/pt-mat.cc	Fri Jan 06 18:06:31 2017 -0500
@@ -87,7 +87,7 @@
 
     ~tm_row_const_rep (void) = default;
 
-    octave_refcount<int> count;
+    octave::refcount<int> count;
 
     dim_vector dv;
 
--- a/liboctave/array/Array.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/array/Array.h	Fri Jan 06 18:06:31 2017 -0500
@@ -135,7 +135,7 @@
 
     T *data;
     octave_idx_type len;
-    octave_refcount<int> count;
+    octave::refcount<int> count;
 
     ArrayRep (T *d, octave_idx_type l)
       : data (new T [l]), len (l), count (1)
--- a/liboctave/array/Sparse.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/array/Sparse.h	Fri Jan 06 18:06:31 2017 -0500
@@ -70,7 +70,7 @@
     octave_idx_type nzmx;
     octave_idx_type nrows;
     octave_idx_type ncols;
-    octave_refcount<int> count;
+    octave::refcount<int> count;
 
     SparseRep (void)
       : d (0), r (0), c (new octave_idx_type [1]), nzmx (0), nrows (0),
--- a/liboctave/array/idx-vector.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/array/idx-vector.h	Fri Jan 06 18:06:31 2017 -0500
@@ -113,7 +113,7 @@
 
     virtual Array<octave_idx_type> as_array (void);
 
-    octave_refcount<int> count;
+    octave::refcount<int> count;
 
     bool err;
   };
--- a/liboctave/numeric/sparse-chol.cc	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/numeric/sparse-chol.cc	Fri Jan 06 18:06:31 2017 -0500
@@ -110,7 +110,7 @@
 
       double rcond (void) const { return cond; }
 
-      octave_refcount<int> count;
+      octave::refcount<int> count;
 
     private:
 
--- a/liboctave/numeric/sparse-qr.cc	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/numeric/sparse-qr.cc	Fri Jan 06 18:06:31 2017 -0500
@@ -106,7 +106,7 @@
       typename SPARSE_T::dense_matrix_type
       Q (void) const;
 
-      octave_refcount<int> count;
+      octave::refcount<int> count;
 
       octave_idx_type nrows;
       octave_idx_type ncols;
--- a/liboctave/util/oct-mutex.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/util/oct-mutex.h	Fri Jan 06 18:06:31 2017 -0500
@@ -46,7 +46,7 @@
   virtual bool try_lock (void);
 
 private:
-  octave_refcount<int> count;
+  octave::refcount<int> count;
 };
 
 class
--- a/liboctave/util/oct-refcount.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/util/oct-refcount.h	Fri Jan 06 18:06:31 2017 -0500
@@ -66,53 +66,60 @@
 
 #endif
 
-// Encapsulates a reference counter.
-template <typename T>
-class octave_refcount
+namespace octave
 {
-public:
+
+  // Encapsulates a reference counter.
 
-  typedef T count_type;
+  template <typename T>
+  class refcount
+  {
+  public:
+
+    typedef T count_type;
 
-  octave_refcount (count_type initial_count)
-    : count (initial_count)
-  { }
+    refcount (count_type initial_count)
+      : count (initial_count)
+    { }
 
-  // Increment/Decrement.  int is postfix.
-  count_type operator++ (void)
-  {
-    return OCTAVE_ATOMIC_INCREMENT (&count);
-  }
+    // Increment/Decrement.  int is postfix.
+    count_type operator++ (void)
+    {
+      return OCTAVE_ATOMIC_INCREMENT (&count);
+    }
 
-  count_type operator++ (int)
-  {
-    return OCTAVE_ATOMIC_POST_INCREMENT (&count);
-  }
+    count_type operator++ (int)
+    {
+      return OCTAVE_ATOMIC_POST_INCREMENT (&count);
+    }
 
-  count_type operator-- (void)
-  {
-    return OCTAVE_ATOMIC_DECREMENT (&count);
-  }
+    count_type operator-- (void)
+    {
+      return OCTAVE_ATOMIC_DECREMENT (&count);
+    }
 
-  count_type operator-- (int)
-  {
-    return OCTAVE_ATOMIC_POST_DECREMENT (&count);
-  }
+    count_type operator-- (int)
+    {
+      return OCTAVE_ATOMIC_POST_DECREMENT (&count);
+    }
 
-  operator count_type (void) const
-  {
-    return static_cast<count_type const volatile&> (count);
-  }
+    operator count_type (void) const
+    {
+      return static_cast<count_type const volatile&> (count);
+    }
 
-  count_type *get (void)
-  {
-    return &count;
-  }
+    count_type *get (void)
+    {
+      return &count;
+    }
+
+  private:
 
-private:
+    count_type count;
+  };
+}
 
-  count_type count;
-};
+template <typename T>
+using octave_refcount OCTAVE_DEPRECATED (("use 'octave::refcount' instead")) = octave::refcount<T>;
 
 #endif
-
--- a/liboctave/util/oct-shlib.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/util/oct-shlib.h	Fri Jan 06 18:06:31 2017 -0500
@@ -90,7 +90,7 @@
 
     public:
 
-      octave_refcount<int> count;
+      octave::refcount<int> count;
 
     protected:
 
--- a/liboctave/util/url-transfer.h	Fri Jan 06 17:44:43 2017 -0500
+++ b/liboctave/util/url-transfer.h	Fri Jan 06 18:06:31 2017 -0500
@@ -148,7 +148,7 @@
   protected:
 
     // Reference count.
-    octave_refcount<size_t> count;
+    octave::refcount<size_t> count;
 
     // Host for ftp transfers or full URL for http requests.
     std::string host_or_url;