source: trunk/src/PixelMap/Voxel.cc @ 270

Last change on this file since 270 was 270, checked in by Matthew Whiting, 17 years ago

A large set of changes, each of which small ones from compiling with the -Wall flag (plus the -Wno-sign-compare flag -- as we don't care about warnings about comparing ints and unsigned ints).

File size: 2.0 KB
Line 
1#include <iostream>
2#include <iomanip>
3#include <PixelMap/Voxel.hh>
4
5namespace PixelInfo
6{
7
8  Voxel::Voxel(long x, long y, long z, float f)
9  {
10    this->itsX=x;
11    this->itsY=y;
12    this->itsZ=z;
13    this->itsF=f;
14  }
15  //--------------------------------------------------------------------
16
17  Voxel::Voxel(const Voxel& v)
18  {
19    this->itsX=v.itsX;
20    this->itsY=v.itsY;
21    this->itsZ=v.itsZ;
22    this->itsF=v.itsF;
23  }
24  //--------------------------------------------------------------------
25
26  Voxel& Voxel::operator= (const Voxel& v)
27  {
28    if(this == &v) return *this;
29    this->itsX=v.itsX;
30    this->itsY=v.itsY;
31    this->itsZ=v.itsZ;
32    this->itsF=v.itsF;
33    return *this;
34  }
35  //--------------------------------------------------------------------
36
37  std::ostream& operator<< ( std::ostream& theStream, Voxel& vox)
38  {
39    /**
40     * A convenient way of printing the coordinate and flux values of
41     * a voxel.  They are all printed to a single line (with no
42     * carriage-return), with the flux to precision of 4.
43     */ 
44
45    theStream << std::setw(4) << vox.itsX ;
46    theStream << " " << std::setw(4) << vox.itsY;
47    theStream << " " << std::setw(4) << vox.itsZ;
48    theStream << std::setprecision(4);
49    theStream << "  " << vox.itsF;
50    return theStream;
51
52  }
53  //--------------------------------------------------------------------
54  //--------------------------------------------------------------------
55
56  Pixel::Pixel(long x, long y, float f)
57  {
58    this->itsX=x;
59    this->itsY=y;
60    this->itsF=f;
61  }
62  //--------------------------------------------------------------------
63
64  Pixel::Pixel(const Pixel& p)
65  {
66    this->itsX=p.itsX;
67    this->itsY=p.itsY;
68    this->itsF=p.itsF;
69  }
70  //--------------------------------------------------------------------
71
72  Pixel& Pixel::operator= (const Pixel& p)
73  {
74    if(this == &p) return *this;
75    this->itsX=p.itsX;
76    this->itsY=p.itsY;
77    this->itsF=p.itsF;
78    return *this;
79  }
80  //--------------------------------------------------------------------
81
82}
Note: See TracBrowser for help on using the repository browser.