diff src/ov-struct.h @ 2477:3d905d3820a4

[project @ 1996-11-07 16:46:11 by jwe]
author jwe
date Thu, 07 Nov 1996 16:48:16 +0000
parents 1573640a9994
children 8b262e771614
line wrap: on
line diff
--- a/src/ov-struct.h	Thu Nov 07 05:16:55 1996 +0000
+++ b/src/ov-struct.h	Thu Nov 07 16:48:16 1996 +0000
@@ -37,6 +37,7 @@
 #include "str-vec.h"
 
 #include "error.h"
+#include "oct-alloc.h"
 #include "oct-map.h"
 #include "ov-base.h"
 #include "ov-typeinfo.h"
@@ -46,7 +47,7 @@
 
 class tree_walker;
 
-// Real scalar values.
+// Data structures.
 
 class
 octave_struct : public octave_base_value
@@ -66,10 +67,11 @@
 
   octave_value *clone (void) { return new octave_struct (*this); }
 
-#if 0
-  void *operator new (size_t size);
-  void operator delete (void *p, size_t size);
-#endif
+  void *operator new (size_t size)
+    { return allocator.alloc (size); }
+
+  void operator delete (void *p, size_t size)
+    { allocator.free (p, size); }
 
   octave_value struct_elt_val (const string& nm, bool silent) const;
 
@@ -94,10 +96,16 @@
 
 private:
 
+  // The associative array used to manage the structure data.
   Octave_map map;
 
+  // For custom memory management.
+  static octave_allocator allocator;
+
+  // Type id of struct objects, set by register_type().
   static int t_id;
 
+  // Type name of struct objects, defined in ov-struct.cc.
   static const string t_name;
 };