]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/props.hxx
Remove unneeded inclusions of windows.h, GL.h and GLU.H
[simgear.git] / simgear / props / props.hxx
index a74b89c28165309decb7df7fc50a0837f04e832a..f9b469fe6aa0e4ab2d60cc2122a6cc336ce07700 100644 (file)
 #endif
 
 #include <vector>
-
-#if PROPS_STANDALONE
-
 #include <string>
-#include <iostream>
-
-using std::string;
-using std::vector;
-using std::istream;
-using std::ostream;
 
+#if PROPS_STANDALONE
 #else
-
 #include <simgear/compiler.h>
 #include <simgear/debug/logstream.hxx>
-#include STL_STRING
-#include STL_IOSTREAM
-SG_USING_STD(string);
-SG_USING_STD(vector);
-SG_USING_STD(istream);
-SG_USING_STD(ostream);
-
 #endif
 
 
+
+#include <simgear/structure/SGReferenced.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
+
+
 #ifdef NONE
 #pragma warn A sloppy coder has defined NONE as a macro!
 #undef NONE
@@ -282,13 +271,11 @@ public:
    * The template type of a static getter function.
    */
   typedef T (*getter_t)();
-  typedef T (*getter_td)(void*);
 
   /**
    * The template type of a static setter function.
    */
   typedef void (*setter_t)(T);
-  typedef void (*setter_td)(T,void*);
 
   /**
    * Explicit constructor.
@@ -301,26 +288,7 @@ public:
    * to write-disable the value.
    */
   SGRawValueFunctions (getter_t getter = 0, setter_t setter = 0)
-    : _getter(getter), _setter(setter),
-      _getter_d(0), _setter_d(0), _data(0) {}
-
-  /**
-   * Explicit constructor.
-   *
-   * Create a new raw value bound to the getter and setter supplied.
-   *
-   * @param getter A static function for getting a value, or 0
-   * to read-disable the value.
-   * @param setter A static function for setting a value, or 0
-   * to write-disable the value.
-   * @param data A pointer to user data which gets passed to the
-   * getter and setter functions. This could be used to pass the this
-   * pointer to the callback function.
-   */
-  SGRawValueFunctions (getter_td getter = 0, setter_td setter = 0,
-                       void *data = NULL)
-    : _setter(0), _getter(0),
-      _getter_d(getter), _setter_d(setter), _data(data) {}
+    : _getter(getter), _setter(setter) {}
 
   /**
    * Destructor.
@@ -335,8 +303,7 @@ public:
    * return the default value for the type.
    */
   virtual T getValue () const {
-    if (_getter_d) return (*_getter_d)(_data);
-    else if (_getter) return (*_getter)();
+    if (_getter) return (*_getter)();
     else return SGRawValue<T>::DefaultValue;
   }
 
@@ -348,8 +315,7 @@ public:
    * method will return false.
    */
   virtual bool setValue (T value) {
-    if (_setter_d) { (*_setter_d)(value,_data); return true; }
-    else if (_setter) { (*_setter)(value); return true; }
+    if (_setter) { (*_setter)(value); return true; }
     else return false;
   }
 
@@ -357,18 +323,12 @@ public:
    * Create a copy of this raw value, bound to the same functions.
    */
   virtual SGRawValue<T> * clone () const {
-    if (_getter_d)
-      return new SGRawValueFunctions<T>(_getter_d,_setter_d,_data);
-    else
-      return new SGRawValueFunctions<T>(_getter,_setter);
+    return new SGRawValueFunctions<T>(_getter,_setter);
   }
 
 private:
   getter_t _getter;
   setter_t _setter;
-  getter_td _getter_d;
-  setter_td _setter_d;
-  void *_data;
 };
 
 
@@ -387,40 +347,25 @@ class SGRawValueFunctionsIndexed : public SGRawValue<T>
 {
 public:
   typedef T (*getter_t)(int);
-  typedef T (*getter_td)(int,void*);
   typedef void (*setter_t)(int,T);
-  typedef void (*setter_td)(int,T,void*);
-  SGRawValueFunctionsIndexed (int index, getter_t getter = 0, setter_t setter =
-0)
-    : _index(index), _getter(getter), _setter(setter),
-      _getter_d(0), _setter_d(0),_data(0) {}
-  SGRawValueFunctionsIndexed (int index, getter_td getter = 0, setter_td setter = 0, void *data = NULL)
-    : _index(index), _setter(0), _getter(0),
-      _getter_d(getter), _setter_d(setter), _data(data) {}
+  SGRawValueFunctionsIndexed (int index, getter_t getter = 0, setter_t setter = 0)
+    : _index(index), _getter(getter), _setter(setter) {}
   virtual ~SGRawValueFunctionsIndexed () {}
   virtual T getValue () const {
-    if (_getter_d)  return (*_getter_d)(_index,_data);
-    else if (_getter) return (*_getter)(_index);
+    if (_getter) return (*_getter)(_index);
     else return SGRawValue<T>::DefaultValue;
   }
   virtual bool setValue (T value) {
-    if (_setter_d) { (*_setter_d)(_index, value, _data); return true; }
-    else if (_setter) { (*_setter)(_index, value); return true; }
+    if (_setter) { (*_setter)(_index, value); return true; }
     else return false;
   }
   virtual SGRawValue<T> * clone () const {
-    if (_getter_d)
-      return new SGRawValueFunctionsIndexed<T>(_index,_getter_d,_setter_d,_data);
-    else 
-      return new SGRawValueFunctionsIndexed<T>(_index,_getter,_setter);
+    return new SGRawValueFunctionsIndexed<T>(_index, _getter, _setter);
   }
 private:
   int _index;
   getter_t _getter;
   setter_t _setter;
-  getter_td _getter_d;
-  setter_td _setter_d;
-  void *_data;
 };
 
 
@@ -496,70 +441,8 @@ private:
  * The smart pointer that manage reference counting
  */
 class SGPropertyNode;
-class SGPropertyNode_ptr
-{
-public:
-
-  /**
-   * Default constructor
-   */
-  SGPropertyNode_ptr();
-
-  /**
-   * Copy constructor
-   */
-  SGPropertyNode_ptr( const SGPropertyNode_ptr &r );
-
-  /**
-   * Constructor from a pointer to a node
-   */
-  SGPropertyNode_ptr( SGPropertyNode *p );
-
-  /**
-   * Destructor
-   */
-  ~SGPropertyNode_ptr();
-
-  /**
-   * Assignement operator
-   */
-  SGPropertyNode_ptr &operator=( const SGPropertyNode_ptr &r );
-
-  /**
-   * Pointer access operator
-   */
-  SGPropertyNode *operator->();
-
-  /**
-   * Pointer access operator (const)
-   */
-  const SGPropertyNode *operator->() const;
-
-  /**
-   * Conversion to SGPropertyNode * operator
-   */
-  operator SGPropertyNode *();
-
-  /**
-   * Conversion to const SGPropertyNode * operator
-   */
-  operator const SGPropertyNode *() const;
-
-  /**
-   * Return the pointer.
-   */
-  SGPropertyNode * ptr () { return _ptr; }
-
-  /**
-   * Validity test
-   */
-  bool valid() const;
-
-private:
-
-  SGPropertyNode *_ptr;
-};
-
+typedef SGSharedPtr<SGPropertyNode> SGPropertyNode_ptr;
+typedef SGSharedPtr<const SGPropertyNode> SGConstPropertyNode_ptr;
 
 \f
 /**
@@ -582,7 +465,7 @@ protected:
   virtual void unregister_property (SGPropertyNode * node);
 
 private:
-  vector<SGPropertyNode *> _properties;
+  std::vector<SGPropertyNode *> _properties;
 };
 
 
@@ -590,7 +473,7 @@ private:
 /**
  * A node in a property tree.
  */
-class SGPropertyNode
+class SGPropertyNode : public SGReferenced
 {
 public:
 
@@ -605,7 +488,7 @@ public:
    * Property value types.
    */
   enum Type {
-    NONE,
+    NONE = 0,
     ALIAS,
     BOOL,
     INT,
@@ -629,7 +512,8 @@ public:
     ARCHIVE = 4,
     REMOVED = 8,
     TRACE_READ = 16,
-    TRACE_WRITE = 32
+    TRACE_WRITE = 32,
+    USERARCHIVE = 64
   };
 
 
@@ -672,7 +556,7 @@ public:
   /**
    * Get the node's simple (XML) name.
    */
-  const char * getName () const { return _name; }
+  const char * getName () const { return _name.c_str(); }
 
 
   /**
@@ -730,6 +614,14 @@ public:
     return (getChild(name, index) != 0);
   }
 
+  /**
+   * Test whether a named child exists.
+   */
+  bool hasChild (const std::string& name, int index = 0) const
+  {
+    return (getChild(name, index) != 0);
+  }
+
 
   /**
    * Get a child node by name and index.
@@ -737,17 +629,41 @@ public:
   SGPropertyNode * getChild (const char * name, int index = 0,
                             bool create = false);
 
+  /**
+   * Get a child node by name and index.
+   */
+  SGPropertyNode * getChild (const std::string& name, int index = 0,
+                            bool create = false)
+  { return getChild(name.c_str(), index, create); }
+
 
   /**
    * Get a const child node by name and index.
    */
   const SGPropertyNode * getChild (const char * name, int index = 0) const;
 
+  /**
+   * Get a const child node by name and index.
+   */
+  const SGPropertyNode * getChild (const std::string& name, int index = 0) const
+  { return getChild(name.c_str(), index); }
+
+
+  /**
+   * Get a vector of all children with the specified name.
+   */
+  std::vector<SGPropertyNode_ptr> getChildren (const char * name) const;
 
   /**
    * Get a vector of all children with the specified name.
    */
-  vector<SGPropertyNode_ptr> getChildren (const char * name) const;
+  std::vector<SGPropertyNode_ptr> getChildren (const std::string& name) const
+  { return getChildren(name.c_str()); }
+
+  /**
+   * Remove child by position.
+   */
+  SGPropertyNode_ptr removeChild (int pos, bool keep = true);
 
 
   /**
@@ -756,6 +672,26 @@ public:
   SGPropertyNode_ptr removeChild (const char * name, int index = 0,
                                   bool keep = true);
 
+  /**
+   * Remove a child node
+   */
+  SGPropertyNode_ptr removeChild (const std::string& name, int index = 0,
+                                  bool keep = true)
+  { return removeChild(name.c_str(), index, keep); }
+
+  /**
+   * Remove all children with the specified name.
+   */
+  std::vector<SGPropertyNode_ptr> removeChildren (const char * name,
+                                             bool keep = true);
+
+
+  /**
+   * Remove all children with the specified name.
+   */
+  std::vector<SGPropertyNode_ptr> removeChildren (const std::string& name,
+                                             bool keep = true)
+  { return removeChildren(name.c_str(), keep); }
 
   //
   // Alias support.
@@ -773,6 +709,12 @@ public:
    */
   bool alias (const char * path);
 
+  /**
+   * Alias this node's leaf value to another's by relative path.
+   */
+  bool alias (const std::string& path)
+  { return alias(path.c_str()); }
+
 
   /**
    * Remove any alias for this node.
@@ -826,6 +768,11 @@ public:
    */
   SGPropertyNode * getNode (const char * relative_path, bool create = false);
 
+  /**
+   * Get a pointer to another node by relative path.
+   */
+  SGPropertyNode * getNode (const std::string& relative_path, bool create = false)
+  { return getNode(relative_path.c_str(), create); }
 
   /**
    * Get a pointer to another node by relative path.
@@ -840,12 +787,31 @@ public:
   SGPropertyNode * getNode (const char * relative_path, int index,
                            bool create = false);
 
+  /**
+   * Get a pointer to another node by relative path.
+   *
+   * This method leaves the index off the last member of the path,
+   * so that the user can specify it separately (and save some
+   * string building).  For example, getNode("/bar[1]/foo", 3) is
+   * exactly equivalent to getNode("bar[1]/foo[3]").  The index
+   * provided overrides any given in the path itself for the last
+   * component.
+   */
+  SGPropertyNode * getNode (const std::string& relative_path, int index,
+                           bool create = false)
+  { return getNode(relative_path.c_str(), index, create); }
 
   /**
    * Get a const pointer to another node by relative path.
    */
   const SGPropertyNode * getNode (const char * relative_path) const;
 
+  /**
+   * Get a const pointer to another node by relative path.
+   */
+  const SGPropertyNode * getNode (const std::string& relative_path) const
+  { return getNode(relative_path.c_str()); }
+
 
   /**
    * Get a const pointer to another node by relative path.
@@ -856,6 +822,15 @@ public:
   const SGPropertyNode * getNode (const char * relative_path,
                                  int index) const;
 
+  /**
+   * Get a const pointer to another node by relative path.
+   *
+   * This method leaves the index off the last member of the path,
+   * so that the user can specify it separate.
+   */
+  const SGPropertyNode * getNode (const std::string& relative_path,
+                                 int index) const
+  { return getNode(relative_path.c_str(), index); }
 
   //
   // Access Mode.
@@ -970,6 +945,12 @@ public:
    */
   bool setStringValue (const char * value);
 
+  /**
+   * Set a string value for this node.
+   */
+  bool setStringValue (const std::string& value)
+  { return setStringValue(value.c_str()); }
+
 
   /**
    * Set a value of unspecified type for this node.
@@ -1041,12 +1022,22 @@ public:
    */
   Type getType (const char * relative_path) const;
 
+  /**
+   * Get another node's type.
+   */
+  Type getType (const std::string& relative_path) const
+  { return getType(relative_path.c_str()); }
 
   /**
    * Test whether another node has a leaf value.
    */
   bool hasValue (const char * relative_path) const;
 
+  /**
+   * Test whether another node has a leaf value.
+   */
+  bool hasValue (const std::string& relative_path) const
+  { return hasValue(relative_path.c_str()); }
 
   /**
    * Get another node's value as a bool.
@@ -1054,6 +1045,12 @@ public:
   bool getBoolValue (const char * relative_path,
                     bool defaultValue = false) const;
 
+  /**
+   * Get another node's value as a bool.
+   */
+  bool getBoolValue (const std::string& relative_path,
+                    bool defaultValue = false) const
+  { return getBoolValue(relative_path.c_str(), defaultValue); }
 
   /**
    * Get another node's value as an int.
@@ -1061,6 +1058,13 @@ public:
   int getIntValue (const char * relative_path,
                   int defaultValue = 0) const;
 
+  /**
+   * Get another node's value as an int.
+   */
+  int getIntValue (const std::string& relative_path,
+                   int defaultValue = 0) const
+  { return getIntValue(relative_path.c_str(), defaultValue); }
+
 
   /**
    * Get another node's value as a long int.
@@ -1068,20 +1072,39 @@ public:
   long getLongValue (const char * relative_path,
                     long defaultValue = 0L) const;
 
+  /**
+   * Get another node's value as a long int.
+   */
+  long getLongValue (const std::string& relative_path,
+                    long defaultValue = 0L) const
+  { return getLongValue(relative_path.c_str(), defaultValue); }
 
   /**
    * Get another node's value as a float.
    */
   float getFloatValue (const char * relative_path,
-                      float defaultValue = 0.0) const;
+                      float defaultValue = 0.0f) const;
+
+  /**
+   * Get another node's value as a float.
+   */
+  float getFloatValue (const std::string& relative_path,
+                      float defaultValue = 0.0f) const
+  { return getFloatValue(relative_path.c_str(), defaultValue); }
 
 
   /**
    * Get another node's value as a double.
    */
   double getDoubleValue (const char * relative_path,
-                        double defaultValue = 0.0L) const;
+                        double defaultValue = 0.0) const;
 
+  /**
+   * Get another node's value as a double.
+   */
+  double getDoubleValue (const std::string& relative_path,
+                        double defaultValue = 0.0) const
+  { return getDoubleValue(relative_path.c_str(), defaultValue); }
 
   /**
    * Get another node's value as a string.
@@ -1090,41 +1113,85 @@ public:
                               const char * defaultValue = "") const;
 
 
+  /**
+   * Get another node's value as a string.
+   */
+  const char * getStringValue (const std::string& relative_path,
+                              const char * defaultValue = "") const
+  { return getStringValue(relative_path.c_str(), defaultValue); }
+
+
   /**
    * Set another node's value as a bool.
    */
   bool setBoolValue (const char * relative_path, bool value);
 
+  /**
+   * Set another node's value as a bool.
+   */
+  bool setBoolValue (const std::string& relative_path, bool value)
+  { return setBoolValue(relative_path.c_str(), value); }
+
 
   /**
    * Set another node's value as an int.
    */
   bool setIntValue (const char * relative_path, int value);
 
+  /**
+   * Set another node's value as an int.
+   */
+  bool setIntValue (const std::string& relative_path, int value)
+  { return setIntValue(relative_path.c_str(), value); }
+
 
   /**
    * Set another node's value as a long int.
    */
   bool setLongValue (const char * relative_path, long value);
 
+  /**
+   * Set another node's value as a long int.
+   */
+  bool setLongValue (const std::string& relative_path, long value)
+  { return setLongValue(relative_path.c_str(), value); }
+
 
   /**
    * Set another node's value as a float.
    */
   bool setFloatValue (const char * relative_path, float value);
 
+  /**
+   * Set another node's value as a float.
+   */
+  bool setFloatValue (const std::string& relative_path, float value)
+  { return setFloatValue(relative_path.c_str(), value); }
+
 
   /**
    * Set another node's value as a double.
    */
   bool setDoubleValue (const char * relative_path, double value);
 
+  /**
+   * Set another node's value as a double.
+   */
+  bool setDoubleValue (const std::string& relative_path, double value)
+  { return setDoubleValue(relative_path.c_str(), value); }
+
 
   /**
    * Set another node's value as a string.
    */
   bool setStringValue (const char * relative_path, const char * value);
 
+  /**
+   * Set another node's value as a string.
+   */
+  bool setStringValue (const std::string& relative_path, const char * value)
+  { return setStringValue(relative_path.c_str(), value); }
+
 
   /**
    * Set another node's value with no specified type.
@@ -1137,6 +1204,11 @@ public:
    */
   bool isTied (const char * relative_path) const;
 
+  /**
+   * Test whether another node is bound to an external data source.
+   */
+  bool isTied (const std::string& relative_path) const
+  { return isTied(relative_path.c_str()); }
 
   /**
    * Bind another node to an external bool source.
@@ -1144,6 +1216,13 @@ public:
   bool tie (const char * relative_path, const SGRawValue<bool> &rawValue,
            bool useDefault = true);
 
+  /**
+   * Bind another node to an external bool source.
+   */
+  bool tie (const std::string& relative_path, const SGRawValue<bool> &rawValue,
+           bool useDefault = true)
+  { return tie(relative_path.c_str(), rawValue, useDefault); }
+
 
   /**
    * Bind another node to an external int source.
@@ -1151,6 +1230,13 @@ public:
   bool tie (const char * relative_path, const SGRawValue<int> &rawValue,
            bool useDefault = true);
 
+  /**
+   * Bind another node to an external int source.
+   */
+  bool tie (const std::string& relative_path, const SGRawValue<int> &rawValue,
+           bool useDefault = true)
+  { return tie(relative_path.c_str(), rawValue, useDefault); }
+
 
   /**
    * Bind another node to an external long int source.
@@ -1158,6 +1244,13 @@ public:
   bool tie (const char * relative_path, const SGRawValue<long> &rawValue,
            bool useDefault = true);
 
+  /**
+   * Bind another node to an external long int source.
+   */
+  bool tie (const std::string& relative_path, const SGRawValue<long> &rawValue,
+           bool useDefault = true)
+  { return tie(relative_path.c_str(), rawValue, useDefault); }
+
 
   /**
    * Bind another node to an external float source.
@@ -1165,6 +1258,13 @@ public:
   bool tie (const char * relative_path, const SGRawValue<float> &rawValue,
            bool useDefault = true);
 
+  /**
+   * Bind another node to an external float source.
+   */
+  bool tie (const std::string& relative_path, const SGRawValue<float> &rawValue,
+           bool useDefault = true)
+  { return tie(relative_path.c_str(), rawValue, useDefault); }
+
 
   /**
    * Bind another node to an external double source.
@@ -1172,6 +1272,13 @@ public:
   bool tie (const char * relative_path, const SGRawValue<double> &rawValue,
            bool useDefault = true);
 
+  /**
+   * Bind another node to an external double source.
+   */
+  bool tie (const std::string& relative_path, const SGRawValue<double> &rawValue,
+           bool useDefault = true)
+  { return tie(relative_path.c_str(), rawValue, useDefault); }
+
 
   /**
    * Bind another node to an external string source.
@@ -1179,17 +1286,32 @@ public:
   bool tie (const char * relative_path, const SGRawValue<const char *> &rawValue,
            bool useDefault = true);
 
+  /**
+   * Bind another node to an external string source.
+   */
+  bool tie (const std::string& relative_path, const SGRawValue<const char*> &rawValue,
+           bool useDefault = true)
+  { return tie(relative_path.c_str(), rawValue, useDefault); }
+
 
   /**
    * Unbind another node from any external data source.
    */
   bool untie (const char * relative_path);
 
+  /**
+   * Unbind another node from any external data source.
+   */
+  bool untie (const std::string& relative_path)
+  { return untie(relative_path.c_str()); }
+
 
   /**
-   * Add a change listener to the property.
+   * Add a change listener to the property. If "initial" is set call the
+   * listener initially.
    */
-  void addChangeListener (SGPropertyChangeListener * listener);
+  void addChangeListener (SGPropertyChangeListener * listener,
+                          bool initial = false);
 
 
   /**
@@ -1198,6 +1320,12 @@ public:
   void removeChangeListener (SGPropertyChangeListener * listener);
 
 
+  /**
+   * Get the number of listeners.
+   */
+  int nListeners () const { return _listeners ? _listeners->size() : 0; }
+
+
   /**
    * Fire a value change event to all listeners.
    */
@@ -1216,6 +1344,12 @@ public:
   void fireChildRemoved (SGPropertyNode * child);
 
 
+  /**
+   * Clear any existing value and set the type to NONE.
+   */
+  void clearValue ();
+
+
 protected:
 
   void fireValueChanged (SGPropertyNode * node);
@@ -1247,12 +1381,6 @@ private:
   bool set_string (const char * value);
 
 
-  /**
-   * Clear any existing value and set the type to NONE.
-   */
-  void clear_value ();
-
-
   /**
    * Get the value as a string.
    */
@@ -1272,34 +1400,28 @@ private:
 
 
   /**
-   * Increment reference counter
-   */
-  void incrementRef();
-
-  /**
-   * Decrement reference counter
+   * Remove this node from all nodes that link to it in their path cache.
    */
-  int decrementRef();
-
-  friend class SGPropertyNode_ptr;
-
+  void remove_from_path_caches();
 
-  mutable char _buffer[MAX_STRING_LEN+1];
 
   class hash_table;
 
-  char * _name;
-  mutable char * _display_name;
   int _index;
+  std::string _name;
+  mutable std::string _display_name;
+  /// To avoid cyclic reference counting loops this shall not be a reference
+  /// counted pointer
   SGPropertyNode * _parent;
-  vector<SGPropertyNode_ptr> _children;
-  vector<SGPropertyNode_ptr> _removedChildren;
-  mutable char * _path;
+  std::vector<SGPropertyNode_ptr> _children;
+  std::vector<SGPropertyNode_ptr> _removedChildren;
+  std::vector<hash_table *> _linkedNodes;
+  mutable std::string _path;
+  mutable std::string _buffer;
   hash_table * _path_cache;
   Type _type;
   bool _tied;
   int _attr;
-  int _count;
 
                                // The right kind of pointer...
   union {
@@ -1321,12 +1443,19 @@ private:
     char * string_val;
   } _local_val;
 
-  vector <SGPropertyChangeListener *> * _listeners;
+  std::vector<SGPropertyChangeListener *> * _listeners;
+
+
+  /**
+    * Register/unregister node that links to this node in its path cache.
+    */
+  void add_linked_node (hash_table * node) { _linkedNodes.push_back(node); }
+  bool remove_linked_node (hash_table * node);
 
 
 \f
   /**
-   * A very simple hash table with no remove functionality.
+   * A very simple hash table.
    */
   class hash_table {
   public:
@@ -1337,14 +1466,14 @@ private:
     class entry {
     public:
       entry ();
-      virtual ~entry ();
-      virtual const char * get_key () { return _key; }
-      virtual void set_key (const char * key);
-      virtual SGPropertyNode * get_value () { return _value; }
-      virtual void set_value (SGPropertyNode * value);
+      ~entry ();
+      const char * get_key () { return _key.c_str(); }
+      void set_key (const char * key);
+      SGPropertyNode * get_value () { return _value; }
+      void set_value (SGPropertyNode * value);
     private:
-      char * _key;
-      SGPropertyNode * _value;
+      std::string _key;
+      SGSharedPtr<SGPropertyNode> _value;
     };
 
 
@@ -1354,8 +1483,10 @@ private:
     class bucket {
     public:
       bucket ();
-      virtual ~bucket ();
-      virtual entry * get_entry (const char * key, bool create = false);
+      ~bucket ();
+      entry * get_entry (const char * key, bool create = false);
+      bool erase (SGPropertyNode * node);
+      void clear (hash_table * owner);
     private:
       int _length;
       entry ** _entries;
@@ -1364,9 +1495,10 @@ private:
     friend class bucket;
 
     hash_table ();
-    virtual ~hash_table ();
-    virtual SGPropertyNode * get (const char * key);
-    virtual void put (const char * key, SGPropertyNode * value);
+    ~hash_table ();
+    SGPropertyNode * get (const char * key);
+    void put (const char * key, SGPropertyNode * value);
+    bool erase (SGPropertyNode * node);
 
   private:
     unsigned int hashcode (const char * key);