SISCone  2.0.6
reference.h
1 // -*- C++ -*-
3 // File: reference.h //
4 // Description: header file for checkxor management (Creference class) //
5 // This file is part of the SISCone project. //
6 // For more details, see http://projects.hepforge.org/siscone //
7 // //
8 // Copyright (c) 2006 Gavin Salam and Gregory Soyez //
9 // //
10 // This program is free software; you can redistribute it and/or modify //
11 // it under the terms of the GNU General Public License as published by //
12 // the Free Software Foundation; either version 2 of the License, or //
13 // (at your option) any later version. //
14 // //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
18 // GNU General Public License for more details. //
19 // //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program; if not, write to the Free Software //
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
23 // //
24 // $Revision:: 123 $//
25 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $//
27 
28 #ifndef __REFERENCE_H__
29 #define __REFERENCE_H__
30 
31 namespace siscone{
32 
43 class Creference{
44  public:
46  Creference();
47 
49  void randomize();
50 
52  bool is_empty();
53 
55  bool not_empty();
56 
59 
62 
65 
68 
70  inline unsigned int operator[] (int i) {return ref[i];}
71 
72  unsigned int ref[3];
73 };
74 
76 Creference operator + (Creference &r1, Creference &r2);
77 
79 bool operator == (const Creference &r1, const Creference &r2);
80 
82 bool operator != (const Creference &r1, const Creference &r2);
83 
85 bool operator < (const Creference &r1, const Creference &r2);
86 
87 
88 //=============== inline material ================
89 
90 // equality test for two references
91 //----------------------------------
92 inline bool operator == (const Creference &r1, const Creference &r2){
93  return (r1.ref[0]==r2.ref[0]) && (r1.ref[1]==r2.ref[1]) && (r1.ref[2]==r2.ref[2]);
94 }
95 
96 // difference test for two references
97 //----------------------------------
98 inline bool operator != (const Creference &r1, const Creference &r2){
99  return (r1.ref[0]!=r2.ref[0]) || (r1.ref[1]!=r2.ref[1]) || (r1.ref[2]!=r2.ref[2]);
100 }
101 
102 // difference test for two references
103 //----------------------------------
104 inline bool operator < (const Creference &r1, const Creference &r2){
105  return (r1.ref[0]<r2.ref[0]) || ((r1.ref[0]==r2.ref[0]) &&
106  ((r1.ref[1]<r2.ref[1]) || ((r1.ref[1]==r2.ref[1]) && (r1.ref[2]<r2.ref[2]))
107  ));
108 }
109 
110 }
111 #endif
Creference & operator=(const Creference &r)
assignment of reference
Definition: reference.cpp:87
Definition: area.cpp:33
bool is_empty()
test emptyness
Definition: reference.cpp:75
void randomize()
create a random reference
Definition: reference.cpp:54
unsigned int ref[3]
actual data for the reference
Definition: reference.h:72
bool not_empty()
test non-emptyness
Definition: reference.cpp:81
unsigned int operator[](int i)
accessing the reference
Definition: reference.h:70
Creference()
default constructor
Definition: reference.cpp:46
Creference & operator-=(const Creference &r)
decrementation of reference
Definition: reference.cpp:112
Creference & operator+=(const Creference &r)
incrementation of reference
Definition: reference.cpp:103
references used for checksums.
Definition: reference.h:43
Creference operator+(const Creference &r)
addition of reference
Definition: reference.cpp:96
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Fri Feb 5 2016 10:03:55 for SISCone by  Doxygen 1.8.9.1