[yoda-svn] r274 - in trunk: include/YODA src

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Aug 18 11:10:53 BST 2011


Author: mkawalec
Date: Thu Aug 18 11:10:52 2011
New Revision: 274

Log:
Added copy constructors for all the 2/3D classes apart from HistoBin2D.

Modified:
   trunk/include/YODA/Bin2D.h
   trunk/include/YODA/Dbn2D.h
   trunk/include/YODA/Histo2D.h
   trunk/include/YODA/Point3D.h
   trunk/src/Bin2D.cc

Modified: trunk/include/YODA/Bin2D.h
==============================================================================
--- trunk/include/YODA/Bin2D.h	Thu Aug 18 10:49:52 2011	(r273)
+++ trunk/include/YODA/Bin2D.h	Thu Aug 18 11:10:52 2011	(r274)
@@ -44,6 +44,9 @@
     /// created Histo2D.
     Bin2D(const std::vector<Segment>& edges);
 
+    /// A copy constructor
+    Bin2D(const Bin2D& b);
+
     //@}
 
 

Modified: trunk/include/YODA/Dbn2D.h
==============================================================================
--- trunk/include/YODA/Dbn2D.h	Thu Aug 18 10:49:52 2011	(r273)
+++ trunk/include/YODA/Dbn2D.h	Thu Aug 18 11:10:52 2011	(r274)
@@ -30,8 +30,14 @@
     {  }
 
 
-    /// @todo Add copy constructor
-
+    /// @brief Copy constructor
+    /// Sets all the parameters using the ones provided from
+    /// an existing Dbn2D.
+    Dbn2D(const Dbn2D& toCopy) {
+      _dbnX = toCopy._dbnX;
+      _dbnY = toCopy._dbnY;
+      _sumWXY = toCopy._sumWXY;
+    }
     //@}
 
 

Modified: trunk/include/YODA/Histo2D.h
==============================================================================
--- trunk/include/YODA/Histo2D.h	Thu Aug 18 10:49:52 2011	(r273)
+++ trunk/include/YODA/Histo2D.h	Thu Aug 18 11:10:52 2011	(r274)
@@ -153,8 +153,7 @@
         return _axis.highEdgeY();
     }
 
-    /// Access the bin vector
-    /// @todo Actually, it's a Histo
+    /// Access the bin vector (non-const version)
     std::vector<YODA::HistoBin2D>& bins() {
       return _axis.bins();
     }
@@ -203,12 +202,12 @@
       return _axis.numBinsTotal();
     }
 
-    /// Return number of bins along X axis (const version)
+    /// Return number of bins along X axis
     const size_t numBinsX() const {
       return _axis.numBinsX();
     }
 
-    /// Return the number of bins along Y axis (const version)
+    /// Return the number of bins along Y axis
     const size_t numBinsY() const{
       return _axis.numBinsY();
     }

Modified: trunk/include/YODA/Point3D.h
==============================================================================
--- trunk/include/YODA/Point3D.h	Thu Aug 18 10:49:52 2011	(r273)
+++ trunk/include/YODA/Point3D.h	Thu Aug 18 11:10:52 2011	(r274)
@@ -67,7 +67,16 @@
     }
 
 
-    /// @todo Add copy constructor
+    /// @brief A copy constructor
+    Point3D(const Point3D& p) {
+      _x = p._x;
+      _y = p._y;
+      _z = p._z;
+
+      _ex = p._ex;
+      _ey = p._ey;
+      _ez = p._ez;
+    }
 
     //@}
 

Modified: trunk/src/Bin2D.cc
==============================================================================
--- trunk/src/Bin2D.cc	Thu Aug 18 10:49:52 2011	(r273)
+++ trunk/src/Bin2D.cc	Thu Aug 18 11:10:52 2011	(r274)
@@ -25,18 +25,23 @@
   }
 
 
-   Bin2D::Bin2D(const std::vector<Segment>& edges) {
-     if (edges.size() != 4) {
-       throw RangeError("The edge vector does not define a full rectangle!");
-     }
-     _edges.first.first = edges[0].first.first;
-     _edges.first.second = edges[0].first.second;
-     _edges.second.first = edges[1].second.first;
-     _edges.second.second = edges[1].second.second;
+  Bin2D::Bin2D(const std::vector<Segment>& edges) {
+    if (edges.size() != 4) {
+      throw RangeError("The edge vector does not define a full rectangle!");
+    }
+    _edges.first.first = edges[0].first.first;
+    _edges.first.second = edges[0].first.second;
+    _edges.second.first = edges[1].second.first;
+    _edges.second.second = edges[1].second.second;
 
-     isGhost() = false;
-   }
+    isGhost() = false;
+  }
 
+  Bin2D::Bin2D(const Bin2D& b) {
+    _edges =  b._edges;
+    _dbn =    b._dbn;
+    _isGhost =b._isGhost;
+  }
 
   void Bin2D::scaleXY(double scaleX, double scaleY) {
     _edges.first.first *= scaleX;


More information about the yoda-svn mailing list