20 #ifndef CO_OBJECTVERSION_H
21 #define CO_OBJECTVERSION_H
25 #include <lunchbox/bitOperation.h>
26 #include <lunchbox/stdExt.h>
33 static const uint128_t VERSION_FIRST( 0, 1 );
34 static const uint128_t VERSION_NEWEST( 0, 0xfffffffffffffffbull );
35 static const uint128_t VERSION_OLDEST( 0, 0xfffffffffffffffcull );
36 static const uint128_t VERSION_NEXT( 0, 0xfffffffffffffffdull );
37 static const uint128_t VERSION_INVALID( 0, 0xfffffffffffffffeull );
38 static const uint128_t VERSION_HEAD( 0, 0xffffffffffffffffull );
63 template<
class R >
explicit ObjectVersion( lunchbox::RefPtr< R >
object )
64 { *
this =
object.get(); }
85 return identifier < rhs.identifier ||
86 ( identifier == rhs.identifier && version < rhs.version );
91 return identifier > rhs.identifier ||
92 ( identifier == rhs.identifier && version > rhs.version );
99 inline std::ostream& operator << (std::ostream& os,
const ObjectVersion& ov)
108 lunchbox::byteswap( value.
version );
112 LB_STDEXT_NAMESPACE_OPEN
113 #ifdef LB_STDEXT_MSVC
116 inline size_t hash_compare< co::ObjectVersion >::operator()
119 const size_t hashVersion = hash_value( key.version );
120 const size_t hashID = hash_value( key.identifier );
122 return hash_value( hashVersion ^ hashID );
126 template<>
struct hash< co::ObjectVersion >
128 template<
typename P >
size_t operator()(
const P& key )
const
130 return hash< uint64_t >()( hash_value( key.version ) ^
131 hash_value( key.identifier ));
135 LB_STDEXT_NAMESPACE_CLOSE
137 #endif // CO_OBJECT_H
Defines export visibility macros for library Collage.
bool operator!=(const ObjectVersion &value) const
CO_API ObjectVersion()
Construct a new, zero-initialized object version.
A helper struct bundling an object identifier and version.
CO_API ObjectVersion & operator=(const Object *object)
Assign a new identifier and version.
uint128_t identifier
the object identifier
bool operator==(const ObjectVersion &value) const
ObjectVersion(lunchbox::RefPtr< R > object)
Construct a new object version.
uint128_t version
the object version
bool operator<(const ObjectVersion &rhs) const
<
bool operator>(const ObjectVersion &rhs) const
<
static const uint128_t VERSION_NONE(0, 0)
Special object version values.