SISCone  2.0.5
siscone/reference.h
00001 // -*- C++ -*-
00003 // File: reference.h                                                         //
00004 // Description: header file for checkxor management (Creference class)       //
00005 // This file is part of the SISCone project.                                 //
00006 // For more details, see http://projects.hepforge.org/siscone                //
00007 //                                                                           //
00008 // Copyright (c) 2006 Gavin Salam and Gregory Soyez                          //
00009 //                                                                           //
00010 // This program is free software; you can redistribute it and/or modify      //
00011 // it under the terms of the GNU General Public License as published by      //
00012 // the Free Software Foundation; either version 2 of the License, or         //
00013 // (at your option) any later version.                                       //
00014 //                                                                           //
00015 // This program is distributed in the hope that it will be useful,           //
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of            //
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             //
00018 // GNU General Public License for more details.                              //
00019 //                                                                           //
00020 // You should have received a copy of the GNU General Public License         //
00021 // along with this program; if not, write to the Free Software               //
00022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
00023 //                                                                           //
00024 // $Revision:: 123                                                          $//
00025 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007)                     $//
00027 
00028 #ifndef __REFERENCE_H__
00029 #define __REFERENCE_H__
00030 
00031 namespace siscone{
00032 
00043 class Creference{
00044  public:
00046   Creference();
00047 
00049   void randomize();
00050 
00052   bool is_empty();
00053 
00055   bool not_empty();
00056 
00058   Creference& operator = (const Creference &r);
00059 
00061   Creference operator + (const Creference &r);
00062 
00064   Creference& operator += (const Creference &r);
00065 
00067   Creference& operator -= (const Creference &r);
00068 
00070   inline unsigned int operator[] (int i) {return ref[i];}
00071 
00072   unsigned int ref[3];   
00073 };
00074 
00076 Creference operator + (Creference &r1, Creference &r2);
00077 
00079 bool operator == (const Creference &r1, const Creference &r2);
00080 
00082 bool operator != (const Creference &r1, const Creference &r2);
00083 
00085 bool operator < (const Creference &r1, const Creference &r2);
00086 
00087 
00088 //=============== inline material ================
00089 
00090 // equality test for two references
00091 //----------------------------------
00092 inline bool operator == (const Creference &r1, const Creference &r2){
00093   return (r1.ref[0]==r2.ref[0]) && (r1.ref[1]==r2.ref[1]) && (r1.ref[2]==r2.ref[2]);
00094 }
00095 
00096 // difference test for two references
00097 //----------------------------------
00098 inline bool operator != (const Creference &r1, const Creference &r2){
00099   return (r1.ref[0]!=r2.ref[0]) || (r1.ref[1]!=r2.ref[1]) || (r1.ref[2]!=r2.ref[2]);
00100 }
00101 
00102 // difference test for two references
00103 //----------------------------------
00104 inline bool operator < (const Creference &r1, const Creference &r2){
00105   return (r1.ref[0]<r2.ref[0]) || ((r1.ref[0]==r2.ref[0]) && 
00106                                    ((r1.ref[1]<r2.ref[1]) || ((r1.ref[1]==r2.ref[1]) && (r1.ref[2]<r2.ref[2]))
00107                                     ));
00108 }
00109 
00110 }
00111 #endif
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Mon Jun 4 2012 18:23:38 for SISCone by  Doxygen 1.7.6.1