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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Aug 22 11:38:14 BST 2011


Author: buckley
Date: Mon Aug 22 11:38:14 2011
New Revision: 313

Log:
Moving scatter add/subtract to named functions

Modified:
   trunk/include/YODA/Scatter2D.h
   trunk/include/YODA/Scatter3D.h
   trunk/src/Scatter2D.cc
   trunk/src/Scatter3D.cc

Modified: trunk/include/YODA/Scatter2D.h
==============================================================================
--- trunk/include/YODA/Scatter2D.h	Mon Aug 22 11:30:34 2011	(r312)
+++ trunk/include/YODA/Scatter2D.h	Mon Aug 22 11:38:14 2011	(r313)
@@ -332,15 +332,24 @@
   /// @name Combining scatters: global operators, assuming aligned points
   //@{
 
-  /// @todo More named operators
+  /// Add two scatters
+  Scatter2D add(const Scatter2D& first, const Scatter2D& second);
 
 
   /// Add two scatters
-  Scatter2D operator + (const Scatter2D& first, const Scatter2D& second);
+  inline Scatter2D operator + (const Scatter2D& first, const Scatter2D& second) {
+    return add(first, second);
+  }
+
+
+  /// Subtract two scatters
+  Scatter2D subtract(const Scatter2D& first, const Scatter2D& second);
 
 
   /// Subtract two scatters
-  Scatter2D operator - (const Scatter2D& first, const Scatter2D& second);
+  inline Scatter2D operator - (const Scatter2D& first, const Scatter2D& second) {
+    return subtract(first, second);
+  }
 
 
   /// Divide two scatters

Modified: trunk/include/YODA/Scatter3D.h
==============================================================================
--- trunk/include/YODA/Scatter3D.h	Mon Aug 22 11:30:34 2011	(r312)
+++ trunk/include/YODA/Scatter3D.h	Mon Aug 22 11:38:14 2011	(r313)
@@ -293,14 +293,29 @@
   //@{
 
   /// Add two scatters
-  Scatter3D operator + (const Scatter3D& first, const Scatter3D& second);
+  Scatter3D add(const Scatter3D& first, const Scatter3D& second);
+
+
+  /// Add two scatters
+  inline Scatter3D operator + (const Scatter3D& first, const Scatter3D& second) {
+    return add(first, second);
+  }
+
 
   /// Subtract two scatters
-  Scatter3D operator - (const Scatter3D& first, const Scatter3D& second);
+  Scatter3D subtract(const Scatter3D& first, const Scatter3D& second);
+
+
+  /// Subtract two scatters
+  inline Scatter3D operator - (const Scatter3D& first, const Scatter3D& second) {
+    return subtract(first, second);
+  }
+
 
   /// Divide two scatters
   Scatter3D divide(const Scatter3D& numer, const Scatter3D& denom);
 
+
   /// Divide two scatters
   inline Scatter3D operator / (const Scatter3D& numer, const Scatter3D& denom) {
     return divide(numer, denom);

Modified: trunk/src/Scatter2D.cc
==============================================================================
--- trunk/src/Scatter2D.cc	Mon Aug 22 11:30:34 2011	(r312)
+++ trunk/src/Scatter2D.cc	Mon Aug 22 11:38:14 2011	(r313)
@@ -51,8 +51,7 @@
 
 
   // Add two scatters
-  /// @todo Implementation in a named add() function
-  Scatter2D operator + (const Scatter2D& first, const Scatter2D& second) {
+  Scatter2D add(const Scatter2D& first, const Scatter2D& second) {
     Scatter2D tmp;
     for (size_t i = 0; i < first.numPoints(); ++i) {
       const Point2D& p1 = first.point(i);
@@ -72,8 +71,7 @@
 
 
   // Subtract two scatters
-  /// @todo Implementation in a named subtract() function
-  Scatter2D operator - (const Scatter2D& first, const Scatter2D& second) {
+  Scatter2D subtract(const Scatter2D& first, const Scatter2D& second) {
     Scatter2D tmp;
     for (size_t i = 0; i < first.numPoints(); ++i) {
       const Point2D& p1 = first.point(i);

Modified: trunk/src/Scatter3D.cc
==============================================================================
--- trunk/src/Scatter3D.cc	Mon Aug 22 11:30:34 2011	(r312)
+++ trunk/src/Scatter3D.cc	Mon Aug 22 11:38:14 2011	(r313)
@@ -6,8 +6,7 @@
 
 
   // Add two scatters
-  /// @todo Implementation in a named add() function
-  Scatter3D operator + (const Scatter3D& first, const Scatter3D& second) {
+  Scatter3D add(const Scatter3D& first, const Scatter3D& second) {
     /// @todo Implement
     throw Exception("Implement me!");
     Scatter3D tmp;
@@ -16,8 +15,7 @@
 
 
   // Subtract two scatters
-  /// @todo Implementation in a named subtract() function
-  Scatter3D operator - (const Scatter3D& first, const Scatter3D& second) {
+  Scatter3D subtract(const Scatter3D& first, const Scatter3D& second) {
     /// @todo Implement
     throw Exception("Implement me!");
     Scatter3D tmp;


More information about the yoda-svn mailing list