hobject_t: define max value

Create a max value that is greater than all other values.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This commit is contained in:
Sage Weil 2011-12-01 20:56:50 -08:00 committed by Samuel Just
parent 745be30f51
commit 2026450bd1

View File

@ -263,6 +263,7 @@ struct hobject_t {
object_t oid;
snapid_t snap;
uint32_t hash;
bool max;
private:
string key;
@ -271,16 +272,23 @@ public:
const string &get_key() const {
return key;
}
hobject_t() : snap(0), hash(0) {}
hobject_t(object_t oid, const string &key, snapid_t snap, uint32_t hash) :
oid(oid), snap(snap), hash(hash),
hobject_t() : snap(0), hash(0), max(false) {}
hobject_t(object_t oid, const string& key, snapid_t snap, uint64_t hash) :
oid(oid), snap(snap), hash(hash), max(false),
key(oid.name == key ? string() : key) {}
hobject_t(const sobject_t &soid, const string &key, uint32_t hash) :
oid(soid.oid), snap(soid.snap), hash(hash),
oid(soid.oid), snap(soid.snap), hash(hash), max(false),
key(soid.oid.name == key ? string() : key) {}
// maximum sorted value.
static hobject_t get_max() {
hobject_t h;
h.max = true;
return h;
}
/* Do not use when a particular hash function is needed */
explicit hobject_t(const sobject_t &o) :
oid(o.oid), snap(o.snap) {