ord.h revision 182486105ac34c36a2c74e775bcb44d5cbbaffac
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen#ifndef __2GEOM_ORD__
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen#define __2GEOM_ORD__
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelennamespace {
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruzenum Cmp {
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz LESS_THAN=-1,
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz GREATER_THAN=1,
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz EQUAL_TO=0
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz};
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengeleninline Cmp operator-(Cmp x) {
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen switch(x) {
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen case LESS_THAN:
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen return GREATER_THAN;
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen case GREATER_THAN:
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen return LESS_THAN;
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen case EQUAL_TO:
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen return EQUAL_TO;
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen }
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen}
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruztemplate <typename T1, typename T2>
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruzinline Cmp cmp(T1 const &a, T2 const &b) {
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz if ( a < b ) {
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz return LESS_THAN;
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz } else if ( b < a ) {
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz return GREATER_THAN;
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz } else {
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz return EQUAL_TO;
182486105ac34c36a2c74e775bcb44d5cbbaffacjoncruz }
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen}
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen}
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen
29684a16b6c92bee28a94fdc2607bcc143950fa8johanengelen#endif