X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/5a5c578e2e358a121cdb9234a6cb11c4ecfbf323..be7cf844f59fa483423724e8e4b5e663e5b88ddd:/paxos_protocol.h diff --git a/paxos_protocol.h b/paxos_protocol.h index c24f155..5e8afdd 100644 --- a/paxos_protocol.h +++ b/paxos_protocol.h @@ -7,8 +7,13 @@ struct prop_t { unsigned n; string m; + + MEMBERS(n, m) + LEXICOGRAPHIC_COMPARISON(prop_t) }; +MARSHALLABLE(prop_t) + class paxos_protocol { public: enum status : status_t { OK, ERR }; @@ -24,20 +29,11 @@ class paxos_protocol { bool accept; prop_t n_a; string v_a; + + MEMBERS(oldinstance, accept, n_a, v_a) }; }; -inline unmarshall & operator>>(unmarshall &u, prop_t &a) { return u >> a.n >> a.m; } -inline marshall & operator<<(marshall &m, prop_t a) { return m << a.n << a.m; } -inline bool operator>(const prop_t &a, const prop_t &b) { return tie(a.n, a.m) > tie(b.n, b.m); } -inline bool operator>=(const prop_t &a, const prop_t &b) { return tie(a.n, a.m) >= tie(b.n, b.m); } - -inline unmarshall & operator>>(unmarshall &u, paxos_protocol::prepareres &r) { - return u >> r.oldinstance >> r.accept >> r.n_a >> r.v_a; -} - -inline marshall & operator<<(marshall &m, paxos_protocol::prepareres r) { - return m << r.oldinstance << r.accept << r.n_a << r.v_a; -} +MARSHALLABLE(paxos_protocol::prepareres) #endif