Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55975 - sandbox/itl/libs/validate/example/labat_polygon_
From: afojgo_at_[hidden]
Date: 2009-09-02 10:23:15


Author: jofaber
Date: 2009-09-02 10:23:14 EDT (Wed, 02 Sep 2009)
New Revision: 55975
URL: http://svn.boost.org/trac/boost/changeset/55975

Log:
Some comments for polygon law testing to make the code better understandable.
Text files modified:
   sandbox/itl/libs/validate/example/labat_polygon_/labat_polygon.cpp | 5 +++--
   sandbox/itl/libs/validate/example/labat_polygon_/polygon_laws.hpp | 12 ++++++++++--
   2 files changed, 13 insertions(+), 4 deletions(-)

Modified: sandbox/itl/libs/validate/example/labat_polygon_/labat_polygon.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_polygon_/labat_polygon.cpp (original)
+++ sandbox/itl/libs/validate/example/labat_polygon_/labat_polygon.cpp 2009-09-02 10:23:14 EDT (Wed, 02 Sep 2009)
@@ -148,8 +148,9 @@
 
     //-----------------------------------------------------------------------------
         // Set the test automatons parameters:
- // Size of polygon sets is in [0 .. |set|]
- // Size of polygon sets is in [0 .. |set|]
+ // Size of polygon sets is in [0 .. |set| ]
+ // Size of polygon sets is in [0 .. |poly|]
+ // Coordinates in [min .. max)
         // |set|,|poly|, min, max
         GentorProfileSgl::it()->set_polygon_profile(1, 3, 0, 10);
         int test_count = 10000;

Modified: sandbox/itl/libs/validate/example/labat_polygon_/polygon_laws.hpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_polygon_/polygon_laws.hpp (original)
+++ sandbox/itl/libs/validate/example/labat_polygon_/polygon_laws.hpp 2009-09-02 10:23:14 EDT (Wed, 02 Sep 2009)
@@ -80,10 +80,12 @@
     };
 
 
-
- template <typename Type>
+ template <typename Type> //Type can be more than one parameter for mixed laws with different types
     class PolygonSymmetricDifference
         : public Law<PolygonSymmetricDifference<Type>,
+ // Input type list Result type list
+ // Types of the variables Tpyes of the righthand and the lefthand side.
+ // in a law Can be more, if you want to see interim results.
                      LOKI_TYPELIST_2(Type,Type), LOKI_TYPELIST_2(Type,Type)>
     {
         // a o b == b o a computed as
@@ -92,6 +94,7 @@
         //Output = (sum_lhs, sum_rhs)
         
     public:
+ // These are descriptive informations to create readable output.
         std::string name()const { return "Polygon Symmetric Difference"; }
         std::string formula()const { return "(a+b) - (a&b) == (a-b) + (b-a)"; }
 
@@ -102,17 +105,21 @@
 
     public:
 
+ // Define a size measure for the laws input variables. According to
+ // this size the smallest law instances are collected if violations occur.
         size_t size()const
         {
             return value_size<Type>::apply(this->template getInputValue<operand_a>())+
                    value_size<Type>::apply(this->template getInputValue<operand_b>());
         }
 
+ // This function has to be coded to test the validity of a law instance.
         bool holds()
         {
                         using namespace boost::polygon;
                         using namespace boost::polygon::operators;
 
+ // There are predifined constants operand_a, _b, ..., lhs_reult, rhs_result in the base class.
                         //std::cout << this->template getInputValue<operand_a>().as_string() << std::endl;
 
                         // --- left hand side ------------------------
@@ -135,6 +142,7 @@
             Type rhs = a_minus_b;
             boost::polygon::operators::operator+=(rhs, b_minus_a);
 
+ // Set the output variables of this law instance.
             this->template setOutputValue<lhs_result>(lhs);
             this->template setOutputValue<rhs_result>(rhs);
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk