-void
-SGPropertyChangeListener::unregister_property (SGPropertyNode * node)
-{
- vector<SGPropertyNode *>::iterator it =
- find(_properties.begin(), _properties.end(), node);
- if (it != _properties.end())
- _properties.erase(it);
+size_t hash_value(const SGPropertyNode& node)
+{
+ using namespace boost;
+
+ if (node.nChildren() == 0) {
+ switch (node.getType()) {
+ case props::NONE:
+ return 0;
+
+ case props::BOOL:
+ return hash_value(node.getValue<bool>());
+ case props::INT:
+ return hash_value(node.getValue<int>());
+ case props::LONG:
+ return hash_value(node.getValue<long>());
+ case props::FLOAT:
+ return hash_value(node.getValue<float>());
+ case props::DOUBLE:
+ return hash_value(node.getValue<double>());
+ case props::STRING:
+ case props::UNSPECIFIED:
+ {
+ const char *val = node.getStringValue();
+ return hash_range(val, val + strlen(val));
+ }
+ case props::VEC3D:
+ {
+ const SGVec3d val = node.getValue<SGVec3d>();
+ return hash_range(&val[0], &val[3]);
+ }
+ case props::VEC4D:
+ {
+ const SGVec4d val = node.getValue<SGVec4d>();
+ return hash_range(&val[0], &val[4]);
+ }
+ case props::ALIAS: // XXX Should we look in aliases?
+ default:
+ return 0;
+ }
+ } else {
+ size_t seed = 0;
+ PropertyList children(node._children.begin(), node._children.end());
+ sort(children.begin(), children.end(), PropertyPlaceLess());
+ for (PropertyList::const_iterator itr = children.begin(),
+ end = children.end();
+ itr != end;
+ ++itr) {
+ hash_combine(seed, (*itr)->_name);
+ hash_combine(seed, (*itr)->_index);
+ hash_combine(seed, hash_value(**itr));
+ }
+ return seed;
+ }