Debugger: Split into core library and application.
[haiku.git] / headers / private / debugger / ids / ObjectID.h
blob0d39d1e7197aebfff0298db65136d9aabe8272b2
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef OBJECT_ID_H
6 #define OBJECT_ID_H
9 #include <Referenceable.h>
12 class ObjectID : public BReferenceable {
13 public:
14 ObjectID();
15 virtual ~ObjectID();
17 inline uint32 HashValue() const;
19 virtual bool operator==(const ObjectID& other) const = 0;
20 inline bool operator!=(const ObjectID& other) const;
22 protected:
23 virtual uint32 ComputeHashValue() const = 0;
25 protected:
26 mutable uint32 fHashValue;
30 uint32
31 ObjectID::HashValue() const
33 if (fHashValue == 0)
34 fHashValue = ComputeHashValue();
35 return fHashValue;
39 bool
40 ObjectID::operator!=(const ObjectID& other) const
42 return !(*this == other);
46 #endif // OBJECT_ID_H