|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56648 - in sandbox/itl: boost/itl boost/itl/type_traits boost/itl_xt boost/itl_xt/std boost/validate boost/validate/driver boost/validate/gentor boost/validate/itl boost/validate/laws boost/validate/validater libs/itl/build/win32 libs/itl/doc libs/itl/test/test_casual_ libs/validate/example/labat_map_copy_conformity_ libs/validate/example/labat_polygon_ libs/validate/example/labat_single_ libs/validate/example/labat_val_relations_
From: afojgo_at_[hidden]
Date: 2009-10-08 10:32:00
Author: jofaber
Date: 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
New Revision: 56648
URL: http://svn.boost.org/trac/boost/changeset/56648
Log:
Added itl::insert_iterator, add_iterator, inserter, adder to support std::copy and std::transform for
constructing and aggregating interval containers via std::copy and std::transform. Added labatea test
testing the conformity of std::copy and equivalent loops.
Stable {msvc-8.0, 9.0}.
Added:
sandbox/itl/boost/itl/iterator.hpp (contents, props changed)
sandbox/itl/boost/itl_xt/map_segment_gentor.hpp (contents, props changed)
sandbox/itl/boost/itl_xt/std/
sandbox/itl/boost/itl_xt/std/pair.hpp (contents, props changed)
sandbox/itl/boost/validate/driver/itl_relations_driver.hpp (contents, props changed)
sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp (contents, props changed)
sandbox/itl/boost/validate/itl/
sandbox/itl/boost/validate/itl/functors.hpp (contents, props changed)
sandbox/itl/boost/validate/laws/function_equality.hpp (contents, props changed)
sandbox/itl/boost/validate/validater/function_equality_validater.hpp (contents, props changed)
sandbox/itl/libs/validate/example/labat_map_copy_conformity_/
sandbox/itl/libs/validate/example/labat_map_copy_conformity_/labat_map_copy_conformity.cpp (contents, props changed)
sandbox/itl/libs/validate/example/labat_map_copy_conformity_/vc9_labat_map_copy_conformity.vcproj (contents, props changed)
Removed:
sandbox/itl/boost/validate/itl_relations_validater.hpp
Text files modified:
sandbox/itl/boost/itl/functors.hpp | 93 ++++++++++++++++++++++++++++++++++++---
sandbox/itl/boost/itl/interval_base_map.hpp | 46 +++++++++++--------
sandbox/itl/boost/itl/interval_map.hpp | 2
sandbox/itl/boost/itl/map.hpp | 36 ++++++++++++--
sandbox/itl/boost/itl/set.hpp | 4 +
sandbox/itl/boost/itl/split_interval_map.hpp | 2
sandbox/itl/boost/itl/type_traits/type_to_string.hpp | 2
sandbox/itl/boost/itl_xt/list.hpp | 63 ++++++++++++++------------
sandbox/itl/boost/itl_xt/mapgentor.hpp | 58 ++++++------------------
sandbox/itl/boost/itl_xt/seqgentor.hpp | 24 ++++++---
sandbox/itl/boost/itl_xt/setgentor.hpp | 5 -
sandbox/itl/boost/validate/gentor/randomgentor.hpp | 69 ++++++++++++++++++++++++++++
sandbox/itl/boost/validate/utility.hpp | 4 +
sandbox/itl/boost/validate/validater/interval_morphic_validater.hpp | 12 ++--
sandbox/itl/boost/validate/validater/signed_quantifier_validater.hpp | 3
sandbox/itl/libs/itl/build/win32/vc9_all.sln | 6 ++
sandbox/itl/libs/itl/doc/concepts.qbk | 10 ++--
sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp | 8 ++-
sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp | 7 +++
sandbox/itl/libs/validate/example/labat_polygon_/polygon_gentor.hpp | 40 +++++++++++------
sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp | 29 ++++++++++-
sandbox/itl/libs/validate/example/labat_val_relations_/labat_val_relations.cpp | 4
22 files changed, 366 insertions(+), 161 deletions(-)
Modified: sandbox/itl/boost/itl/functors.hpp
==============================================================================
--- sandbox/itl/boost/itl/functors.hpp (original)
+++ sandbox/itl/boost/itl/functors.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -9,6 +9,7 @@
#define BOOST_ITL_FUNCTORS_HPP_JOFA_080315
#include <functional>
+#include <boost/type_traits.hpp>
#include <boost/itl/type_traits/neutron.hpp>
#include <boost/itl/type_traits/unon.hpp>
@@ -33,7 +34,6 @@
: public neutron_based_inplace_combine<Type>
{
void operator()(Type& object, const Type& operand)const{}
- static Type neutron() { return boost::itl::neutron<Type>::value(); }
};
template<>
@@ -49,7 +49,6 @@
if(object == operand)
object = Type();
}
- static Type neutron() { return boost::itl::neutron<Type>::value(); }
};
template<>
@@ -64,6 +63,8 @@
void operator()(Type& object, const Type& operand)const
{ object += operand; }
+
+ static void version(Type& object){}
};
template<>
@@ -76,8 +77,6 @@
typedef Type type;
void operator()(Type& object, const Type& operand)const
{ object -= operand; }
-
- static Type neutron() { return boost::itl::neutron<Type>::value(); }
};
template<>
@@ -91,6 +90,8 @@
void operator()(Type& object, const Type& operand)const
{ object |= operand; }
+
+ static void version(Type& object){}
};
template<>
@@ -162,7 +163,7 @@
inline std::string unary_template_to_string<inplace_caret>::apply() { return "^="; }
// ------------------------------------------------------------------------
- template <typename Type> struct inserter
+ template <typename Type> struct inplace_insert
: public neutron_based_inplace_combine<Type>
{
void operator()(Type& object, const Type& operand)const
@@ -172,10 +173,10 @@
};
template<>
- inline std::string unary_template_to_string<inserter>::apply() { return "ins="; }
+ inline std::string unary_template_to_string<inplace_insert>::apply() { return "ins="; }
// ------------------------------------------------------------------------
- template <typename Type> struct eraser
+ template <typename Type> struct inplace_erase
: public neutron_based_inplace_combine<Type>
{
void operator()(Type& object, const Type& operand)const
@@ -185,7 +186,7 @@
};
template<>
- inline std::string unary_template_to_string<eraser>::apply() { return "ers="; }
+ inline std::string unary_template_to_string<inplace_erase>::apply() { return "ers="; }
// ------------------------------------------------------------------------
template <typename Type> struct inplace_star
@@ -247,6 +248,7 @@
//--------------------------------------------------------------------------
// Inverse functor
+ //--------------------------------------------------------------------------
template<class Functor> struct inverse;
template<class Type>
@@ -298,6 +300,81 @@
{ typedef itl::inplace_max<Type> type; };
+ //--------------------------------------------------------------------------
+ // Positive or negative functor trait
+ //--------------------------------------------------------------------------
+ template<class Functor> struct is_negative;
+
+ template<class Functor>
+ struct is_negative
+ {
+ typedef is_negative<Functor> type;
+ BOOST_STATIC_CONSTANT(bool, value = false);
+ };
+
+ template<class Type>
+ struct is_negative<itl::inplace_minus<Type> >
+ {
+ typedef is_negative type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+ };
+
+ template<class Type>
+ struct is_negative<itl::inplace_bit_subtract<Type> >
+ {
+ typedef is_negative type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+ };
+
+ //--------------------------------------------------------------------------
+ // Pro- or in-version functor
+ //--------------------------------------------------------------------------
+ template<class Combiner> struct version;
+
+ template<class Combiner>
+ struct version
+ {
+ typedef version<Combiner> type;
+ typedef typename
+ remove_const<
+ typename remove_reference<typename Combiner::first_argument_type
+ >::type
+ >::type
+ argument_type;
+ // The pro-version of an contruction functor lets the value unchanged
+ // 0 o= x == x;
+ argument_type operator()(const argument_type& value){ return value; }
+ };
+
+ template<class Type>
+ struct version<itl::inplace_minus<Type> >
+ {
+ typedef version type;
+ typedef itl::inplace_minus<Type> Combiner;
+
+ Type operator()(const Type& value)
+ {
+ Type inverse = Combiner::neutron();
+ Combiner()(inverse, value);
+ return inverse;
+ }
+ };
+
+ template<class Type>
+ struct version<itl::inplace_bit_subtract<Type> >
+ {
+ typedef version type;
+ typedef itl::inplace_bit_subtract<Type> Combiner;
+
+ Type operator()(const Type& value)
+ {
+ Type inverse = Combiner::neutron();
+ Combiner()(inverse, value);
+ return inverse;
+ }
+ };
+
+
}} // namespace itl boost
#endif
Modified: sandbox/itl/boost/itl/interval_base_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_map.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -157,9 +157,6 @@
typedef typename ImplMapT::const_reference const_reference;
public:
- inline static bool has_symmetric_difference()
- { return is_set<codomain_type>::value || (!is_set<codomain_type>::value && !traits::is_total); }
-
enum { is_itl_container = true };
enum { fineness = 0 };
@@ -766,12 +763,8 @@
template <class Combiner>
std::pair<iterator,bool> map_insert(const interval_type& inter_val, const codomain_type& co_val)
{
- if(Traits::is_total)
- {
- CodomainT added_val = Combiner::neutron();
- Combiner()(added_val, co_val);
- return this->_map.insert(value_type(inter_val, added_val));
- }
+ if(Traits::is_total && has_inverse<codomain_type>::value && is_negative<Combiner>::value)
+ return this->_map.insert(value_type(inter_val, version<Combiner>()(co_val)));
else
return this->_map.insert(value_type(inter_val, co_val));
}
@@ -781,6 +774,24 @@
std::pair<iterator, bool>
map_insert(iterator prior_, const interval_type& inter_val, const codomain_type& co_val)
{
+ iterator inserted_
+ = this->_map.insert(prior_, value_type(inter_val, co_val));
+
+ if(inserted_ == prior_)
+ return std::pair<iterator,bool>(inserted_, false);
+ else if(inserted_->first == inter_val)
+ return std::pair<iterator,bool>(inserted_, true);
+ else
+ return std::pair<iterator,bool>(inserted_, false);
+ }
+
+ template <class Combiner>
+ std::pair<iterator, bool>
+ map_add(iterator prior_, const interval_type& inter_val, const codomain_type& co_val)
+ {
+ // Never try to insert a neutron into a neutron absorber here:
+ BOOST_ASSERT(!(Traits::absorbs_neutrons && co_val==Combiner::neutron()));
+
iterator inserted_
= this->_map.base_insert(prior_, value_type(inter_val, Combiner::neutron()));
@@ -793,6 +804,7 @@
return std::pair<iterator,bool>(inserted_, false);
}
+
template <class Combiner>
iterator gap_insert(iterator prior_, const interval_type& inter_val, const codomain_type& co_val)
{
@@ -800,14 +812,10 @@
BOOST_ASSERT(this->_map.find(inter_val) == this->_map.end());
BOOST_ASSERT(!(Traits::absorbs_neutrons && co_val==Combiner::neutron()));
- if(Traits::is_total)
- {
- iterator inserted_ = this->_map.base_insert(prior_, value_type(inter_val, Combiner::neutron()));
- Combiner()(inserted_->second, co_val);
- return inserted_;
- }
+ if(has_inverse<codomain_type>::value && is_negative<Combiner>::value)
+ return this->_map.insert(prior_, value_type(inter_val, version<Combiner>()(co_val)));
else
- return this->_map.base_insert(prior_, value_type(inter_val, co_val));
+ return this->_map.insert(prior_, value_type(inter_val, co_val));
}
protected:
@@ -921,7 +929,7 @@
typedef IntervalMap<DomainT,CodomainT,
Traits,Compare,Combine,Section,Interval,Alloc> sectant_type;
- if(Traits::is_total)
+ if(Traits::is_total)
{
intersection = *this;
intersection += sectant;
@@ -950,7 +958,7 @@
const typename interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
::segment_type& sectant)const
{
- if(Traits::is_total)
+ if(Traits::is_total)
{
section = *this;
section.add(sectant);
@@ -1284,7 +1292,7 @@
{
const_cast<interval_type&>(first_->first).right_subtract(minuend);
if(!right_resid.empty())
- this->_map.base_insert(first_, value_type(right_resid, first_->second));
+ this->_map.insert(first_, value_type(right_resid, first_->second));
}
else if(!right_resid.empty())
const_cast<interval_type&>(first_->first).left_subtract(minuend);
Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -307,7 +307,7 @@
return prior_;
std::pair<iterator,bool> insertion
- = this->template map_insert<Combiner>(prior_, inter_val, co_val);
+ = this->template map_add<Combiner>(prior_, inter_val, co_val);
if(insertion.second)
return join_neighbours(insertion.first);
Added: sandbox/itl/boost/itl/iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/iterator.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,100 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2009-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_ITERATOR_HPP_JOFA_091003
+#define BOOST_ITL_ITERATOR_HPP_JOFA_091003
+
+#include <iterator>
+
+namespace boost{namespace itl
+{
+
+/** Performes an addition using a container's memberfunction add, when operator= is called. */
+template<class ContainerT> class add_iterator
+ : public std::iterator<std::output_iterator_tag, void, void, void, void>
+{
+public:
+ /// The container's type.
+ typedef ContainerT container_type;
+
+ /** An add_iterator is constructed with a container and a position
+ that has to be maintained. */
+ add_iterator(ContainerT& cont, typename ContainerT::iterator iter)
+ : _cont(&cont), _iter(iter) {}
+
+ /** This assignment operator adds the \c value before the current position.
+ It maintains it's position by incrementing after addition. */
+ add_iterator& operator=(typename ContainerT::const_reference value)
+ {
+ _iter = _cont->add(_iter, value);
+ if(_iter != _cont->end())
+ ++_iter;
+ return *this;
+ }
+
+ add_iterator& operator*() { return *this; }
+ add_iterator& operator++() { return *this; }
+ add_iterator& operator++(int){ return *this; }
+
+private:
+ ContainerT* _cont;
+ typename ContainerT::iterator _iter;
+};
+
+
+/** Function adder creates and initializes an add_iterator */
+template<class ContainerT, typename IteratorT>
+inline add_iterator<ContainerT> adder(ContainerT& cont, IteratorT iter_)
+{
+ return add_iterator<ContainerT>(cont, typename ContainerT::iterator(iter_));
+}
+
+/** Performes an insertion using a container's memberfunction add, when operator= is called. */
+template<class ContainerT> class insert_iterator
+ : public std::iterator<std::output_iterator_tag, void, void, void, void>
+{
+public:
+ /// The container's type.
+ typedef ContainerT container_type;
+
+ /** An insert_iterator is constructed with a container and a position
+ that has to be maintained. */
+ insert_iterator(ContainerT& cont, typename ContainerT::iterator iter)
+ : _cont(&cont), _iter(iter) {}
+
+ /** This assignment operator adds the \c value before the current position.
+ It maintains it's position by incrementing after addition. */
+ insert_iterator& operator=(typename ContainerT::const_reference value)
+ {
+ _iter = _cont->insert(_iter, value);
+ if(_iter != _cont->end())
+ ++_iter;
+ return *this;
+ }
+
+ insert_iterator& operator*() { return *this; }
+ insert_iterator& operator++() { return *this; }
+ insert_iterator& operator++(int){ return *this; }
+
+private:
+ ContainerT* _cont;
+ typename ContainerT::iterator _iter;
+};
+
+
+/** Function inserter creates and initializes an insert_iterator */
+template<class ContainerT, typename IteratorT>
+inline insert_iterator<ContainerT> inserter(ContainerT& cont, IteratorT iter_)
+{
+ return insert_iterator<ContainerT>(cont, typename ContainerT::iterator(iter_));
+}
+
+}} // namespace itl boost
+
+#endif // BOOST_ITL_ITERATOR_HPP_JOFA_091003
+
+
Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -181,10 +181,6 @@
using base_type::operator[];
public:
- inline static bool has_symmetric_difference()
- { return is_set<codomain_type>::value || (!is_set<codomain_type>::value && !traits::is_total); }
-
-public:
//==========================================================================
//= Containedness
//==========================================================================
@@ -285,6 +281,11 @@
return base_type::insert(prior, value_pair);
}
+ std::pair<iterator,bool> base_insert(const value_type& value_pair)
+ {
+ return base_type::insert(value_pair);
+ }
+
/** With <tt>key_value_pair = (k,v)</tt> set value \c v for key \c k */
map& set(const element_type& key_value_pair)
{
@@ -424,7 +425,7 @@
return *this;
std::pair<iterator, bool> insertion;
- if(Traits::is_total)
+ if(Traits::is_total && has_inverse<codomain_type>::value)
{
CodomainT added_val = Combiner::neutron();
Combiner()(added_val, val.second);
@@ -468,6 +469,29 @@
return inserted_;
}
+/*JODO CONT
+template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
+ template <class Combiner>
+std::pair<typename map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>::iterator, bool>
+ map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>
+ ::add(iterator prior_, const domain_type& val, const codomain_type& co_val)
+{
+ if(Traits::absorbs_neutrons && co_val == Combiner::neutron())
+ return std::pair<iterator,bool>(prior_, false);
+
+ iterator inserted_ = base_insert(prior_, value_type(val.first, Combiner::neutron()));
+ if(Traits::absorbs_neutrons && inserted_->second == Combiner::neutron())
+ {
+ erase(inserted_);
+ return prior_;
+ }
+ else
+ {
+ Combiner()(inserted_->second, val.second);
+ return inserted_;
+ }
+}
+*/
//==============================================================================
//= Subtraction
@@ -520,7 +544,7 @@
void map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>
::add_intersection(map& section, const value_type& sectant)const
{
- if(Traits::is_total)
+ if(Traits::is_total)
{
section = *this;
section.add(sectant);
Modified: sandbox/itl/boost/itl/set.hpp
==============================================================================
--- sandbox/itl/boost/itl/set.hpp (original)
+++ sandbox/itl/boost/itl/set.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -644,7 +644,9 @@
{ return object -= operand; }
-//---------------------------------------------------------------------------------
+//==============================================================================
+//= Streaming
+//==============================================================================
template<class CharType, class CharTraits,
class DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
std::basic_ostream<CharType, CharTraits>& operator <<
Modified: sandbox/itl/boost/itl/split_interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_map.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_map.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -206,7 +206,7 @@
return prior_;
std::pair<iterator,bool> insertion
- = this->template map_insert<Combiner>(prior_, inter_val, co_val);
+ = this->template map_add<Combiner>(prior_, inter_val, co_val);
if(insertion.second)
return insertion.first;
Modified: sandbox/itl/boost/itl/type_traits/type_to_string.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/type_to_string.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/type_to_string.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -33,7 +33,7 @@
template<>
inline std::string type_to_string<unsigned int>::apply() { return "int+"; }
template<>
- inline std::string type_to_string<double>::apply() { return "double"; }
+ inline std::string type_to_string<double>::apply() { return "dbl"; }
template<>
inline std::string type_to_string<std::string>::apply() { return "string"; }
Modified: sandbox/itl/boost/itl_xt/list.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/list.hpp (original)
+++ sandbox/itl/boost/itl_xt/list.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -1,31 +1,11 @@
/*-----------------------------------------------------------------------------+
+Author: Joachim Faulhaber
Copyright (c) 2007-2009: Joachim Faulhaber
-+------------------------------------------------------------------------------+
Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
+------------------------------------------------------------------------------+
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------------------------------------*/
/* ------------------------------------------------------------------
class itl::list
@@ -39,6 +19,7 @@
#include <list>
#include <algorithm>
#include <boost/assert.hpp>
+#include <boost/itl_xt/std/pair.hpp>
#include <boost/itl/detail/design_config.hpp>
#include <boost/itl/type_traits/to_string.hpp>
#include <boost/itl/set_algo.hpp>
@@ -437,12 +418,34 @@
}
}
- template <class Type>
- struct type_to_string<itl::list<Type> >
- {
- static std::string apply()
- { return "list<"+ type_to_string<Type>::apply() +">"; }
- };
+//==============================================================================
+//= Streaming
+//==============================================================================
+template<class CharType, class CharTraits,
+ class DataT, ITL_ALLOC Alloc>
+std::basic_ostream<CharType, CharTraits>& operator <<
+ (std::basic_ostream<CharType, CharTraits>& stream,
+ const itl::list<DataT,Alloc>& object)
+{
+ typedef itl::list<DataT,Alloc> ObjectT;
+ stream << "[";
+ typename ObjectT::const_iterator it = object.begin();
+ if(it != object.end())
+ stream << *it++;
+ while(it != object.end())
+ stream << " " << *it++;
+ return stream << "]";
+}
+
+//-----------------------------------------------------------------------------
+// type traits
+//-----------------------------------------------------------------------------
+template <class Type>
+struct type_to_string<itl::list<Type> >
+{
+ static std::string apply()
+ { return "list<"+ type_to_string<Type>::apply() +">"; }
+};
}} // namespace itl boost
Added: sandbox/itl/boost/itl_xt/map_segment_gentor.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl_xt/map_segment_gentor.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,73 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2009-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_XT_MAP_SEGMENT_GENTOR_HPP_JOFA_091004
+#define BOOST_ITL_XT_MAP_SEGMENT_GENTOR_HPP_JOFA_091004
+
+
+#include <boost/itl_xt/gentorit.hpp>
+#include <boost/itl_xt/numbergentor.hpp>
+#include <boost/itl_xt/itvgentor.hpp>
+#include <boost/itl_xt/seqgentor.hpp>
+
+namespace boost{namespace itl
+{
+
+template <class DomainT, class CodomainT>
+class map_segment_gentor: public RandomGentorAT<std::pair<itl::interval<DomainT>, CodomainT> >
+{
+public:
+ typedef DomainT domain_type;
+ typedef CodomainT codomain_type;
+ typedef itl::interval<DomainT> interval_type;
+ typedef std::pair<itl::interval<DomainT>, CodomainT> segment_type;
+
+public:
+ map_segment_gentor(): _codomain_gentor(NULL){}
+ ~map_segment_gentor(){ delete _codomain_gentor; }
+
+ virtual void some(segment_type& x);
+
+ void set_range(const itl::interval<domain_type>& range)
+ { _interval_gentor.setRange(range); }
+
+ void set_corange(const itl::interval<codomain_type>& range)
+ { _covalue_range = range; }
+
+ void setMaxIntervalLength(domain_type max_itv_length)
+ { _interval_gentor.setMaxIntervalLength(max_itv_length); }
+
+ void setCodomainGentor(RandomGentorAT<codomain_type>* gentor)
+ {
+ delete _codomain_gentor;
+ _codomain_gentor = gentor;
+ }
+
+private:
+ ItvGentorT<domain_type> _interval_gentor;
+ RandomGentorAT<codomain_type>* _codomain_gentor;
+ itl::interval<codomain_type> _covalue_range;
+};
+
+
+template <class DomainT, class CodomainT>
+void map_segment_gentor<DomainT,CodomainT>::some(segment_type& value)
+{
+ interval_type inter_val;
+ codomain_type co_val;
+ _interval_gentor.some(inter_val);
+ _codomain_gentor->some(co_val);
+ value = segment_type(inter_val, co_val);
+};
+
+}} // BOOST_ITL_XT_MAP_SEGMENT_GENTOR_HPP_JOFA_091004
+
+#endif
+
+
Modified: sandbox/itl/boost/itl_xt/mapgentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/mapgentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/mapgentor.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -1,41 +1,13 @@
-/*-----------------------------------------------------------------------------+
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2007-2009: Joachim Faulhaber
Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
+------------------------------------------------------------------------------+
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------------------------------------*/
-
-
-/* ------------------------------------------------------------------
-class MapGentorT
- A random generator for Maps.
- ContainerGentorT does not cover maps, because its
- value_type contains const parts so void some(value_type& x)
- can NOT be implemented
---------------------------------------------------------------------*/
-#ifndef __MAPGENTOR_H_JOFA_000724__
-#define __MAPGENTOR_H_JOFA_000724__
+#ifndef BOOST_ITL_XT_MAPGENTOR_HPP_JOFA_000724
+#define BOOST_ITL_XT_MAPGENTOR_HPP_JOFA_000724
#include <boost/itl_xt/list.hpp>
#include <boost/itl_xt/gentorit.hpp>
@@ -47,10 +19,10 @@
class MapGentorT: public RandomGentorAT<MapTV>
{
public:
- typedef typename MapTV::value_type ValueTypeTD;
- typedef typename MapTV::key_type DomainTD;
- typedef typename MapTV::data_type CodomainTD;
- typedef list<ValueTypeTD> SampleTypeTD;
+ typedef typename MapTV::value_type ValueTypeTD;
+ typedef typename MapTV::key_type DomainTD;
+ typedef typename MapTV::data_type CodomainTD;
+ typedef list<ValueTypeTD> SampleTypeTD;
MapGentorT(): p_domainGentor(NULL), p_codomainGentor(NULL) {}
~MapGentorT() { delete p_domainGentor; delete p_codomainGentor; }
@@ -61,14 +33,12 @@
void setDomainGentor(RandomGentorAT<DomainTD>* gentor)
{
- if(p_domainGentor)
- delete p_domainGentor;
+ delete p_domainGentor;
p_domainGentor = gentor;
}
void setCodomainGentor(RandomGentorAT<CodomainTD>* gentor)
{
- if(p_codomainGentor)
- delete p_codomainGentor;
+ delete p_codomainGentor;
p_codomainGentor = gentor;
}
@@ -155,6 +125,6 @@
}} // namespace itl boost
-#endif
+#endif // BOOST_ITL_XT_MAPGENTOR_HPP_JOFA_000724
Modified: sandbox/itl/boost/itl_xt/seqgentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/seqgentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/seqgentor.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -42,16 +42,22 @@
class SeqGentorT: public RandomGentorAT<SeqTV>
{
public:
- typedef typename SeqTV::value_type ValueTypeTD;
- typedef typename SeqTV::value_type DomainTD;
+ typedef typename SeqTV::value_type ValueTypeTD;
+ typedef typename SeqTV::value_type DomainTD;
typedef list<ValueTypeTD> SampleTypeTD;
+ SeqGentorT(): p_domainGentor(NULL), m_unique(false){}
+ ~SeqGentorT(){ delete p_domainGentor; }
+
virtual void some(SeqTV& x);
void last(SeqTV& x)const;
void last_permuted(SeqTV& x)const;
void setDomainGentor(RandomGentorAT<DomainTD>* gentor)
- { m_domainGentor = gentor; }
+ {
+ delete p_domainGentor;
+ p_domainGentor = gentor;
+ }
void setRangeOfSampleSize(int lwb, int upb)
{ m_sampleSizeRange = interval<int>::rightopen(lwb,upb); }
@@ -61,11 +67,11 @@
void setUnique(bool truth) { m_unique = truth; }
private:
- RandomGentorAT<DomainTD>* m_domainGentor;
- interval<int> m_sampleSizeRange;
- SampleTypeTD m_sample;
- int m_sampleSize;
- bool m_unique;
+ RandomGentorAT<DomainTD>* p_domainGentor;
+ interval<int> m_sampleSizeRange;
+ SampleTypeTD m_sample;
+ int m_sampleSize;
+ bool m_unique;
};
@@ -80,7 +86,7 @@
for(int i=0; i<m_sampleSize; i++)
{
DomainTD key;
- m_domainGentor->some(key);
+ p_domainGentor->some(key);
if(m_unique)
{
Modified: sandbox/itl/boost/itl_xt/setgentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/setgentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/setgentor.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -50,7 +50,7 @@
typedef DomainGentorT* DomainGentorPT;
SetGentorT(): p_domainGentor(NULL) {}
- ~SetGentorT() {}
+ ~SetGentorT() { delete p_domainGentor; }
virtual void some(SetTV& x);
void last(SetTV& x)const;
@@ -58,8 +58,7 @@
void setDomainGentor(RandomGentorAT<DomainTD>* gentor)
{
- if(p_domainGentor)
- delete p_domainGentor;
+ delete p_domainGentor;
p_domainGentor = gentor;
}
Added: sandbox/itl/boost/itl_xt/std/pair.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl_xt/std/pair.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,41 @@
+/*-----------------------------------------------------------------------------+
+Author: Joachim Faulhaber
+Copyright (c) 2007-2009: Joachim Faulhaber
+Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------+
+Additions to std::pair
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_XT_STD_PAIR_HPP_JOFA_091006
+#define BOOST_ITL_XT_STD_PAIR_HPP_JOFA_091006
+
+#include <boost/itl/type_traits/type_to_string.hpp>
+
+namespace std {
+
+template<class CharType, class CharTraits, class FirstT, class SecondT>
+std::basic_ostream<CharType, CharTraits>& operator <<
+ (std::basic_ostream<CharType, CharTraits>& stream, const std::pair<FirstT,SecondT>& object)
+{
+ typedef std::pair<FirstT,SecondT> ObjectT;
+ return stream << "(" << object.first << "," << object.second << ")";
+}
+
+} //namespace std
+
+namespace boost{namespace itl
+{
+
+template<>
+inline std::string binary_template_to_string<std::pair>::apply() { return "p"; }
+
+}} // namespace itl boost
+
+
+#endif // BOOST_ITL_XT_STD_PAIR_HPP_JOFA_091006
+
Added: sandbox/itl/boost/validate/driver/itl_relations_driver.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/validate/driver/itl_relations_driver.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,172 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2007-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#pragma once
+
+#include <iostream>
+#include <stdio.h>
+#include <time.h>
+#include <boost/validate/validater/itl_induced_relations.hpp>
+#include <boost/validate/driver/itl_driver.hpp>
+#include <boost/validate/utility.hpp>
+
+namespace boost{namespace itl
+{
+
+ class itl_relations_driver : public itl_driver
+ {
+ public:
+ itl_relations_driver() { setProfile(); }
+
+
+ void setProfile()
+ {
+ setValid(true);
+ _rootChoice.setSize(RootType::Types_size);
+ _rootChoice.setMaxWeights(100);
+ _rootChoice[RootType::itl_set] = 0;
+ _rootChoice[RootType::interval_set] = 10;
+ _rootChoice[RootType::separate_interval_set] = 10;
+ _rootChoice[RootType::split_interval_set] = 10;
+ _rootChoice[RootType::itl_map] = 0;
+ _rootChoice[RootType::interval_map] = 35;
+ _rootChoice[RootType::split_interval_map] = 35;
+ setRootTypeNames();
+ _rootChoice.init();
+
+ _domainChoice.setSize(DomainType::DomainTypes_size);
+ _domainChoice.setMaxWeights(100);
+ _domainChoice[DomainType::Int] = 100;
+ _domainChoice[DomainType::Double] = 0; //NOTE: induced relations only
+ setDomainTypeNames(); // work for integral DomainType, because
+ _domainChoice.init(); // atomized_type needs to be finite.
+
+ _codomainChoice.setSize(CodomainType::CodomainTypes_size);
+ _codomainChoice.setMaxWeights(100);
+ _codomainChoice[CodomainType::Int] = 100;
+ _codomainChoice[CodomainType::Double] = 0;
+ _codomainChoice[CodomainType::set_int] = 0;
+ setCodomainTypeNames();
+ _codomainChoice.init();
+
+ _neutronizerChoice.setSize(NeutronHandlerType::NeutronHandlerTypes_size);
+ _neutronizerChoice.setMaxWeights(100);
+ _neutronizerChoice[NeutronHandlerType::partial_absorber] = 25;
+ _neutronizerChoice[NeutronHandlerType::partial_enricher] = 25;
+ _neutronizerChoice[NeutronHandlerType::total_absorber] = 25;
+ _neutronizerChoice[NeutronHandlerType::total_enricher] = 25;
+ setNeutronHandlerTypeNames();
+ _neutronizerChoice.init();
+
+ if(!_rootChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _rootChoice.inconsitencyMessage("itl_relations_driver::setProfile()") << std::endl;
+ }
+
+ if(!_domainChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _domainChoice.inconsitencyMessage("itl_relations_driver::setProfile()") << std::endl;
+ }
+
+ if(!_codomainChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _codomainChoice.inconsitencyMessage("itl_relations_driver::setProfile()") << std::endl;
+ }
+
+ if(!_neutronizerChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _neutronizerChoice.inconsitencyMessage("itl_relations_driver::setProfile()") << std::endl;
+ }
+
+ }
+
+
+ algebra_validater* chooseValidater()
+ {
+ int rootChoice = _rootChoice.some();
+ int domainChoice = _domainChoice.some();
+ int codomainChoice = _codomainChoice.some();
+ int neutronizerChoice = _neutronizerChoice.some();
+
+ switch(rootChoice)
+ {
+ case RootType::interval_set: {
+ switch(domainChoice) {
+ case DomainType::Int: return new itl_induced_relations_validater<interval_set<int> >;
+ default: return choiceError(ITL_LOCATION("\nRootType::interval_set: domainChoice:\n"),
+ domainChoice, _domainChoice);
+ }
+ }
+ case RootType::separate_interval_set: {
+ switch(domainChoice) {
+ case DomainType::Int: return new itl_induced_relations_validater<separate_interval_set<int> >;
+ default: return choiceError(ITL_LOCATION("\nRootType::separate_interval_set: domainChoice:\n"),
+ domainChoice, _domainChoice);
+ }
+ }
+ case RootType::split_interval_set: {
+ switch(domainChoice) {
+ case DomainType::Int: return new itl_induced_relations_validater<split_interval_set<int> >;
+ default: return choiceError(ITL_LOCATION("\nRootType::split_interval_set: domainChoice:\n"),
+ domainChoice, _domainChoice);
+ }
+ }
+ case RootType::split_interval_map: {
+ switch(domainChoice) {
+ case DomainType::Int:
+ switch(neutronizerChoice) {
+ case NeutronHandlerType::partial_absorber:
+ return new itl_induced_relations_validater<split_interval_map<int,int,partial_absorber> >;
+ case NeutronHandlerType::partial_enricher:
+ return new itl_induced_relations_validater<split_interval_map<int,int,partial_enricher> >;
+ case NeutronHandlerType::total_absorber:
+ return new itl_induced_relations_validater<split_interval_map<int,int,total_absorber> >;
+ case NeutronHandlerType::total_enricher:
+ return new itl_induced_relations_validater<split_interval_map<int,int,total_enricher> >;
+ default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: neutronizerChoice:\n"),
+ neutronizerChoice, _neutronizerChoice);
+ }
+ default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: domainChoice:\n"),
+ domainChoice, _domainChoice);
+ }
+ }
+ case RootType::interval_map: {
+ switch(domainChoice) {
+ case DomainType::Int:
+ switch(neutronizerChoice) {
+ case NeutronHandlerType::partial_absorber:
+ return new itl_induced_relations_validater<interval_map<int,int,partial_absorber> >;
+ case NeutronHandlerType::partial_enricher:
+ return new itl_induced_relations_validater<interval_map<int,int,partial_enricher> >;
+ case NeutronHandlerType::total_absorber:
+ return new itl_induced_relations_validater<interval_map<int,int,total_absorber> >;
+ case NeutronHandlerType::total_enricher:
+ return new itl_induced_relations_validater<interval_map<int,int,total_enricher> >;
+ default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: neutronizerChoice:\n"),
+ neutronizerChoice, _neutronizerChoice);
+ }
+ default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: domainChoice:\n"),
+ domainChoice, _domainChoice);
+ }
+ }
+ default: return choiceError(ITL_LOCATION("rootChoice:\n"), rootChoice, _rootChoice);
+ } //switch()
+
+ return NULL; //just to please the compiler ;)
+ }
+
+ };
+
+
+}} // namespace itl boost
+
Added: sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,148 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2007-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_VALIDATE_DRIVER_MAP_COPY_CONFORMITY_DRIVER_HPP_JOFA_091006
+#define BOOST_VALIDATE_DRIVER_MAP_COPY_CONFORMITY_DRIVER_HPP_JOFA_091006
+
+#include <iostream>
+#include <stdio.h>
+#include <time.h>
+#include <boost/itl_xt/list.hpp>
+#include <boost/validate/validater/function_equality_validater.hpp>
+#include <boost/validate/driver/itl_driver.hpp>
+#include <boost/validate/utility.hpp>
+
+namespace boost{namespace itl
+{
+
+ class map_copy_conformity_driver : public itl_driver
+ {
+ public:
+ map_copy_conformity_driver() { setProfile(); }
+
+
+ void setProfile()
+ {
+ setValid(true);
+ _rootChoice.setSize(RootType::Types_size);
+ _rootChoice.setMaxWeights(100);
+ _rootChoice[RootType::itl_set] = 0;
+ _rootChoice[RootType::interval_set] = 0;
+ _rootChoice[RootType::separate_interval_set] = 0;
+ _rootChoice[RootType::split_interval_set] = 0;
+ _rootChoice[RootType::itl_map] = 0;
+ _rootChoice[RootType::interval_map] = 50;
+ _rootChoice[RootType::split_interval_map] = 50;
+ setRootTypeNames();
+ _rootChoice.init();
+
+ _domainChoice.setSize(DomainType::DomainTypes_size);
+ _domainChoice.setMaxWeights(100);
+ _domainChoice[DomainType::Int] = 100;
+ _domainChoice[DomainType::Double] = 0;
+ setDomainTypeNames();
+ _domainChoice.init();
+
+ _codomainChoice.setSize(CodomainType::CodomainTypes_size);
+ _codomainChoice.setMaxWeights(100);
+ _codomainChoice[CodomainType::Int] = 100;
+ _codomainChoice[CodomainType::Double] = 0;
+ _codomainChoice[CodomainType::set_int] = 0;
+ setCodomainTypeNames();
+ _codomainChoice.init();
+
+ _neutronizerChoice.setSize(NeutronHandlerType::NeutronHandlerTypes_size);
+ _neutronizerChoice.setMaxWeights(100);
+ _neutronizerChoice[NeutronHandlerType::partial_absorber] = 25;
+ _neutronizerChoice[NeutronHandlerType::partial_enricher] = 25;
+ _neutronizerChoice[NeutronHandlerType::total_absorber] = 25;
+ _neutronizerChoice[NeutronHandlerType::total_enricher] = 25;
+ setNeutronHandlerTypeNames();
+ _neutronizerChoice.init();
+
+ if(!_rootChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _rootChoice.inconsitencyMessage("map_copy_conformity_driver::setProfile()") << std::endl;
+ }
+
+ if(!_domainChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _domainChoice.inconsitencyMessage("map_copy_conformity_driver::setProfile()") << std::endl;
+ }
+
+ if(!_codomainChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _codomainChoice.inconsitencyMessage("map_copy_conformity_driver::setProfile()") << std::endl;
+ }
+
+ if(!_neutronizerChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _neutronizerChoice.inconsitencyMessage("map_copy_conformity_driver::setProfile()") << std::endl;
+ }
+
+ }
+
+
+ algebra_validater* chooseValidater()
+ {
+ int rootChoice = _rootChoice.some();
+ //int domainChoice = _domainChoice.some(); // not used
+ int codomainChoice = _codomainChoice.some();
+ int neutronizerChoice = _neutronizerChoice.some();
+
+ switch(rootChoice)
+ {
+ //-----------------------------------------------------------------
+ //case RootType::itl_map: {
+ // switch(neutronizerChoice) {
+ // case NeutronHandlerType::partial_absorber: return new function_equality_validater<itl::list<std::pair<double,int> >, itl::map<int, int,partial_absorber> >;
+ // case NeutronHandlerType::partial_enricher: return new function_equality_validater<itl::list<std::pair<double,int> >, itl::map<int, int,partial_enricher> >;
+ // case NeutronHandlerType::total_absorber: return new function_equality_validater<itl::list<std::pair<int, int> >, itl::map<double,int,total_absorber > >;
+ // case NeutronHandlerType::total_enricher: return new function_equality_validater<itl::list<std::pair<int, int> >, itl::map<double,int,total_enricher > >;
+ // default: return choiceError(ITL_LOCATION("\nRootType::itl_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
+ // }//switch neutronizerChoice
+ //}//case itl_map
+ //-----------------------------------------------------------------
+ case RootType::interval_map: {
+ switch(neutronizerChoice) {
+ case NeutronHandlerType::partial_absorber: return new function_equality_validater<itl::list<std::pair<itl::interval<double>,int> >, interval_map<double,int,partial_absorber> >;
+ case NeutronHandlerType::partial_enricher: return new function_equality_validater<itl::list<std::pair<itl::interval<double>,int> >, interval_map<double,int,partial_enricher> >;
+ case NeutronHandlerType::total_absorber: return new function_equality_validater<itl::list<std::pair<itl::interval<int>, int> >, interval_map<int, int,total_absorber > >;
+ case NeutronHandlerType::total_enricher: return new function_equality_validater<itl::list<std::pair<itl::interval<int>, int> >, interval_map<int, int,total_enricher > >;
+ default: return choiceError(ITL_LOCATION("\nRootType::interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
+ }//switch neutronizerChoice
+ }//case interval_map
+ //-----------------------------------------------------------------
+ case RootType::split_interval_map: {
+ switch(neutronizerChoice) {
+ case NeutronHandlerType::partial_absorber: return new function_equality_validater<itl::list<std::pair<itl::interval<double>,int> >, split_interval_map<double,int,partial_absorber> >;
+ case NeutronHandlerType::partial_enricher: return new function_equality_validater<itl::list<std::pair<itl::interval<int>, int> >, split_interval_map<int, int,partial_enricher> >;
+ case NeutronHandlerType::total_absorber: return new function_equality_validater<itl::list<std::pair<itl::interval<double>,int> >, split_interval_map<double,int,total_absorber > >;
+ case NeutronHandlerType::total_enricher: return new function_equality_validater<itl::list<std::pair<itl::interval<int>, int> >, split_interval_map<int, int,total_enricher > >;
+ default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
+ }//switch neutronizerChoice
+ }//case split_interval_map
+ //-----------------------------------------------------------------
+
+ default: return choiceError(ITL_LOCATION("rootChoice:\n"), rootChoice, _rootChoice);
+ } //switch()
+
+ return NULL; //just to please the compiler ;)
+ }
+
+ };
+
+
+}} // namespace itl boost
+
+#endif // BOOST_VALIDATE_DRIVER_MAP_COPY_CONFORMITY_DRIVER_HPP_JOFA_091006
Modified: sandbox/itl/boost/validate/gentor/randomgentor.hpp
==============================================================================
--- sandbox/itl/boost/validate/gentor/randomgentor.hpp (original)
+++ sandbox/itl/boost/validate/gentor/randomgentor.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -14,10 +14,14 @@
#include <boost/itl_xt/numbergentor.hpp>
#include <boost/itl_xt/setgentor.hpp>
#include <boost/itl_xt/mapgentor.hpp>
+#include <boost/itl_xt/seqgentor.hpp>
#include <boost/itl_xt/itvgentor.hpp>
+#include <boost/itl_xt/map_segment_gentor.hpp>
+#ifdef LAW_BASED_TEST_BOOST_POLYGON
#include <libs/validate/example/labat_polygon_/point_gentor.hpp>
#include <libs/validate/example/labat_polygon_/polygon_gentor.hpp>
+#endif //LAW_BASED_TEST_BOOST_POLYGON
#include <boost/itl/interval_set.hpp>
#include <boost/itl/separate_interval_set.hpp>
@@ -59,6 +63,14 @@
public polygon_set_gentor<itl::list<itl::list<PointT> > > {};
#endif //LAW_BASED_TEST_BOOST_POLYGON
+ // ----- lists -------------------------------------------------------------
+ template <class DomainT, class CodomainT>
+ class RandomGentor<std::pair<itl::interval<DomainT>, CodomainT> > :
+ public map_segment_gentor<DomainT,CodomainT> {};
+
+ template <class DomainT, class CodomainT>
+ class RandomGentor<itl::list<std::pair<itl::interval<DomainT>, CodomainT> > > :
+ public SeqGentorT<itl::list<std::pair<itl::interval<DomainT>, CodomainT> > > {};
// ----- sets --------------------------------------------------------------
//template <class DomainT, template<class>class Set>
@@ -98,7 +110,7 @@
public MapGentorT<itl::map<DomainT,CodomainT,Neutronizer> > {};
- // ----- interval_map<D,C,N> ----------------------------------------
+ // ----- interval_map<D,C,N> -----------------------------------------------
template <class DomainT, class Neutronizer>
class RandomGentor<interval_map<DomainT,itl::set<int>,Neutronizer> > :
public MapGentorT<interval_map<DomainT,itl::set<int>,Neutronizer> > {};
@@ -239,6 +251,59 @@
//--------------------------------------------------------------------------
#endif // LAW_BASED_TEST_BOOST_POLYGON
+
+ //--------------------------------------------------------------------------
+ // lists
+ //--------------------------------------------------------------------------
+ template <>
+ struct Calibrater<std::pair<itl::interval<int>, int>, RandomGentor>
+ {
+ static void apply(RandomGentor< std::pair<itl::interval<int>, int> >& gentor){}
+ };
+
+ template <>
+ struct Calibrater<std::pair<itl::interval<double>, int>, RandomGentor>
+ {
+ static void apply(RandomGentor< std::pair<itl::interval<double>, int> >& gentor){}
+ };
+
+ template <>
+ struct Calibrater<itl::list<std::pair<itl::interval<double>, int> >, RandomGentor>
+ {
+ static void apply(RandomGentor< itl::list<std::pair<itl::interval<double>, int> > >& gentor)
+ {
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
+ map_segment_gentor<double,int>* segment_gentor = new map_segment_gentor<double,int>;
+ NumberGentorT<int>* int_gentor = new NumberGentorT<int>;
+ int_gentor->setRange(GentorProfileSgl::it()->range_int());
+ segment_gentor->setCodomainGentor(int_gentor);
+ segment_gentor->set_range(GentorProfileSgl::it()->range_interval_double());
+ segment_gentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
+ segment_gentor->set_corange(GentorProfileSgl::it()->range_int()); // sets range of codomain_values
+ gentor.setDomainGentor(segment_gentor);
+ }
+ };
+
+ template <>
+ struct Calibrater<itl::list<std::pair<itl::interval<int>, int> >, RandomGentor>
+ {
+ static void apply(RandomGentor< itl::list<std::pair<itl::interval<int>, int> > >& gentor)
+ {
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
+ map_segment_gentor<int,int>* segment_gentor = new map_segment_gentor<int,int>;
+ NumberGentorT<int>* int_gentor = new NumberGentorT<int>;
+ int_gentor->setRange(GentorProfileSgl::it()->range_int());
+ segment_gentor->setCodomainGentor(int_gentor);
+ segment_gentor->set_range(GentorProfileSgl::it()->range_interval_int());
+ segment_gentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
+ segment_gentor->set_corange(GentorProfileSgl::it()->range_int()); // sets range of codomain_values
+ gentor.setDomainGentor(segment_gentor);
+ }
+ };
+
+ //--------------------------------------------------------------------------
+ // sets
+ //--------------------------------------------------------------------------
template <>
struct Calibrater<itl::set<int>, RandomGentor>
{
@@ -287,7 +352,7 @@
ItvGentorT<double>* itvGentor = new ItvGentorT<double>;
interval<double> valRange = GentorProfileSgl::it()->range_interval_double();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
- itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength()); //JODO
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
gentor.setDomainGentor(itvGentor);
}
};
Added: sandbox/itl/boost/validate/itl/functors.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/validate/itl/functors.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,129 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2007-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------+
+Auxiliary functors that are used to validate the equality of
+handcoded loops and calls of std::algorithms.
++-----------------------------------------------------------------------------*/
+
+#ifndef BOOST_VALIDATE_ITL_FUNCTORS_HPP_JOFA_091004
+#define BOOST_VALIDATE_ITL_FUNCTORS_HPP_JOFA_091004
+
+#include <boost/itl/iterator.hpp>
+
+namespace boost{namespace itl
+{
+
+template <typename SourceT, typename TargetT>
+struct base_insertion
+{
+ void operator()(TargetT& collected, const SourceT& items)
+ {
+ collected.clear();
+ ITL_const_FORALL(typename SourceT, item_, items)
+ collected.insert(*item_);
+ }
+};
+
+template<>
+inline std::string binary_template_to_string<base_insertion>::apply() { return "_i"; }
+
+template <typename SourceT, typename TargetT>
+struct hint_insertion
+{
+ void operator()(TargetT& collected, const SourceT& items)
+ {
+ collected.clear();
+ typename TargetT::iterator prior_ = collected.end();
+ ITL_const_FORALL(typename SourceT, item_, items)
+ prior_ = collected.insert(prior_, *item_);
+ }
+};
+
+template<>
+inline std::string binary_template_to_string<hint_insertion>::apply() { return "!i"; }
+
+template <typename SourceT, typename TargetT>
+struct copy_insertion
+{
+ void operator()(TargetT& collected, const SourceT& items)
+ {
+ collected.clear();
+ std::copy(items.begin(), items.end(), itl::inserter(collected, collected.end()));
+ }
+};
+
+template<>
+inline std::string binary_template_to_string<copy_insertion>::apply() { return "ci"; }
+
+/*JODO URG
+template <typename SourceT, typename TargetT>
+struct trans_insertion
+{
+ void operator()(TargetT& collected, const SourceT& items)
+ {
+ collected.clear();
+ std::transform(items.begin(), items.end(),
+ itl::inserter(collected, collected.end()), itl::to_pair);
+ }
+};
+
+template<>
+inline std::string binary_template_to_string<copy_insertion>::apply() { return "$ti"; }
+*/
+
+
+
+
+template <typename SourceT, typename TargetT>
+struct base_addition
+{
+ void operator()(TargetT& collected, const SourceT& items)
+ {
+ collected.clear();
+ ITL_const_FORALL(typename SourceT, item_, items)
+ collected.add(*item_);
+ }
+};
+
+template<>
+inline std::string binary_template_to_string<base_addition>::apply() { return "_+"; }
+
+template <typename SourceT, typename TargetT>
+struct hint_addition
+{
+ void operator()(TargetT& collected, const SourceT& items)
+ {
+ collected.clear();
+ typename TargetT::iterator prior_ = collected.end();
+ ITL_const_FORALL(typename SourceT, item_, items)
+ prior_ = collected.add(prior_, *item_);
+ }
+};
+
+template<>
+inline std::string binary_template_to_string<hint_addition>::apply() { return "!+"; }
+
+template <typename SourceT, typename TargetT>
+struct copy_addition
+{
+ void operator()(TargetT& collected, const SourceT& items)
+ {
+ collected.clear();
+ std::copy(items.begin(), items.end(), itl::adder(collected, collected.end()));
+ }
+};
+
+template<>
+inline std::string binary_template_to_string<copy_addition>::apply() { return "c+"; }
+
+}} // namespace itl boost
+
+#endif // BOOST_VALIDATE_FUNCTORS_HPP_JOFA_091004
\ No newline at end of file
Deleted: sandbox/itl/boost/validate/itl_relations_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/itl_relations_validater.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
+++ (empty file)
@@ -1,172 +0,0 @@
-/*-----------------------------------------------------------------------------+
-A Law Based Test Automaton 'LaBatea'
-Author: Joachim Faulhaber
-Copyright (c) 2007-2009: Joachim Faulhaber
-+------------------------------------------------------------------------------+
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENCE.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-+-----------------------------------------------------------------------------*/
-#pragma once
-
-#include <iostream>
-#include <stdio.h>
-#include <time.h>
-#include <boost/validate/validater/itl_induced_relations.hpp>
-#include <boost/validate/driver/itl_driver.hpp>
-#include <boost/validate/utility.hpp>
-
-namespace boost{namespace itl
-{
-
- class ItlRelationsValidater : public itl_driver
- {
- public:
- ItlRelationsValidater() { setProfile(); }
-
-
- void setProfile()
- {
- setValid(true);
- _rootChoice.setSize(RootType::Types_size);
- _rootChoice.setMaxWeights(100);
- _rootChoice[RootType::itl_set] = 0;
- _rootChoice[RootType::interval_set] = 10;
- _rootChoice[RootType::separate_interval_set] = 10;
- _rootChoice[RootType::split_interval_set] = 10;
- _rootChoice[RootType::itl_map] = 0;
- _rootChoice[RootType::interval_map] = 35;
- _rootChoice[RootType::split_interval_map] = 35;
- setRootTypeNames();
- _rootChoice.init();
-
- _domainChoice.setSize(DomainType::DomainTypes_size);
- _domainChoice.setMaxWeights(100);
- _domainChoice[DomainType::Int] = 100;
- _domainChoice[DomainType::Double] = 0; //NOTE: induced relations only
- setDomainTypeNames(); // work for integral DomainType, because
- _domainChoice.init(); // atomized_type needs to be finite.
-
- _codomainChoice.setSize(CodomainType::CodomainTypes_size);
- _codomainChoice.setMaxWeights(100);
- _codomainChoice[CodomainType::Int] = 100;
- _codomainChoice[CodomainType::Double] = 0;
- _codomainChoice[CodomainType::set_int] = 0;
- setCodomainTypeNames();
- _codomainChoice.init();
-
- _neutronizerChoice.setSize(NeutronHandlerType::NeutronHandlerTypes_size);
- _neutronizerChoice.setMaxWeights(100);
- _neutronizerChoice[NeutronHandlerType::partial_absorber] = 25;
- _neutronizerChoice[NeutronHandlerType::partial_enricher] = 25;
- _neutronizerChoice[NeutronHandlerType::total_absorber] = 25;
- _neutronizerChoice[NeutronHandlerType::total_enricher] = 25;
- setNeutronHandlerTypeNames();
- _neutronizerChoice.init();
-
- if(!_rootChoice.is_consistent())
- {
- setValid(false);
- std::cout << _rootChoice.inconsitencyMessage("ItlRelationsValidater::setProfile()") << std::endl;
- }
-
- if(!_domainChoice.is_consistent())
- {
- setValid(false);
- std::cout << _domainChoice.inconsitencyMessage("ItlRelationsValidater::setProfile()") << std::endl;
- }
-
- if(!_codomainChoice.is_consistent())
- {
- setValid(false);
- std::cout << _codomainChoice.inconsitencyMessage("ItlRelationsValidater::setProfile()") << std::endl;
- }
-
- if(!_neutronizerChoice.is_consistent())
- {
- setValid(false);
- std::cout << _neutronizerChoice.inconsitencyMessage("ItlRelationsValidater::setProfile()") << std::endl;
- }
-
- }
-
-
- algebra_validater* chooseValidater()
- {
- int rootChoice = _rootChoice.some();
- int domainChoice = _domainChoice.some();
- int codomainChoice = _codomainChoice.some();
- int neutronizerChoice = _neutronizerChoice.some();
-
- switch(rootChoice)
- {
- case RootType::interval_set: {
- switch(domainChoice) {
- case DomainType::Int: return new itl_induced_relations_validater<interval_set<int> >;
- default: return choiceError(ITL_LOCATION("\nRootType::interval_set: domainChoice:\n"),
- domainChoice, _domainChoice);
- }
- }
- case RootType::separate_interval_set: {
- switch(domainChoice) {
- case DomainType::Int: return new itl_induced_relations_validater<separate_interval_set<int> >;
- default: return choiceError(ITL_LOCATION("\nRootType::separate_interval_set: domainChoice:\n"),
- domainChoice, _domainChoice);
- }
- }
- case RootType::split_interval_set: {
- switch(domainChoice) {
- case DomainType::Int: return new itl_induced_relations_validater<split_interval_set<int> >;
- default: return choiceError(ITL_LOCATION("\nRootType::split_interval_set: domainChoice:\n"),
- domainChoice, _domainChoice);
- }
- }
- case RootType::split_interval_map: {
- switch(domainChoice) {
- case DomainType::Int:
- switch(neutronizerChoice) {
- case NeutronHandlerType::partial_absorber:
- return new itl_induced_relations_validater<split_interval_map<int,int,partial_absorber> >;
- case NeutronHandlerType::partial_enricher:
- return new itl_induced_relations_validater<split_interval_map<int,int,partial_enricher> >;
- case NeutronHandlerType::total_absorber:
- return new itl_induced_relations_validater<split_interval_map<int,int,total_absorber> >;
- case NeutronHandlerType::total_enricher:
- return new itl_induced_relations_validater<split_interval_map<int,int,total_enricher> >;
- default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: neutronizerChoice:\n"),
- neutronizerChoice, _neutronizerChoice);
- }
- default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: domainChoice:\n"),
- domainChoice, _domainChoice);
- }
- }
- case RootType::interval_map: {
- switch(domainChoice) {
- case DomainType::Int:
- switch(neutronizerChoice) {
- case NeutronHandlerType::partial_absorber:
- return new itl_induced_relations_validater<interval_map<int,int,partial_absorber> >;
- case NeutronHandlerType::partial_enricher:
- return new itl_induced_relations_validater<interval_map<int,int,partial_enricher> >;
- case NeutronHandlerType::total_absorber:
- return new itl_induced_relations_validater<interval_map<int,int,total_absorber> >;
- case NeutronHandlerType::total_enricher:
- return new itl_induced_relations_validater<interval_map<int,int,total_enricher> >;
- default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: neutronizerChoice:\n"),
- neutronizerChoice, _neutronizerChoice);
- }
- default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: domainChoice:\n"),
- domainChoice, _domainChoice);
- }
- }
- default: return choiceError(ITL_LOCATION("rootChoice:\n"), rootChoice, _rootChoice);
- } //switch()
-
- return NULL; //just to please the compiler ;)
- }
-
- };
-
-
-}} // namespace itl boost
-
Added: sandbox/itl/boost/validate/laws/function_equality.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/validate/laws/function_equality.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,106 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2009-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_FUNCTION_EQUALITY_HPP_JOFA_091005
+#define BOOST_ITL_FUNCTION_EQUALITY_HPP_JOFA_091005
+
+#include <boost/itl/type_traits/value_size.hpp>
+#include <boost/itl/functors.hpp>
+#include <boost/itl/predicates.hpp>
+#include <boost/validate/laws/law.hpp>
+
+namespace boost{namespace itl
+{
+
+// -----------------------------------------------------------------------------
+// S
+// / \
+// f| = |g
+// \ /
+// v v
+// T
+// -----------------------------------------------------------------------------
+template <typename SourceT, typename TargetT,// domain, codomain types of f,g
+ template<class,class>class Function_f,
+ template<class,class>class Function_g,
+ template<class>class Equality = itl::std_equal>
+class FunctionEquality :
+ public Law<FunctionEquality<SourceT,TargetT,Function_f,Function_g,Equality>,
+ LOKI_TYPELIST_1(SourceT), LOKI_TYPELIST_2(TargetT,TargetT)>
+{
+ /** S: SourceT, T: TargetT
+ For all S a: f(a) == g(a) : Equality of functions f and g.
+ Input = (a := inVal1)
+ Output = (lhs_result, rhs_result)
+ */
+public:
+ std::string name()const { return "FunctionEquality"; }
+ std::string formula()const { return "S a: f(a) == g(a)"; }
+
+ std::string typeString()const
+ {
+ return
+ "Eq<"+type_to_string<SourceT>::apply()+","
+ +type_to_string<TargetT>::apply()+","
+ +binary_template_to_string<Function_f>::apply()+","
+ +binary_template_to_string<Function_g>::apply()+","
+ +unary_template_to_string<Equality>::apply() +">";
+ }
+
+public:
+
+ bool holds()
+ {
+ // For all S a: f(a) == g(a) : f == g.
+ // --- left hand side --------------------------------------------------
+ SourceT value_a = this->template getInputValue<operand_a>();
+ TargetT lhs;
+ Function_f<SourceT,TargetT>()(lhs, value_a); // lhs = f(a);
+
+ // --- right hand side -------------------------------------------------
+ TargetT rhs;
+ Function_g<SourceT,TargetT>()(rhs, value_a); // rhs = g(a);
+
+ this->template setOutputValue<lhs_result>(lhs);
+ this->template setOutputValue<rhs_result>(rhs);
+
+ return Equality<TargetT>()(lhs, rhs);
+ }
+
+ bool debug_holds()
+ {
+ // For all S a: f(a) == g(a) : f == g.
+ // --- left hand side --------------------------------------------------
+ SourceT value_a = this->template getInputValue<operand_a>();
+ std::cout << "a= " << value_a << std::endl;
+ TargetT lhs;
+ Function_f<SourceT,TargetT>()(lhs, value_a); // lhs = f(a);
+ std::cout << "l= " << lhs << std::endl;
+
+ // --- right hand side -------------------------------------------------
+ TargetT rhs;
+ Function_g<SourceT,TargetT>()(rhs, value_a); // rhs = g(a);
+ std::cout << "r= " << rhs << std::endl;
+
+ this->template setOutputValue<lhs_result>(lhs);
+ this->template setOutputValue<rhs_result>(rhs);
+
+ return Equality<TargetT>()(lhs, rhs);
+ }
+
+ size_t size()const
+ {
+ return value_size<SourceT>::apply(this->template getInputValue<operand_a>());
+ }
+};
+
+}} // namespace itl boost
+
+#endif // BOOST_ITL_MINOR_SET_LAWS_HPP_JOFA_070411
+
Modified: sandbox/itl/boost/validate/utility.hpp
==============================================================================
--- sandbox/itl/boost/validate/utility.hpp (original)
+++ sandbox/itl/boost/validate/utility.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -7,7 +7,8 @@
(See accompanying file LICENCE.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------------------------------------*/
-#pragma once
+#ifndef BOOST_VALIDATE_UTILITY_HPP_JOFA_090203
+#define BOOST_VALIDATE_UTILITY_HPP_JOFA_090203
#include <iostream>
#include <stdio.h>
@@ -33,3 +34,4 @@
}} // namespace itl boost
+#endif // BOOST_VALIDATE_UTILITY_HPP_JOFA_090203
\ No newline at end of file
Added: sandbox/itl/boost/validate/validater/function_equality_validater.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/validate/validater/function_equality_validater.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,92 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2007-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#pragma once
+
+#include <boost/validate/itl/functors.hpp>
+#include <boost/validate/laws/function_equality.hpp>
+#include <boost/validate/validater/law_validater.hpp>
+#include <boost/validate/validater/algebra_validater.hpp>
+
+namespace boost{namespace itl
+{
+ typedef WeightedNumberGentor<int> ChoiceT;
+
+
+ template <typename SourceT, typename TargetT>
+ class function_equality_validater : public algebra_validater
+ {
+ public:
+ enum Laws
+ {
+ insertion_loop_hint,
+ insertion_loop_copy,
+ addition_loop_hint,
+ addition_loop_copy,
+ Laws_size
+ };
+
+ function_equality_validater() {setProfile();}
+
+ void setProfile()
+ {
+ const int volume = 100;
+ _lawChoice.setSize(Laws_size);
+ _lawChoice.setMaxWeights(volume);
+ _lawChoice[insertion_loop_hint] = 25;
+ _lawChoice[insertion_loop_copy] = 25;
+ _lawChoice[addition_loop_hint] = 25;
+ _lawChoice[addition_loop_copy] = 25;
+ _lawChoice.init();
+ }
+
+
+ LawValidaterI* chooseValidater()
+ {
+ switch(_lawChoice.some())
+ {
+ case insertion_loop_hint: return new LawValidater<FunctionEquality<SourceT, TargetT, base_insertion, hint_insertion>, RandomGentor>();
+ case insertion_loop_copy: return new LawValidater<FunctionEquality<SourceT, TargetT, base_insertion, copy_insertion>, RandomGentor>();
+ case addition_loop_hint: return new LawValidater<FunctionEquality<SourceT, TargetT, base_addition, hint_addition>, RandomGentor>();
+ case addition_loop_copy: return new LawValidater<FunctionEquality<SourceT, TargetT, base_addition, copy_addition>, RandomGentor>();
+ default: return NULL;
+ }
+ }
+
+ void validate()
+ {
+ _validater = chooseValidater();
+ if(_validater)
+ {
+ _validater->run();
+ _validater->addFrequencies(_frequencies);
+ _validater->addViolations(_violationsCount, _violations);
+ delete _validater;
+ }
+ }
+
+ void addFrequencies(ValidationCounterT& summary) { summary += _frequencies; }
+ void addViolations(ViolationCounterT& summary, ViolationMapT& collector)
+ {
+ summary += _violationsCount;
+ collector += _violations;
+ }
+
+ private:
+ ChoiceT _lawChoice;
+ LawValidaterI* _validater;
+ ValidationCounterT _frequencies;
+ ViolationCounterT _violationsCount;
+ ViolationMapT _violations;
+ }; //class function_equality_validater
+
+
+
+}} // namespace itl boost
+
Modified: sandbox/itl/boost/validate/validater/interval_morphic_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/interval_morphic_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/interval_morphic_validater.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -79,15 +79,15 @@
case atomize_plus: return new LawValidater<BinaryPushout<Type, typename Type::atomized_type, Interval::Atomize, inplace_plus>, RandomGentor>();
case atomize_minus: return new LawValidater<BinaryPushout<Type, typename Type::atomized_type, Interval::Atomize, inplace_minus>, RandomGentor>();
case atomize_et: return new LawValidater<BinaryPushout<Type, typename Type::atomized_type, Interval::Atomize, inplace_et>, RandomGentor>();
- case atomize_caret: return new LawValidater<BinaryPushout<Type, typename Type::atomized_type, Interval::Atomize, inplace_caret>, RandomGentor>();
+ case atomize_caret: return new LawValidater<BinaryPushout<Type, typename Type::atomized_type, Interval::Atomize, inplace_caret>, RandomGentor>();
case cluster_plus: return new LawValidater<BinaryPushout<typename Type::atomized_type, Type, Interval::Cluster, inplace_plus>, RandomGentor>();
case cluster_minus: return new LawValidater<BinaryPushout<typename Type::atomized_type, Type, Interval::Cluster, inplace_minus>, RandomGentor>();
case cluster_et: return new LawValidater<BinaryPushout<typename Type::atomized_type, Type, Interval::Cluster, inplace_et>, RandomGentor>();
- case cluster_caret: return new LawValidater<BinaryPushout<typename Type::atomized_type, Type, Interval::Cluster, inplace_caret>, RandomGentor>();
- case atomize_insert: return new LawValidater<BinaryPushout<Type, typename Type::atomized_type, Interval::Atomize, inserter>, RandomGentor>();
- case atomize_erase: return new LawValidater<BinaryPushout<Type, typename Type::atomized_type, Interval::Atomize, eraser>, RandomGentor>();
- case cluster_insert: return new LawValidater<BinaryPushout<typename Type::atomized_type, Type, Interval::Cluster, inserter>, RandomGentor>();
- case cluster_erase: return new LawValidater<BinaryPushout<typename Type::atomized_type, Type, Interval::Cluster, eraser>, RandomGentor>();
+ case cluster_caret: return new LawValidater<BinaryPushout<typename Type::atomized_type, Type, Interval::Cluster, inplace_caret>, RandomGentor>();
+ case atomize_insert: return new LawValidater<BinaryPushout<Type, typename Type::atomized_type, Interval::Atomize, inplace_insert>,RandomGentor>();
+ case atomize_erase: return new LawValidater<BinaryPushout<Type, typename Type::atomized_type, Interval::Atomize, inplace_erase>, RandomGentor>();
+ case cluster_insert: return new LawValidater<BinaryPushout<typename Type::atomized_type, Type, Interval::Cluster, inplace_insert>,RandomGentor>();
+ case cluster_erase: return new LawValidater<BinaryPushout<typename Type::atomized_type, Type, Interval::Cluster, inplace_erase>, RandomGentor>();
case join_plus: return new LawValidater<BinaryPushout<Type, typename Type::joint_type, Interval::Join, inplace_plus>, RandomGentor>();
//JODO absorb_plus holds for interval_map. For split_interval_map element_equal has to be used as equality-relation.
//case absorb_plus: return new LawValidater<BinaryPushout<Type, typename Type::partial_absorber_type, Interval::AbsorbNeutrons, inplace_plus>, RandomGentor>();
Modified: sandbox/itl/boost/validate/validater/signed_quantifier_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/signed_quantifier_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/signed_quantifier_validater.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -61,7 +61,8 @@
if(!is_total<Type>::value && absorbs_neutrons<Type>::value)
et_assoc_share = 0;
//NOTE: An Inverse exists only for a total signed quantifier
- if(!is_total<Type>::value)
+ //CL if(!is_total<Type>::value)
+ if(!is_total<Type>::value || !has_inverse<typename Type::codomain_type>::value)
inv_ex_share = 0;
int rest_shares = sum_of_shares, item_index = 0;
Modified: sandbox/itl/libs/itl/build/win32/vc9_all.sln
==============================================================================
--- sandbox/itl/libs/itl/build/win32/vc9_all.sln (original)
+++ sandbox/itl/libs/itl/build/win32/vc9_all.sln 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -133,6 +133,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_test_combinable", "..\..\test\test_combinable_\vc9_test_combinable.vcproj", "{EE61B7EF-EC45-4165-8B49-FD5B8D3A9FA1}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_labat_map_copy_conformity", "..\..\..\validate\example\labat_map_copy_conformity_\vc9_labat_map_copy_conformity.vcproj", "{BF42574F-66E2-42DD-90D9-3A8FCE6F472F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -403,6 +405,10 @@
{EE61B7EF-EC45-4165-8B49-FD5B8D3A9FA1}.Debug|Win32.Build.0 = Debug|Win32
{EE61B7EF-EC45-4165-8B49-FD5B8D3A9FA1}.Release|Win32.ActiveCfg = Release|Win32
{EE61B7EF-EC45-4165-8B49-FD5B8D3A9FA1}.Release|Win32.Build.0 = Release|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F472F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F472F}.Debug|Win32.Build.0 = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F472F}.Release|Win32.ActiveCfg = Release|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F472F}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: sandbox/itl/libs/itl/doc/concepts.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/concepts.qbk (original)
+++ sandbox/itl/libs/itl/doc/concepts.qbk 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -215,8 +215,8 @@
it does:
[table
-[[] [`add<Combine<CodomainT> >((k,x))`] [`subtract<inverse<Combine<CodomainT> >::type>((k,x))`]]
-[[Instance] [`add<inplace_plus<int> >((k,x))`] [`subtract<inplace_minus<int> >((k,x))`]]
+[[] [`_add<Combine<CodomainT> >((k,x))`] [`_subtract<inverse<Combine<CodomainT> >::type>((k,x))`]]
+[[Instance] [`_add<inplace_plus<int> >((k,x))`] [`_subtract<inplace_minus<int> >((k,x))`]]
[[Inversion][adds `x` on overlap. This inverts a preceding `subtract` of `x` on `k`][subtracts `x` on overlap. This inverts a preceding `add` of `x` on `k`]]
]
@@ -227,11 +227,11 @@
[table
[[aggregating function][equivalent /classical/ function]]
-[[`add<inplace_identity<CodomainT> >(const value_type&)`] [`insert(const value_type&)`]]
-[[`subtract<inplace_erasure<CodomainT> >(const value_type&)`][`erase(const value_type&)`]]
+[[`_add<inplace_identity<CodomainT> >(const value_type&)`] [`insert(const value_type&)`]]
+[[`_subtract<inplace_erasure<CodomainT> >(const value_type&)`][`erase(const value_type&)`]]
]
-The aggregating member function templates `add` and `subtract`
+The aggregating member function templates `_add` and `_subtract`
are not in the public interface of __itv_bmaps__, because
the `Combine` functor is intended to be an invariant
of __itv_bmap_s__
Modified: sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp (original)
+++ sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
#include <boost/mpl/list.hpp>
+#include <boost/itl/iterator.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
@@ -49,8 +50,9 @@
sim1.insert(make_pair(interval<int>::rightopen(1,3),1));
sim1.insert(make_pair(interval<int>::rightopen(2,4),1));
- IntervalMapT jim1, jim2;
- std::copy(ivec.begin(), ivec.end(), std::inserter(jim2, jim2.end()));
- cout << jim2 << endl;
+ IntervalMapT jim1;
+ std::copy(ivec.begin(), ivec.end(), itl::adder(jim1, jim1.end()));
+ //std::copy(ivec.begin(), ivec.end(), std::inserter(jim2, jim2.end()));
+ cout << jim1 << endl;
}
Added: sandbox/itl/libs/validate/example/labat_map_copy_conformity_/labat_map_copy_conformity.cpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_map_copy_conformity_/labat_map_copy_conformity.cpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,37 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2007-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#include <iostream>
+#include <stdio.h>
+#include <boost/validate/driver/map_copy_conformity_driver.hpp>
+
+using namespace std;
+using namespace boost;
+using namespace boost::itl;
+
+void test_Validater()
+{
+ map_copy_conformity_driver validater;
+ cout <<
+ ">> ------------------------------------------------------ <<\n"
+ ">> -------- Law based test automaton 'LaBatea' ---------- <<\n"
+ ">> Output will be generated in a few seconds\n"
+ ">> terminate by typing <CTRL>C\n"
+ ">> ------------------------------------------------------ <<\n";
+ GentorProfileSgl::it()->set_std_profile(8,1);//JODO
+ GentorProfileSgl::it()->report_profile();
+ validater.validate();
+};
+
+
+int main()
+{
+ test_Validater();
+ return 0;
+}
Added: sandbox/itl/libs/validate/example/labat_map_copy_conformity_/vc9_labat_map_copy_conformity.vcproj
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_map_copy_conformity_/vc9_labat_map_copy_conformity.vcproj 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="vc9_labat_map_copy_conformity"
+ ProjectGUID="{BF42574F-66E2-42DD-90D9-3A8FCE6F472F}"
+ RootNamespace="vc9_labat_map_copy_conformity"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../../../bin/debug"
+ IntermediateDirectory="../../../../bin/obj/$(ProjectName)/debug"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/bigobj"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="../../../../lib; ../../../../stage/lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../../../bin/release"
+ IntermediateDirectory="../../../../bin/obj/$(ProjectName)/release"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="1"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../lib; ../../../../stage/lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Quelldateien"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\src\gentor\gentorprofile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\labat_map_copy_conformity_\labat_map_copy_conformity.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Headerdateien"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\..\boost\validate\law.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\lawvalidater.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\lawviolations.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\laws\monoid.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\laws\order.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\laws\pushouts.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\realmvalidater.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\laws\set_laws.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\typevalidater.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Ressourcendateien"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp (original)
+++ sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -43,6 +43,13 @@
return left.x == right.x && left.y == right.y;
}
+template<class CharType, class CharTraits, class DomainT>
+std::basic_ostream<CharType, CharTraits>& operator <<
+ (std::basic_ostream<CharType, CharTraits>& stream, const point<DomainT>& object)
+{
+ return stream << object.as_string();
+}
+
template <class Type>
struct type_to_string<itl::point<Type> >
{
Modified: sandbox/itl/libs/validate/example/labat_polygon_/polygon_gentor.hpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_polygon_/polygon_gentor.hpp (original)
+++ sandbox/itl/libs/validate/example/labat_polygon_/polygon_gentor.hpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -19,16 +19,22 @@
class polygon_gentor: public RandomGentorAT<PolygonT>
{
public:
- typedef typename PolygonT::value_type ValueTypeTD;
- typedef typename PolygonT::value_type DomainTD;
- typedef list<ValueTypeTD> SampleTypeTD;
+ typedef typename PolygonT::value_type ValueTypeTD;
+ typedef typename PolygonT::value_type DomainTD;
+ typedef list<ValueTypeTD> SampleTypeTD;
+
+ polygon_gentor(): p_domainGentor(NULL) {}
+ ~polygon_gentor() { delete p_domainGentor; }
virtual void some(PolygonT& x);
void last(PolygonT& x)const;
void last_permuted(PolygonT& x)const;
void setDomainGentor(RandomGentorAT<DomainTD>* gentor)
- { m_domainGentor = gentor; }
+ {
+ delete p_domainGentor;
+ p_domainGentor = gentor;
+ }
void setRangeOfSampleSize(int lwb, int upb)
{ m_sampleSizeRange = interval<int>::rightopen(lwb,upb); }
@@ -38,7 +44,7 @@
void setUnique(bool truth) { m_unique = truth; }
private:
- RandomGentorAT<DomainTD>* m_domainGentor;
+ RandomGentorAT<DomainTD>* p_domainGentor;
interval<int> m_sampleSizeRange;
SampleTypeTD m_sample;
int m_sampleSize;
@@ -59,12 +65,12 @@
if(m_sampleSize == 0)
return;
- m_domainGentor->some(first);
+ p_domainGentor->some(first);
x.push_back(first);
for(int i=1; i<m_sampleSize; i++)
{
- m_domainGentor->some(key);
+ p_domainGentor->some(key);
if(m_unique)
{
@@ -113,16 +119,22 @@
class polygon_set_gentor: public RandomGentorAT<PolygonSetT>
{
public:
- typedef typename PolygonSetT::value_type ValueTypeTD;
- typedef typename PolygonSetT::value_type DomainTD;
- typedef list<ValueTypeTD> SampleTypeTD;
+ typedef typename PolygonSetT::value_type ValueTypeTD;
+ typedef typename PolygonSetT::value_type DomainTD;
+ typedef list<ValueTypeTD> SampleTypeTD;
+
+ polygon_set_gentor(): p_domainGentor(NULL) {}
+ ~polygon_set_gentor() { delete p_domainGentor; }
virtual void some(PolygonSetT& x);
void last(PolygonSetT& x)const;
void last_permuted(PolygonSetT& x)const;
void setDomainGentor(RandomGentorAT<DomainTD>* gentor)
- { m_domainGentor = gentor; }
+ {
+ delete p_domainGentor;
+ p_domainGentor = gentor;
+ }
void setRangeOfSampleSize(int lwb, int upb)
{ m_sampleSizeRange = interval<int>::rightopen(lwb,upb); }
@@ -132,7 +144,7 @@
void setUnique(bool truth) { m_unique = truth; }
private:
- RandomGentorAT<DomainTD>* m_domainGentor;
+ RandomGentorAT<DomainTD>* p_domainGentor;
interval<int> m_sampleSizeRange;
SampleTypeTD m_sample;
int m_sampleSize;
@@ -153,13 +165,13 @@
if(m_sampleSize == 0)
return;
- m_domainGentor->some(first);
+ p_domainGentor->some(first);
x.push_back(first);
for(int i=1; i<m_sampleSize; i++)
{
DomainTD key;
- m_domainGentor->some(key);
+ p_domainGentor->some(key);
if(m_unique)
{
Modified: sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp (original)
+++ sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -15,11 +15,14 @@
#include <boost/itl/set.hpp>
#include <boost/itl/map.hpp>
#include <boost/itl/interval_morphism.hpp>
+#include <boost/validate/itl/functors.hpp>
#include <boost/validate/laws/induced_relation.hpp>
#include <boost/validate/laws/symmetric_difference.hpp>
#include <boost/validate/laws/pushouts.hpp>
#include <boost/validate/laws/set_laws.hpp>
#include <boost/validate/laws/minor_set_laws.hpp>
+#include <boost/validate/laws/function_equality.hpp>
+
//#include <boost/validate/laws/novial_tree.hpp>
#include <boost/validate/laws/inversion_laws.hpp>
#include <boost/validate/validater/law_validater.hpp>
@@ -52,6 +55,14 @@
// <itl::interval_map<int, int, partial_enricher > > TestLawT;
//LawValidater<TestLawT, RandomGentor> test_law;
+ //typedef InplaceSymmetricDifference
+ // <itl::interval_map<int, int, partial_enricher > > TestLawT;
+ //LawValidater<TestLawT, RandomGentor> test_law;
+
+ //typedef InplaceNaturalInversion
+ // <itl::interval_map<int, int, partial_enricher>, inplace_plus, protonic_equal> TestLawT;
+ //LawValidater<TestLawT, RandomGentor> test_law;
+
//typedef InplaceAssociativity
// <itl::split_interval_map<int, int, partial_enricher> > TestLawT;
//LawValidater<TestLawT, RandomGentor> test_law;
@@ -81,14 +92,24 @@
// <interval_map<int, itl::set<int> >, interval_map<int, itl::set<int> > > TestLawT;
//LawValidater<TestLawT, RandomGentor> test_law;
- typedef AddendInclusion
- <interval_set<int>, itl::interval<int> > TestLawT;
- LawValidater<TestLawT, RandomGentor> test_law;
+ //typedef AddendInclusion
+ // <interval_set<int>, itl::interval<int> > TestLawT;
+ //LawValidater<TestLawT, RandomGentor> test_law;
+
+ typedef FunctionEquality
+ <
+ itl::list<std::pair<itl::interval<int>,int> >,
+ interval_map<int,int,total_absorber>,
+ base_addition,
+ hint_addition
+ > TestLawT;
+ LawValidater<TestLawT, RandomGentor> test_law;
//-----------------------------------------------------------------------------
- int test_count = 20000;
+ int test_count = 50000;
ptime start, stop;
+ GentorProfileSgl::it()->set_std_profile(4,1);
test_law.set_trials_count(test_count);
std::cout << "Start\n";
Modified: sandbox/itl/libs/validate/example/labat_val_relations_/labat_val_relations.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_val_relations_/labat_val_relations.cpp (original)
+++ sandbox/itl/libs/validate/example/labat_val_relations_/labat_val_relations.cpp 2009-10-08 10:31:57 EDT (Thu, 08 Oct 2009)
@@ -9,7 +9,7 @@
+-----------------------------------------------------------------------------*/
#include <iostream>
#include <stdio.h>
-#include <boost/validate/itl_relations_validater.hpp>
+#include <boost/validate/driver/itl_relations_driver.hpp>
using namespace std;
using namespace boost;
@@ -17,7 +17,7 @@
void test_Validater()
{
- ItlRelationsValidater validater;
+ itl_relations_driver validater;
cout <<
">> ------------------------------------------------------ <<\n"
">> -------- Law based test automaton 'LaBatea' ---------- <<\n"
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