Merge branch 'vaskeEmFix' of git://disco.cse.ucsc.edu/libDAI into mergeVaskeEmFix
[libdai.git] / include / dai / properties.h
index efdd789..8db7907 100644 (file)
@@ -33,6 +33,7 @@
 #include <sstream>
 #include <boost/any.hpp>
 #include <map>
+#include <vector>
 #include <cassert>
 #include <typeinfo>
 #include <dai/exceptions.h>
@@ -145,7 +146,17 @@ class PropertySet : private std::map<PropertyKey, PropertyValue> {
         }
 
         /// Shorthand for (temporarily) adding properties, e.g. PropertySet p()("method","BP")("verbose",1)("tol",1e-9)
-        PropertySet operator()(const PropertyKey &key, const PropertyValue &val) const { PropertySet copy = *this; return copy.Set(key,val); }
+               PropertySet operator()(const PropertyKey &key, const PropertyValue &val) const { PropertySet copy = *this; return copy.Set(key,val); }
+               
+               std::vector< PropertyKey > keys() const {
+                       std::vector< PropertyKey > result;
+                       result.reserve(size());
+                       PropertySet::const_iterator i = begin();
+                       for ( ; i != end(); ++i) {
+                               result.push_back(i->first);
+                       }
+                       return result;
+               }
 
         /// Check if a property with the given key exists
         bool hasKey(const PropertyKey &key) const { PropertySet::const_iterator x = find(key); return (x != this->end()); }