~ubuntu-branches/ubuntu/quantal/ceph/quantal

« back to all changes in this revision

Viewing changes to src/include/cmp.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-07-16 09:56:24 UTC
  • mfrom: (0.3.11)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: package-import@ubuntu.com-20120716095624-azr2w4hbhei1rxmx
Tags: upstream-0.48
ImportĀ upstreamĀ versionĀ 0.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef __CEPH_CMP_H
2
2
#define __CEPH_CMP_H
 
3
#include <boost/tuple/tuple.hpp>
 
4
#include <boost/tuple/tuple_comparison.hpp>
3
5
 
4
6
/*
5
7
 * macros to define comparison operators for classes with small numbers of members.
102
104
                                                      (l.d == r.d && l.e <= r.e))))))); \
103
105
  }
104
106
 
 
107
#define WRITE_EQ_OPERATORS_7(type, a, b, c, d, e, f, g)                                                       \
 
108
        inline bool operator==(const type &l, const type &r) {                                                      \
 
109
                return (boost::make_tuple(boost::cref(l.a), boost::cref(l.b), boost::cref(l.c), boost::cref(l.d), boost::cref(l.e), boost::cref(l.f), boost::cref(l.g)) == \
 
110
                                                boost::make_tuple(boost::cref(r.a), boost::cref(r.b), boost::cref(r.c), boost::cref(r.d), boost::cref(r.e), boost::cref(r.f), boost::cref(r.g)));  \
 
111
        }                                                                                                           \
 
112
        inline bool operator!=(const type &l, const type &r) {                                                      \
 
113
                return (boost::make_tuple(boost::cref(l.a), boost::cref(l.b), boost::cref(l.c), boost::cref(l.d), boost::cref(l.e), boost::cref(l.f), boost::cref(l.g)) != \
 
114
                                                boost::make_tuple(boost::cref(r.a), boost::cref(r.b), boost::cref(r.c), boost::cref(r.d), boost::cref(r.e), boost::cref(r.f), boost::cref(r.g)));  \
 
115
        }
 
116
#define WRITE_CMP_OPERATORS_7(type, a, b, c, d, e, f, g)                                                      \
 
117
        inline bool operator<=(const type &l, const type &r) {                                                      \
 
118
                return (boost::make_tuple(boost::cref(l.a), boost::cref(l.b), boost::cref(l.c), boost::cref(l.d), boost::cref(l.e), boost::cref(l.f), boost::cref(l.g)) <= \
 
119
                                                boost::make_tuple(boost::cref(r.a), boost::cref(r.b), boost::cref(r.c), boost::cref(r.d), boost::cref(r.e), boost::cref(r.f), boost::cref(r.g)));  \
 
120
        }                                                                                                           \
 
121
        inline bool operator>=(const type &l, const type &r) {                                                      \
 
122
                return (boost::make_tuple(boost::cref(l.a), boost::cref(l.b), boost::cref(l.c), boost::cref(l.d), boost::cref(l.e), boost::cref(l.f), boost::cref(l.g)) >= \
 
123
                                                boost::make_tuple(boost::cref(r.a), boost::cref(r.b), boost::cref(r.c), boost::cref(r.d), boost::cref(r.e), boost::cref(r.f), boost::cref(r.g)));  \
 
124
        }                                                                                                           \
 
125
        inline bool operator>(const type &l, const type &r) {                                                       \
 
126
                return (boost::make_tuple(boost::cref(l.a), boost::cref(l.b), boost::cref(l.c), boost::cref(l.d), boost::cref(l.e), boost::cref(l.f), boost::cref(l.g)) >  \
 
127
                                                boost::make_tuple(boost::cref(r.a), boost::cref(r.b), boost::cref(r.c), boost::cref(r.d), boost::cref(r.e), boost::cref(r.f), boost::cref(r.g)));  \
 
128
        }                                                                                                           \
 
129
        inline bool operator<(const type &l, const type &r) {                                                       \
 
130
                return (boost::make_tuple(boost::cref(l.a), boost::cref(l.b), boost::cref(l.c), boost::cref(l.d), boost::cref(l.e), boost::cref(l.f), boost::cref(l.g)) <  \
 
131
                                                boost::make_tuple(boost::cref(r.a), boost::cref(r.b), boost::cref(r.c), boost::cref(r.d), boost::cref(r.e), boost::cref(r.f), boost::cref(r.g)));  \
 
132
        }
105
133
#endif