putil: make UpdateSeq a literal type

This commit is contained in:
rdb 2017-05-15 16:34:13 +02:00
parent 7755a2e1c7
commit a71a89acc2
2 changed files with 31 additions and 19 deletions

View File

@ -11,48 +11,56 @@
* @date 1999-09-30
*/
/**
* Creates an UpdateSeq in the given state.
*/
CONSTEXPR UpdateSeq::
UpdateSeq(unsigned int seq) : _seq(seq) {
}
/**
* Creates an UpdateSeq in the 'initial' state.
*/
INLINE UpdateSeq::
UpdateSeq() {
_seq = (unsigned int)SC_initial;
CONSTEXPR UpdateSeq::
UpdateSeq() : _seq((unsigned int)SC_initial) {
}
/**
* Returns an UpdateSeq in the 'initial' state.
*/
INLINE UpdateSeq UpdateSeq::
CONSTEXPR UpdateSeq UpdateSeq::
initial() {
return UpdateSeq();
return UpdateSeq((unsigned int)SC_initial);
}
/**
* Returns an UpdateSeq in the 'old' state.
*/
INLINE UpdateSeq UpdateSeq::
CONSTEXPR UpdateSeq UpdateSeq::
old() {
UpdateSeq result;
result._seq = (unsigned int)SC_old;
return result;
return UpdateSeq((unsigned int)SC_old);
}
/**
* Returns an UpdateSeq in the 'fresh' state.
*/
INLINE UpdateSeq UpdateSeq::
CONSTEXPR UpdateSeq UpdateSeq::
fresh() {
UpdateSeq result;
result._seq = (unsigned int)SC_fresh;
return result;
return UpdateSeq((unsigned int)SC_fresh);
}
/**
*
*/
INLINE UpdateSeq::
UpdateSeq(const UpdateSeq &copy) {
_seq = AtomicAdjust::get(copy._seq);
UpdateSeq(const UpdateSeq &copy) : _seq(AtomicAdjust::get(copy._seq)) {
}
/**
*
*/
CONSTEXPR UpdateSeq::
UpdateSeq(const UpdateSeq &&from) NOEXCEPT : _seq(from._seq) {
}
/**

View File

@ -35,13 +35,17 @@
* sequences are numeric and are monotonically increasing.
*/
class EXPCL_PANDA_PUTIL UpdateSeq {
private:
CONSTEXPR UpdateSeq(unsigned int seq);
PUBLISHED:
INLINE UpdateSeq();
INLINE static UpdateSeq initial();
INLINE static UpdateSeq old();
INLINE static UpdateSeq fresh();
CONSTEXPR UpdateSeq();
CONSTEXPR static UpdateSeq initial();
CONSTEXPR static UpdateSeq old();
CONSTEXPR static UpdateSeq fresh();
INLINE UpdateSeq(const UpdateSeq &copy);
CONSTEXPR UpdateSeq(const UpdateSeq &&from) NOEXCEPT;
INLINE UpdateSeq &operator = (const UpdateSeq &copy);
INLINE void clear();