20 #ifndef CO_OBJECTVERSION_H
21 #define CO_OBJECTVERSION_H
25 #include <lunchbox/stdExt.h>
31 static const uint128_t VERSION_NONE( 0, 0 );
32 static const uint128_t VERSION_FIRST( 0, 1 );
33 static const uint128_t VERSION_OLDEST( 0, 0xfffffffffffffffcull );
34 static const uint128_t VERSION_NEXT( 0, 0xfffffffffffffffdull );
35 static const uint128_t VERSION_INVALID( 0, 0xfffffffffffffffeull );
36 static const uint128_t VERSION_HEAD( 0, 0xffffffffffffffffull );
58 { *
this =
object.get(); }
79 return identifier < rhs.identifier ||
80 ( identifier == rhs.identifier && version < rhs.version );
85 return identifier > rhs.identifier ||
86 ( identifier == rhs.identifier && version > rhs.version );
93 inline std::ostream& operator << (std::ostream& os,
const ObjectVersion& ov)
102 lunchbox::byteswap( value.
version );
106 LB_STDEXT_NAMESPACE_OPEN
107 #ifdef LB_STDEXT_MSVC
110 inline size_t hash_compare< co::ObjectVersion >::operator()
113 const size_t hashVersion = hash_value( key.version );
114 const size_t hashID = hash_value( key.identifier );
116 return hash_value( hashVersion ^ hashID );
120 template<>
struct hash< co::ObjectVersion >
122 template<
typename P >
size_t operator()(
const P& key )
const
124 return hash< uint64_t >()( hash_value( key.version ) ^
125 hash_value( key.identifier ));
129 LB_STDEXT_NAMESPACE_CLOSE
131 #endif // CO_OBJECT_H
bool operator>(const ObjectVersion &rhs) const
<
CO_API ObjectVersion & operator=(const Object *object)
Assign a new identifier and version.
bool operator<(const ObjectVersion &rhs) const
<
uint128_t version
the object version
A helper struct bundling an object identifier and version.
ObjectVersion(lunchbox::RefPtr< R > object)
Construct a new object version.
uint128_t identifier
the object identifier
bool operator!=(const ObjectVersion &value) const
bool operator==(const ObjectVersion &value) const
CO_API ObjectVersion()
Construct a new, zero-initialized object version.