Lots of clean-ups and simplifications
[invirt/third/libt4.git] / lock_server_cache_rsm.cc
index c3f75e8..0e43ec5 100644 (file)
@@ -20,6 +20,10 @@ lock_state::lock_state():
 {
 }
 
+lock_state::lock_state(const lock_state &other) {
+    *this = other;
+}
+
 lock_state& lock_state::operator=(const lock_state& o) {
     held = o.held;
     held_by = o.held_by;
@@ -34,50 +38,14 @@ ostringstream & operator<<(ostringstream &o, const pair<A,B> &d) {
     return o;
 }
 
-template <class A>
-marshall & operator<<(marshall &m, const list<A> &d) {
-    m << vector<A>(d.begin(), d.end());
-    return m;
-}
-
-template <class A>
-unmarshall & operator>>(unmarshall &u, list<A> &d) {
-    vector<A> v;
-    u >> v;
-    d.assign(v.begin(), v.end());
-    return u;
-}
-
-
-template <class A, class B>
-marshall & operator<<(marshall &m, const pair<A,B> &d) {
-    m << d.first;
-    m << d.second;
-    return m;
-}
-
-template <class A, class B>
-unmarshall & operator>>(unmarshall &u, pair<A,B> &d) {
-    u >> d.first;
-    u >> d.second;
-    return u;
-}
-
 marshall & operator<<(marshall &m, const lock_state &d) {
-    m << d.held;
-    m << d.held_by;
-    m << d.wanted_by;
-       return m;
+       return m << d.held << d.held_by << d.wanted_by;
 }
 
 unmarshall & operator>>(unmarshall &u, lock_state &d) {
-    u >> d.held;
-    u >> d.held_by;
-    u >> d.wanted_by;
-       return u;
+       return u >> d.held >> d.held_by >> d.wanted_by;
 }
 
-
 lock_state & lock_server_cache_rsm::get_lock_state(lock_protocol::lockid_t lid) {
     lock sl(lock_table_lock);
     // by the semantics of map, this will create