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(); }
83 return identifier < rhs.identifier ||
84 ( identifier == rhs.identifier && version < rhs.version );
89 return identifier > rhs.identifier ||
90 ( identifier == rhs.identifier && version > rhs.version );
94 explicit operator bool()
const 105 inline std::ostream& operator << (std::ostream& os,
const ObjectVersion& ov)
114 lunchbox::byteswap( value.
version );
118 LB_STDEXT_NAMESPACE_OPEN
119 #ifdef LB_STDEXT_MSVC 122 inline size_t hash_compare< co::ObjectVersion >::operator()
125 const size_t hashVersion = hash_value( key.version );
126 const size_t hashID = hash_value( key.identifier );
128 return hash_value( hashVersion ^ hashID );
134 template<
typename P >
size_t operator()(
const P& key )
const 136 return hash< uint64_t >()( hash_value( key.version ) ^
137 hash_value( key.identifier ));
141 LB_STDEXT_NAMESPACE_CLOSE
143 #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
Object-oriented network library.
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.