mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
Define undefined id and gtid as const static member variables.
Use default seqno and id constructors in default gtid ctor instead of calls to static undefined to initialize.
This commit is contained in:
@ -31,8 +31,8 @@ namespace wsrep
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
gtid()
|
gtid()
|
||||||
: id_(wsrep::id::undefined())
|
: id_()
|
||||||
, seqno_(wsrep::seqno::undefined())
|
, seqno_()
|
||||||
{ }
|
{ }
|
||||||
gtid(const wsrep::id& id, wsrep::seqno seqno)
|
gtid(const wsrep::id& id, wsrep::seqno seqno)
|
||||||
: id_(id)
|
: id_(id)
|
||||||
@ -44,13 +44,12 @@ namespace wsrep
|
|||||||
{
|
{
|
||||||
return (seqno_.is_undefined() && id_.is_undefined());
|
return (seqno_.is_undefined() && id_.is_undefined());
|
||||||
}
|
}
|
||||||
static wsrep::gtid undefined()
|
static const wsrep::gtid& undefined()
|
||||||
{
|
{
|
||||||
static const wsrep::gtid ret(wsrep::id::undefined(),
|
return undefined_;
|
||||||
wsrep::seqno::undefined());
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
static const wsrep::gtid undefined_;
|
||||||
wsrep::id id_;
|
wsrep::id id_;
|
||||||
wsrep::seqno seqno_;
|
wsrep::seqno seqno_;
|
||||||
};
|
};
|
||||||
|
@ -90,10 +90,10 @@ namespace wsrep
|
|||||||
|
|
||||||
static const wsrep::id& undefined()
|
static const wsrep::id& undefined()
|
||||||
{
|
{
|
||||||
static wsrep::id ret = wsrep::id();
|
return undefined_;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
static const wsrep::id undefined_;
|
||||||
unsigned char data_[16];
|
unsigned char data_[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
const wsrep::gtid wsrep::gtid::undefined_ = wsrep::gtid();
|
||||||
|
|
||||||
std::ostream& wsrep::operator<<(std::ostream& os, const wsrep::gtid& gtid)
|
std::ostream& wsrep::operator<<(std::ostream& os, const wsrep::gtid& gtid)
|
||||||
{
|
{
|
||||||
return (os << gtid.id() << ":" << gtid.seqno());
|
return (os << gtid.id() << ":" << gtid.seqno());
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
const wsrep::id wsrep::id::undefined_ = wsrep::id();
|
||||||
|
|
||||||
wsrep::id::id(const std::string& str)
|
wsrep::id::id(const std::string& str)
|
||||||
: data_()
|
: data_()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user