|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65404 - in sandbox/itl: boost/itl boost/itl/detail boost/itl/functions libs/itl/example/itvset_shell_ libs/itl/example/splititvmap_shell_ libs/itl/test libs/validate/example/labat_single_
From: afojgo_at_[hidden]
Date: 2010-09-12 17:39:35
Author: jofaber
Date: 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
New Revision: 65404
URL: http://svn.boost.org/trac/boost/changeset/65404
Log:
Refactoring: Extraction of predicate controlled member functions '*_if' from interval_base_map. Stable{msvc-9.0, gcc-3.4.4}
Text files modified:
sandbox/itl/boost/itl/detail/interval_map_algo.hpp | 50 ++++++
sandbox/itl/boost/itl/detail/interval_morphism.hpp | 4
sandbox/itl/boost/itl/detail/interval_set_algo.hpp | 4
sandbox/itl/boost/itl/functions.hpp | 130 +++++++++++++---
sandbox/itl/boost/itl/functions/container.hpp | 15 +
sandbox/itl/boost/itl/interval_base_map.hpp | 302 ++-------------------------------------
sandbox/itl/boost/itl/interval_base_set.hpp | 51 ------
sandbox/itl/boost/itl/interval_map.hpp | 100 -------------
sandbox/itl/boost/itl/interval_set.hpp | 43 -----
sandbox/itl/boost/itl/separate_interval_set.hpp | 38 -----
sandbox/itl/boost/itl/split_interval_map.hpp | 97 ------------
sandbox/itl/boost/itl/split_interval_set.hpp | 45 -----
sandbox/itl/libs/itl/example/itvset_shell_/itvset_shell.cpp | 2
sandbox/itl/libs/itl/example/splititvmap_shell_/splititvmap_shell.cpp | 2
sandbox/itl/libs/itl/test/test_interval_map_mixed.hpp | 34 ++--
sandbox/itl/libs/itl/test/test_interval_map_shared.hpp | 16 +-
sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp | 3
17 files changed, 223 insertions(+), 713 deletions(-)
Modified: sandbox/itl/boost/itl/detail/interval_map_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_map_algo.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_map_algo.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -588,7 +588,7 @@
absorbs_neutrons<Type>::value,
Type::fineness>::type on_segment_;
- iterator prior_ = object.prior(it_);
+ iterator prior_ = cyclic_prior(object, it_);
interval_type cur_itv = it_->first ;
interval_type lead_gap = right_subtract(inter_val, cur_itv);
@@ -743,7 +743,7 @@
if(!itl::is_empty(left_resid)) // [--- inter_val ---)
{ //[prior_) [left_resid)[--- it_ . . .
- iterator prior_ = object.prior(it_);
+ iterator prior_ = cyclic_prior(object, it_);
const_cast<interval_type&>(it_->first) = left_subtract(it_->first, left_resid);
object._insert(prior_, value_type(left_resid, it_->second));
// The segemnt *it_ is split at inter_val.first(), so as an invariant
@@ -1016,7 +1016,7 @@
return;
iterator first_ = exterior.first, end_ = exterior.second,
- last_ = object.prior(end_);
+ last_ = cyclic_prior(object, end_);
iterator second_= first_; ++second_;
if(first_ == last_)
@@ -1056,6 +1056,50 @@
}
}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+template<class Type, bool has_set_semantics>
+struct on_codomain_model;
+
+template<class Type>
+struct on_codomain_model<Type, true>
+{
+ typedef typename Type::interval_type interval_type;
+ typedef typename Type::codomain_type codomain_type;
+ typedef typename Type::value_type value_type;
+ typedef typename Type::codomain_combine codomain_combine;
+ typedef typename Type::inverse_codomain_intersect inverse_codomain_intersect;
+
+ static void add(Type& intersection, interval_type& common_interval,
+ const codomain_type& flip_value, const codomain_type& co_value)
+ {
+ codomain_type common_value = flip_value;
+ inverse_codomain_intersect()(common_value, co_value);
+ Interval_Map::add<Type,codomain_combine>
+ (intersection, value_type(common_interval, common_value));
+ }
+};
+
+template<class Type>
+struct on_codomain_model<Type, false>
+{
+ typedef typename Type::interval_type interval_type;
+ typedef typename Type::codomain_type codomain_type;
+ typedef typename Type::value_type value_type;
+ typedef typename Type::codomain_combine codomain_combine;
+
+ static void add(Type& intersection, interval_type& common_interval,
+ const codomain_type&, const codomain_type&)
+ {
+ Interval_Map::add<Type,codomain_combine>
+ (intersection, value_type(common_interval,
+ neutron<codomain_type>::value()));
+ }
+};
+
+
+
} // namespace Interval_Map
}} // namespace itl boost
Modified: sandbox/itl/boost/itl/detail/interval_morphism.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_morphism.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_morphism.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -65,7 +65,7 @@
{
void operator()(JointType& joint, SplitType& split)
{
- split.join();
+ itl::join(split);
ITL_FORALL(typename SplitType, split_, split)
joint.insert(*split_);
}
@@ -76,7 +76,7 @@
{
void operator()(AbsorberType& absorber, EnricherType& enricher)
{
- enricher.absorb_neutrons();
+ itl::absorb_neutrons(enricher);
ITL_FORALL(typename EnricherType, enricher_, enricher)
absorber.insert(*enricher_);
}
Modified: sandbox/itl/boost/itl/detail/interval_set_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_set_algo.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_set_algo.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -553,7 +553,7 @@
if(!itl::is_empty(left_resid))
{ // [------------ . . .
// [left_resid---first_ --- . . .
- iterator prior_ = object.prior(first_);
+ iterator prior_ = cyclic_prior(object, first_);
const_cast<interval_type&>(Type::key_value(first_))
= left_subtract(Type::key_value(first_), left_resid);
//NOTE: Only splitting
@@ -608,7 +608,7 @@
typedef typename Type::interval_type interval_type;
typedef typename Type::iterator iterator;
- iterator prior_ = object.prior(it_);
+ iterator prior_ = cyclic_prior(object, it_);
interval_type cur_itv = *it_;
interval_type lead_gap = right_subtract(inter_val, cur_itv);
Modified: sandbox/itl/boost/itl/functions.hpp
==============================================================================
--- sandbox/itl/boost/itl/functions.hpp (original)
+++ sandbox/itl/boost/itl/functions.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -83,7 +83,7 @@
if(exterior.first == exterior.second)
return false;
- const_iterator last_overlap = super.prior(exterior.second);
+ const_iterator last_overlap = cyclic_prior(super, exterior.second);
return
itl::contains(hull(*(exterior.first), *last_overlap), inter_val)
@@ -281,7 +281,7 @@
operator += (Type& object, const OperandT& operand)
{
//JODO return itl::add(object, operand);
- return itl::add(object, operand);
+ return itl::add(object, operand);
}
@@ -493,7 +493,7 @@
{
const_cast<interval_type&>(first_->first) = left_resid;
if(!itl::is_empty(right_resid))
- itl::insert(object, first_, value_type(right_resid, first_->second));
+ itl::insert(object, first_, value_type(right_resid, first_->second));
}
else if(!itl::is_empty(right_resid))
const_cast<interval_type&>(first_->first) = left_subtract(first_->first, minuend);
@@ -680,7 +680,7 @@
operator -=(Type& object, const OperandT& operand)
{
ITL_const_FORALL(typename OperandT, elem_, operand)
- itl::subtract(object, *elem_);
+ itl::subtract(object, *elem_);
return object;
}
@@ -689,14 +689,14 @@
typename enable_if<is_intra_derivative<Type, OperandT>, Type>::type&
operator -= (Type& object, const OperandT& operand)
{
- return itl::subtract(object, operand);
+ return itl::subtract(object, operand);
}
template<class Type, class OperandT>
typename enable_if<is_cross_derivative<Type, OperandT>, Type>::type&
operator -= (Type& object, const OperandT& operand)
{
- return itl::erase(object, operand);
+ return itl::erase(object, operand);
}
template<class Type, class IntervalSetT>
@@ -1101,7 +1101,7 @@
bool>::type
intersects(const Type& left, const AssociateT& right)
{
- return itl::intersects(left, right);
+ return itl::intersects(left, right);
}
/** \b Returns true, if \c left and \c right have no common elements.
@@ -1168,7 +1168,7 @@
//[a b) : left_over
left_over = right_subtract(span, covered);
itl::subtract(object, span & covered); //That which is common shall be subtracted
- itl::add(object, left_over); //That which is not shall be added
+ itl::add(object, left_over); //That which is not shall be added
//... d) : span
//... c) : covered
@@ -1239,7 +1239,7 @@
it_->second = neutron<codomain_type>::value();
if(mpl::not_<is_interval_splitter<Type> >::value) //JODO
- object.join();
+ itl::join(object);
return object;
}
@@ -1258,7 +1258,7 @@
typedef typename Type::inverse_codomain_intersect inverse_codomain_intersect;
// That which is common shall be subtracted
// That which is not shall be added
- // So x has to be 'complementary added' or flipped
+ // So interval_value_pair has to be 'complementary added' or flipped
interval_type span = interval_value_pair.first;
std::pair<const_iterator, const_iterator> exterior
@@ -1290,14 +1290,8 @@
// ... shall be subtracted
itl::add(eraser, common_interval);
- if(has_set_semantics<codomain_type>::value) //JODO
- {
- codomain_type common_value = x_value;
- inverse_codomain_intersect()(common_value, co_value);
- itl::add(intersection, value_type(common_interval, common_value));
- }
- else
- itl::add(intersection, value_type(common_interval, neutron<codomain_type>::value()));
+ Interval_Map::on_codomain_model<Type, has_set_semantics<codomain_type>::value>
+ ::add(intersection, common_interval, x_value, co_value);
}
itl::add(object, value_type(left_over, x_value)); //That which is not shall be added
@@ -1324,7 +1318,7 @@
, mpl::not_<is_total<Type> > >, Type>::type&
flip(Type& object, const typename Type::element_type& key_value_pair)
{
- return itl::flip(object, make_segment<Type>(key_value_pair));
+ return itl::flip(object, make_segment<Type>(key_value_pair));
}
@@ -1370,7 +1364,7 @@
Type>::type&
operator ^= (Type& object, const OperandT& operand)
{
- return itl::flip(object, operand);
+ return itl::flip(object, operand);
}
template<class Type, class OperandT>
@@ -1378,7 +1372,7 @@
Type>::type&
operator ^= (Type& object, const OperandT& operand)
{
- return itl::flip(object, operand);
+ return itl::flip(object, operand);
}
template<class Type, class OperandT>
@@ -1395,7 +1389,6 @@
return object ^= operand;
}
-
template<class Type>
Type operator ^ (typename Type::overloadable_type object, const Type& operand)
{
@@ -1403,11 +1396,79 @@
}
//==============================================================================
+//= Domain
+//==============================================================================
+template<class Type, class SetT>
+typename enable_if<is_concept_combinable<is_interval_set, is_interval_map, SetT, Type>, SetT>::type&
+domain(SetT& result, const Type& object)
+{
+ result.clear();
+ ITL_const_FORALL(typename Type, it_, object)
+ result += it_->first;
+
+ return result;
+}
+
+
+//==============================================================================
+//= Manipulation by predicates
+//==============================================================================
+template<class MapT, class Predicate> //JODO unify with element_map . . .
+typename enable_if<is_interval_map<MapT>, MapT>::type&
+erase_if(const Predicate& pred, MapT& object)
+{
+ typename MapT::iterator it_ = object.begin();
+ while(it_ != object.end())
+ if(pred(*it_))
+ object.erase(it_++);
+ else ++it_;
+ return object;
+}
+
+template<class MapT, class Predicate>
+inline typename enable_if<is_interval_map<MapT>, MapT>::type&
+add_if(const Predicate& pred, MapT& object, const MapT& src)
+{
+ typename MapT::const_iterator it_ = src.begin();
+ while(it_ != src.end())
+ if(pred(*it_))
+ itl::add(object, *it_++);
+
+ return object;
+}
+
+template<class MapT, class Predicate>
+inline typename enable_if<is_interval_map<MapT>, MapT>::type&
+assign_if(const Predicate& pred, MapT& object, const MapT& src)
+{
+ itl::clear(object);
+ return add_if(object, src, pred);
+}
+
+//==============================================================================
//= Morphisms
//==============================================================================
+namespace segmental
+{
+ template<class Type>
+ typename enable_if<is_interval_set<Type>, bool>::type
+ is_joinable(typename Type::iterator it_, typename Type::iterator next_, Type* = 0)
+ {
+ return touches(*it_, *next_);
+ }
+
+ template<class Type>
+ typename enable_if<is_interval_map<Type>, bool>::type
+ is_joinable(typename Type::iterator it_, typename Type::iterator next_, Type* = 0)
+ {
+ return touches(it_->first, next_->first)
+ && it_->second == next_->second ;
+ }
+}
+
template<class Type>
-typename enable_if<is_interval_set<Type>, Type>::type&
+typename enable_if<is_interval_container<Type>, Type>::type&
join(Type& object)
{
typedef typename Type::interval_type interval_type;
@@ -1421,19 +1482,20 @@
while(next_ != object.end())
{
- if( touches(*it_, *next_) )
+ if( segmental::is_joinable<Type>(it_, next_) )
{
iterator fst_mem = it_; // hold the first member
// Go on while touching members are found
it_++; next_++;
while( next_ != object.end()
- && touches(*it_, *next_) )
+ && segmental::is_joinable<Type>(it_, next_) )
{ it_++; next_++; }
// finally we arrive at the end of a sequence of joinable intervals
// and it points to the last member of that sequence
- const_cast<interval_type&>(*it_) = hull(*it_, *fst_mem);
+ const_cast<interval_type&>(Type::key_value(it_))
+ = hull(Type::key_value(it_), Type::key_value(fst_mem));
object.erase(fst_mem, it_);
it_++; next_=it_;
@@ -1446,6 +1508,22 @@
}
+template<class Type>
+typename enable_if<mpl::and_< is_interval_map<Type>
+ , absorbs_neutrons<Type> >, Type>::type&
+absorb_neutrons(Type& object)
+{
+ return object;
+}
+
+template<class Type>
+typename enable_if<mpl::and_< is_interval_map<Type>
+ , mpl::not_<absorbs_neutrons<Type> > >, Type>::type&
+absorb_neutrons(Type& object)
+{
+ typedef typename Type::segment_type segment_type;
+ return itl::erase_if(content_is_neutron<segment_type>(), object);
+}
}} // namespace itl boost
Modified: sandbox/itl/boost/itl/functions/container.hpp
==============================================================================
--- sandbox/itl/boost/itl/functions/container.hpp (original)
+++ sandbox/itl/boost/itl/functions/container.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -59,6 +59,21 @@
left.swap(right); //JODO test
}
+//==============================================================================
+//= Iteration
+//==============================================================================
+
+template<class Type>
+typename enable_if<is_container<Type>, typename Type::iterator>::type
+cyclic_prior(Type& object, typename Type::iterator it_)
+{ return it_ == object.begin() ? object.end() : --it_; }
+
+template<class Type>
+typename enable_if<is_container<Type>, typename Type::const_iterator>::type
+cyclic_prior(const Type& object, typename Type::const_iterator it_)
+{ return it_ == object.begin() ? object.end() : --it_; }
+
+
}} // namespace itl boost
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 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -234,10 +234,6 @@
/** swap the content of containers */
void swap(interval_base_map& object) { _map.swap(object._map); }
- /** Copy all elements if predicate <tt>pred</tt> holds */
- template<class Predicate>
- SubType& assign_if(const interval_base_map& src, const Predicate& pred);
-
//==========================================================================
//= Containedness
//==========================================================================
@@ -330,19 +326,7 @@
//==========================================================================
//= Addition
//==========================================================================
-private:
- /** Addition of an interval value pair to the map.
- On overlap an aggregation is performed using functor \c Combiner.
- This function is not public, because the `codomain_combine` shall be
- an invariant for all itl maps.*/
- template<class Combiner>
- SubType& _add(const segment_type& interval_value_pair)
- {
- that()->template add_<Combiner>(interval_value_pair);
- return *that();
- }
-public:
/** Addition of a key value pair to the map */
SubType& add(const element_type& key_value_pair)
{
@@ -366,19 +350,7 @@
//==========================================================================
//= Subtraction
//==========================================================================
-private:
- /** Subtraction of an interval value pair from the map.
- On overlap an aggregation is performed using functor Combiner.
- This function is not public, because the `codomain_combine` shall be
- an invariant for all itl maps.*/
- template<class Combiner>
- SubType& _subtract(const segment_type& interval_value_pair)
- {
- that()->template subtract_<Combiner>(interval_value_pair);
- return *that();
- }
-public:
/** Subtraction of a key value pair from the map */
SubType& subtract(const element_type& key_value_pair)
{
@@ -448,10 +420,6 @@
/** Erase all value pairs for a range of iterators <tt>[first,past)</tt>. */
void erase(iterator first, iterator past){ _map.erase(first, past); }
- /** Remove all elements where property <tt>p</tt> holds, keep all others */
- template<class Predicate>
- SubType& erase_if(const Predicate& pred);
-
//==========================================================================
//= Intersection
//==========================================================================
@@ -459,28 +427,28 @@
Complexity: logarithmic. */
bool intersects(const domain_type& key)const
{
- return itl::intersects(*that(), key);
+ return itl::intersects(*that(), key);
}
/** Returns \c true, if \c inter_val intersects with \c *this map.
Complexity: Logarithmic in iterative size. */
bool intersects(const interval_type& inter_val)const
{
- return itl::intersects(*that(), inter_val);
+ return itl::intersects(*that(), inter_val);
}
/** Returns \c true, if \c key_value_pair is found in \c *this map.
Complexity: logarithmic. */
bool intersects(const element_type& key_value_pair)const
{
- return itl::intersects(*that(), key_value_pair);
+ return itl::intersects(*that(), key_value_pair);
}
/** Returns \c true, if \c interval_value_pair intersects with \c *this map:
Complexity: Linear in iterative_size. */
bool intersects(const segment_type& interval_value_pair)const
{
- return itl::intersects(*that(), interval_value_pair);
+ return itl::intersects(*that(), interval_value_pair);
}
//==========================================================================
@@ -490,24 +458,14 @@
/** If \c *this map contains \c key_value_pair it is erased, otherwise it is added. */
SubType& flip(const element_type& key_value_pair)
{
- return itl::flip(*that(), key_value_pair);
- }
+ return itl::flip(*that(), key_value_pair);
+ }
/** If \c *this map contains \c interval_value_pair it is erased, otherwise it is added. */
SubType& flip(const segment_type& interval_value_pair)
- {
- return itl::flip(*that(), interval_value_pair);
- }
-
- /** The intersection of \c *this and \c operand is erased from \c *this.
- The complemenary value pairs are added to \c *this. */
- template<class SubType2>
- SubType& flip(const interval_base_map<SubType2,DomainT,CodomainT,Traits,
- Compare,Combine,Section,Interval,Alloc>& operand)
- {
- return itl::flip(*that(), operand);
- }
-
+ {
+ return itl::flip(*that(), interval_value_pair);
+ }
//==========================================================================
//= Iterator related
@@ -560,60 +518,24 @@
element_const_reverse_iterator elements_rbegin()const{ return element_const_reverse_iterator(this->rbegin()); }
element_const_reverse_iterator elements_rend() const{ return element_const_reverse_iterator(this->rend()); }
-
- //==========================================================================
- //= Morphisms
- //==========================================================================
-
- /** Join bounding intervals */
- interval_base_map& join();
-
- /** All value pairs \c (I,y) that have neutral elements \c y==codomain_type()
- as associated values are removed form the map. */
- void absorb_neutrons()
- {
- //content_is_neutron<key_type, data_type> neutron_dropper;
- if(!Traits::absorbs_neutrons)
- erase_if(content_is_neutron<value_type>());
- }
-
- /** Set all intervals in the map to be of type <tt>bounded</tt>.
- Requires Integral<domain_type>.
-
- Interval bounds of different types are created by opeations on
- interval maps. This function allows to reset them uniformly without,
- of course, changing their value. This is only possible for discrete
- domain datatypes.
- */
- void uniform_bounds(itl::bound_type bounded);
-
-
//==========================================================================
//= Domain, sum
//==========================================================================
/** Gives the domain of the map as interval set */
- template
- <
- template
- <class DomT, ITL_COMPARE Comp, ITL_INTERVAL2(ITL_COMPARE) Interv, ITL_ALLOC Allc>
- class IntervalSet
- >
- void domain(IntervalSet<DomainT,Compare,Interval,Alloc>& dom)const
- {
- dom.clear();
- const_FOR_IMPLMAP(it_)
- dom += it_->first;
- }
-
- /* Sum of associated elements of the map */
- void sum(codomain_type& total)const;
-
- /* Sum of associated elements of the map */
- codomain_type sum()const
- { codomain_type total; sum(total); return total; }
-
-
+ // template
+ // <
+ // template
+ // <class DomT, ITL_COMPARE Comp, ITL_INTERVAL2(ITL_COMPARE) Interv, ITL_ALLOC Allc>
+ // class IntervalSet
+ // >
+ // void domain(IntervalSet<DomainT,Compare,Interval,Alloc>& dom)const
+ // {
+ //itl::domain(dom, *that());
+ // //CL dom.clear();
+ // //const_FOR_IMPLMAP(it_)
+ // // dom += it_->first;
+ // }
//==========================================================================
//= Algorithm unifiers
@@ -636,191 +558,11 @@
sub_type* that() { return static_cast<sub_type*>(this); }
const sub_type* that()const { return static_cast<const sub_type*>(this); }
-public:
- sub_type& self() { return *that(); }
-
-protected:
-
- template <class Combiner>
- bool combine(iterator& it_, const codomain_type& co_val)
- {
- Combiner()(it_->second, co_val);
- if(Traits::absorbs_neutrons && it_->second == Combiner::neutron())
- { this->_map.erase(it_); it_ = _map.end(); return false; }
- return true;
- }
-
- template <class Combiner>
- std::pair<iterator,bool> _map_insert(const interval_type& inter_val, const codomain_type& co_val)
- {
- if(mpl::and_<is_total<type>, has_inverse<codomain_type>, 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));
- }
-
- // Insertion with hint, that does report insertion failure
- template <class Combiner>
- 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.insert(prior_, value_type(inter_val, Combiner::neutron()));
-
- if(inserted_->first == inter_val && inserted_->second == Combiner::neutron())
- {
- Combiner()(inserted_->second, co_val);
- return std::pair<iterator,bool>(inserted_, true);
- }
- else
- 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)
- {
- // inter_val is not conained in this map. Insertion will be successful
- BOOST_ASSERT(this->_map.find(inter_val) == this->_map.end());
- BOOST_ASSERT(!(Traits::absorbs_neutrons && co_val==Combiner::neutron()));
-
- return this->_map.insert(prior_, value_type(inter_val, version<Combiner>()(co_val)));
- }
-
protected:
ImplMapT _map;
} ;
-template
-<
- class SubType,
- class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc
->
-interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::join()
-{
- iterator it_ = _map.begin();
- if(it_==_map.end())
- return *this;
-
- iterator next_ = it_; next_++;
-
- while(next_ != _map.end())
- {
- if( touches(it_->first, next_->first)
- && it_->second == next_->second )
- {
- iterator fst_mem = it_; // hold the first member
-
- // Go on while touching members are found
- it_++; next_++;
- while( next_ != _map.end()
- && touches(it_->first, next_->first)
- && it_->second == next_->second )
- { it_++; next_++; }
-
- // finally we arrive at the end of a sequence of joinable intervals
- // and it points to the last member of that sequence
- const_cast<interval_type&>(it_->first) = hull(it_->first, fst_mem->first);
- _map.erase(fst_mem, it_);
-
- it_++; next_=it_;
- if(next_!=_map.end())
- next_++;
- }
- else { it_++; next_++; }
- }
- return *this;
-}
-
-
-template
-<
- class SubType,
- class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc
->
-void interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::sum(codomain_type& total)const
-{
- total = codomain_combine::neutron();
- const_FOR_IMPLMAP(it_)
- total += it_->second;
-}
-
-
-template
-<
- class SubType,
- class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc
->
-void interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::uniform_bounds(itl::bound_type bounded)
-{
- // I can do this only, because I am sure that the contents and the
- // ordering < on interval is invariant wrt. this transformation on bounds
- FOR_IMPLMAP(it_) const_cast<interval_type&>(it_->first).as(bounded);
-}
-
-
-template
-<
- class SubType,
- class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc
->
- template<class Predicate>
-SubType&
-interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::erase_if(const Predicate& pred)
-{
- iterator it = _map.begin();
- while(it != _map.end())
- if(pred(*it))
- _map.erase(it++);
- else ++it;
- return *that();
-}
-
-
-template
-<
- class SubType,
- class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc
->
- template<class Predicate>
-SubType&
-interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::assign_if(const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& src,
- const Predicate& pred)
-{
- clear();
- const_iterator it = src.begin();
- while(it != src.end()) {
- if(Predicate()(*it))
- add(*it++);
- }
- return *that();
-}
-
-
-
//==============================================================================
//= Equivalences and Orderings
//==============================================================================
Modified: sandbox/itl/boost/itl/interval_base_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_set.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -109,7 +109,7 @@
//------------------------------------------------------------------------------
template<class Type>
-typename enable_if<is_interval_set<Type>, Type>::type&
+typename enable_if<is_interval_container<Type>, Type>::type&
join(Type&);
//JODO Forward 4 gcc-3.4.4 -----------------------------------------------------
@@ -530,7 +530,6 @@
std::pair<const_iterator,const_iterator> equal_range(const key_type& interval)const
{ return _set.equal_range(interval); }
-
//==========================================================================
//= Element iterator related
//==========================================================================
@@ -543,25 +542,6 @@
element_reverse_iterator elements_rend() { return element_reverse_iterator(this->rend()); }
element_const_reverse_iterator elements_rbegin()const{ return element_const_reverse_iterator(this->rbegin()); }
element_const_reverse_iterator elements_rend() const{ return element_const_reverse_iterator(this->rend()); }
-
- //==========================================================================
- //= Morphisms
- //==========================================================================
-
- /** Join bordering intervals */
- SubType& join()
- {
- return itl::join(*that());
- }
-
- /** Set interval bounds to the type <tt>bt</tt> for intervals in the set.
- Interval bounds of different types are created by opeations on
- interval sets. This function allows to reset them uniformly without,
- of course, changing their value. This is only possible for discrete
- domain datatypes.
- */
- void uniform_bounds(itl::bound_type bounded);
-
//==========================================================================
//= Algorithm unifiers
@@ -585,39 +565,10 @@
sub_type* that() { return static_cast<sub_type*>(this); }
const sub_type* that()const { return static_cast<const sub_type*>(this); }
-public:
- sub_type& self() { return *that(); }
-
-public:
- iterator prior(iterator it_)
- { return it_ == this->_set.begin() ? this->_set.end() : --it_; }
-
- const_iterator prior(const_iterator it_)const
- { return it_ == this->_set.begin() ? this->_set.end() : --it_; }
-
-protected:
-
- iterator gap_insert(iterator prior_, const interval_type& inter_val)
- {
- // inter_val is not conained in this map. Insertion will be successful
- BOOST_ASSERT(this->_set.find(inter_val) == this->_set.end());
- return this->_set.insert(prior_, inter_val);
- }
-
protected:
ImplSetT _set;
} ;
-/*JODO uniform_bounds for new interval types
-template<class SubType,
- class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-void interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::uniform_bounds(itl::bound_type bounded)
-{
- // I can do this only, because I am sure that the contents and the
- // ordering < on interval is invariant wrt. this transformation on bounds
- FOR_IMPL(it_) const_cast<interval_type&>(*it_).as(bounded);
-}
-*/
//==============================================================================
//= Equivalences and Orderings
Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -16,11 +16,6 @@
namespace boost{namespace itl
{
-#ifdef BOOST_MSVC
-#pragma warning(push)
-#pragma warning(disable:4127) // conditional expression is constant
-#endif
-
template<class DomainT, class CodomainT, class Traits,
ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section,
ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
@@ -113,97 +108,8 @@
ITL_const_FORALL(typename base_map_type, it_, src)
prior_ = this->add(prior_, *it_);
}
-
-private:
- // The following _suffixed function templates funx_ are implementations
- // correspoding unsuffixed function templates funx of the base class.
- // For funx_ want to be used in the base class via derived SubType pointer:
- // that()->funx_. So they must be either public or made accessible by a
- // friend declaration:
- friend class
- interval_base_map <interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>,
- DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>;
-
- bool contains_(const value_type& x)const;
-
- template<class Combiner>
- void add_(const value_type&);
-
- template<class Combiner>
- iterator add_(iterator prior_, const value_type&);
-
- template<class Combiner>
- void subtract_(const value_type&);
-
- void insert_(const value_type& value);
- iterator insert_(iterator prior_, const value_type& value);
- void erase_(const value_type& value);
-} ;
-
-
-//-----------------------------------------------------------------------------
-// add<Combinator>(pair(interval,value)):
-//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
- template<class Combiner>
-inline void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::add_(const value_type& addend)
-{
- Interval_Map::add<type,Combiner>(*this, addend);
-}
-
-
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
- template<class Combiner>
-inline typename interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::iterator
- interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::add_(iterator prior_, const value_type& addend)
-{
- return Interval_Map::add<type,Combiner>(*this, prior_, addend);
-}
-
-
-//-----------------------------------------------------------------------------
-// subtract<Combinator>(pair(interval,value)):
-//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
- template<class Combiner>
-void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::subtract_(const value_type& minuend)
-{
- Interval_Map::subtract<type,Combiner>(*this, minuend);
-}
-
-
-//-----------------------------------------------------------------------------
-// insert(pair(interval,value)):
-//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits,
- ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::insert_(const value_type& addend)
-{
- Interval_Map::insert(*this, addend);
-}
-
-template <typename DomainT, typename CodomainT, class Traits,
- ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline typename interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::iterator
- interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::insert_(iterator prior_, const value_type& addend)
-{
- return Interval_Map::insert(*this, prior_, addend);
-}
-//-----------------------------------------------------------------------------
-// erase(pair(interval,value)):
-//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::erase_(const value_type& minuend)
-{
- Interval_Map::erase(*this, minuend);
-}
+} ;
//-----------------------------------------------------------------------------
@@ -260,10 +166,6 @@
}
};
-#ifdef BOOST_MSVC
-#pragma warning(pop)
-#endif
-
}} // namespace itl boost
#endif
Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -138,52 +138,9 @@
ITL_const_FORALL(typename base_set_type, it_, src)
prior_ = this->add(prior_, *it_);
}
-
- //std::pair<iterator,bool> _insert(const value_type& value){ return this->_set.insert(value); }
- //iterator _insert(iterator prior, const value_type& value){ return this->_set.insert(prior, value); }
-
-private:
- friend class
- interval_base_set<interval_set<DomainT,Compare,Interval,Alloc>,
- DomainT,Compare,Interval,Alloc>;
-
- /// Does the set contain the interval <tt>sub</tt>?
- bool contains_(const interval_type& sub)const;
-
- /// Insertion of an interval <tt>addend</tt>
- void add_(const value_type& addend);
-
- iterator add_(iterator prior_, const value_type& addend);
-
- /// Removal of an interval <tt>minuend</tt>
- void subtract_(const value_type& minuend);
-
} ;
-template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-void interval_set<DomainT,Compare,Interval,Alloc>::add_(const value_type& addend)
-{
- Interval_Set::add(*this, addend);
-}
-
-
-template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-typename interval_set<DomainT,Compare,Interval,Alloc>::iterator
- interval_set<DomainT,Compare,Interval,Alloc>::add_(iterator prior_, const value_type& addend)
-{
- return Interval_Set::add(*this, prior_, addend);
-}
-
-
-
-template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-void interval_set<DomainT,Compare,Interval,Alloc>::subtract_(const value_type& minuend)
-{
- Interval_Set::subtract(*this, minuend);
-}
-
-
//-----------------------------------------------------------------------------
// type traits
//-----------------------------------------------------------------------------
Modified: sandbox/itl/boost/itl/separate_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/separate_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/separate_interval_set.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -123,47 +123,9 @@
this->clear();
this->_set.insert(src.begin(), src.end());
}
-
-private:
- friend class
- interval_base_set<separate_interval_set<DomainT,Compare,Interval,Alloc>,
- DomainT,Compare,Interval,Alloc>;
-
- /// Does the set contain the interval <tt>sub</tt>?
- bool contains_(const interval_type& sub)const;
-
- /// Insertion of an interval <tt>addend</tt>
- void add_(const value_type& addend);
- iterator add_(iterator prior_, const value_type& addend);
-
- /// Removal of an interval <tt>minuend</tt>
- void subtract_(const value_type& minuend);
-
-private:
- /// Treatment of adjoint intervals on insertion
- void handle_neighbours(const iterator&){}
} ;
-template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline void separate_interval_set<DomainT,Compare,Interval,Alloc>::add_(const value_type& addend)
-{
- Interval_Set::add(*this, addend);
-}
-
-template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-typename separate_interval_set<DomainT,Compare,Interval,Alloc>::iterator
- separate_interval_set<DomainT,Compare,Interval,Alloc>::add_(iterator prior_, const value_type& addend)
-{
- return Interval_Set::add(*this, prior_, addend);
-}
-
-
-template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline void separate_interval_set<DomainT,Compare,Interval,Alloc>::subtract_(const value_type& minuend)
-{
- Interval_Set::subtract(*this, minuend);
-}
//-----------------------------------------------------------------------------
// type traits
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 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -17,11 +17,6 @@
namespace boost{namespace itl
{
-#ifdef BOOST_MSVC
-#pragma warning(push)
-#pragma warning(disable:4127) // conditional expression is constant
-#endif
-
/** \brief implements a map as a map of intervals - on insertion
overlapping intervals are split and associated values are combined. */
template
@@ -109,97 +104,9 @@
// singular intervals by inapt usage of op[]. So op[] will not be implemented
// codomain_type& operator[](const interval_type& interval_of_keys)
-private:
- // The following _suffixed function templates funx_ are implementations
- // correspoding unsuffixed function templates funx of the base class.
- // For funx_ want to be used in the base class via derived SubType pointer:
- // that()->funx_. So they must be either public or made accessible by a
- // friend declaration:
- friend class
- interval_base_map
- <split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>,
- DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc >;
-
- bool contains_(const value_type& value)const;
-
- template<class Combiner>
- void add_(const value_type&);
-
- template<class Combiner>
- iterator add_(iterator, const value_type&);
-
- template<class Combiner>
- void subtract_(const value_type&);
-
- void insert_(const value_type& value);
- iterator insert_(iterator, const value_type& value);
- void erase_(const value_type& value);
} ;
//-----------------------------------------------------------------------------
-// add<Combinator>(pair(interval,value)):
-//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
- template<class Combiner>
-inline void split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::add_(const value_type& addend)
-{
- Interval_Map::add<type,Combiner>(*this, addend);
-}
-
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
- template<class Combiner>
-inline typename split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::iterator
- split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::add_(iterator prior_, const value_type& addend)
-{
- return Interval_Map::add<type,Combiner>(*this, addend);
-}
-
-
-//-----------------------------------------------------------------------------
-// subtract<Combinator>(pair(interval,value)):
-//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
- template<class Combiner>
-inline void split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::subtract_(const value_type& minuend)
-{
- Interval_Map::subtract<type,Combiner>(*this, minuend);
-}
-
-//-----------------------------------------------------------------------------
-// insert(pair(interval,value)):
-//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits,
- ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-void split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::insert_(const value_type& addend)
-{
- Interval_Map::insert(*this, addend);
-}
-
-template <typename DomainT, typename CodomainT, class Traits,
- ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline typename split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::iterator
- split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::insert_(iterator prior_, const value_type& addend)
-{
- return Interval_Map::insert(*this, prior_, addend);
-}
-
-//-----------------------------------------------------------------------------
-// erase(pair(interval,value)):
-//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline void split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::erase_(const value_type& minuend)
-{
- Interval_Map::erase(*this, minuend);
-}
-
-
-//-----------------------------------------------------------------------------
// type traits
//-----------------------------------------------------------------------------
template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
@@ -256,10 +163,6 @@
}
};
-#ifdef BOOST_MSVC
-#pragma warning(pop)
-#endif
-
}} // namespace itl boost
#endif
Modified: sandbox/itl/boost/itl/split_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_set.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -118,54 +118,9 @@
this->_set.insert(src.begin(), src.end());
}
-private:
- friend class
- interval_base_set<split_interval_set<DomainT,Compare,Interval,Alloc>,
- DomainT,Compare,Interval,Alloc>;
-
- /// Does the set contain the interval <tt>sub</tt>?
- bool contains_(const interval_type& sub)const;
-
- /// Addition of an interval <tt>addend</tt>
- void add_(const value_type& addend);
- iterator add_(iterator prior_, const value_type& addend);
-
- /// Subtraction of an interval <tt>minuend</tt>
- void subtract_(const value_type& minuend);
-
-private:
- /// Treatment of adjoint intervals on insertion
- void handle_neighbours(const iterator& it_){}
-
- void add_front(const interval_type& inter_val, iterator& first_);
- void add_main(interval_type& inter_val, iterator& it_, const iterator& last_);
- void add_segment(const interval_type& inter_val, iterator& it_);
- void add_rear(const interval_type& inter_val, iterator& it_);
-
- void subtract_rest(const interval_type& x_itv, iterator& it_, iterator& end_ );
} ;
-template <typename DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline void split_interval_set<DomainT,Compare,Interval,Alloc>::add_(const value_type& addend)
-{
- Interval_Set::add(*this, addend);
-}
-
-
-template <typename DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline typename split_interval_set<DomainT,Compare,Interval,Alloc>::iterator
- split_interval_set<DomainT,Compare,Interval,Alloc>::add_(iterator prior_, const value_type& addend)
-{
- return Interval_Set::add(*this, prior_, addend);
-}
-
-template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline void split_interval_set<DomainT,Compare,Interval,Alloc>::subtract_(const value_type& minuend)
-{
- Interval_Set::subtract(*this, minuend);
-}
-
//-----------------------------------------------------------------------------
// type traits
//-----------------------------------------------------------------------------
Modified: sandbox/itl/libs/itl/example/itvset_shell_/itvset_shell.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/itvset_shell_/itvset_shell.cpp (original)
+++ sandbox/itl/libs/itl/example/itvset_shell_/itvset_shell.cpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -91,7 +91,7 @@
break;
case 'j':
{
- m1.join();
+ itl::join(m1);
cout << "{" << m1 << "}" << endl;
}
break;
Modified: sandbox/itl/libs/itl/example/splititvmap_shell_/splititvmap_shell.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/splititvmap_shell_/splititvmap_shell.cpp (original)
+++ sandbox/itl/libs/itl/example/splititvmap_shell_/splititvmap_shell.cpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -93,7 +93,7 @@
break;
case 'j':
{
- m1.join();
+ itl::join(m1);
cout << "{" << m1 << "}" << endl;
}
break;
Modified: sandbox/itl/libs/itl/test/test_interval_map_mixed.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_mixed.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_mixed.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -228,9 +228,9 @@
split_map.add(IDv(0,2,2)).add(IIv(2,3,1)).add(CDv(3,6,1)).add(CIv(7,9,2));
join_map = split_map;
- split_map.domain(split_set);
- split_map.domain(sep_set);
- split_map.domain(join_set);
+ itl::domain(split_set, split_map);
+ itl::domain(sep_set, split_map);
+ itl::domain(join_set, split_map);
BOOST_CHECK_EQUAL( split_map.iterative_size(), 4 );
BOOST_CHECK_EQUAL( join_map.iterative_size(), 3 );
@@ -275,9 +275,9 @@
separate_interval_set<T> sep_sub_set1;
interval_set<T> join_sub_set1;
- split_sub_map1.domain(split_sub_set1);
- split_sub_map1.domain(sep_sub_set1);
- split_sub_map1.domain(join_sub_set1);
+ itl::domain(split_sub_set1, split_sub_map1);
+ itl::domain(sep_sub_set1, split_sub_map1);
+ itl::domain(join_sub_set1, split_sub_map1);
BOOST_CHECK_EQUAL( inclusion_compare(split_sub_map1, split_map), inclusion::subset );
BOOST_CHECK_EQUAL( inclusion_compare( join_sub_map2, split_map), inclusion::subset );
@@ -348,9 +348,9 @@
split_map.add(IDv(0,2,2)).add(IIv(2,3,1)).add(CDv(3,6,1)).add(CIv(7,9,2));
join_map = split_map;
- split_map.domain(split_set);
- split_map.domain(sep_set);
- split_map.domain(join_set);
+ itl::domain(split_set, split_map);
+ itl::domain(sep_set, split_map);
+ itl::domain(join_set, split_map);
BOOST_CHECK_EQUAL( split_map.iterative_size(), 4 );
BOOST_CHECK_EQUAL( join_map.iterative_size(), 3 );
@@ -409,9 +409,9 @@
separate_interval_set<T> sep_sub_set1;
interval_set<T> join_sub_set1;
- split_sub_map1.domain(split_sub_set1);
- split_sub_map1.domain(sep_sub_set1);
- split_sub_map1.domain(join_sub_set1);
+ itl::domain(split_sub_set1, split_sub_map1);
+ itl::domain(sep_sub_set1, split_sub_map1);
+ itl::domain(join_sub_set1, split_sub_map1);
BOOST_CHECK_EQUAL( call::within(split_sub_map1, split_map), true );
BOOST_CHECK_EQUAL( call::within(join_sub_map2, split_map), true );
@@ -968,10 +968,10 @@
join_A.insert(I0_4D_1).insert(I2_6D_1).insert(I5_7D_1);
join_B.insert(I7_8D_1).insert(I8_9I_1);
- split_A.domain(split_dA);
- split_B.domain(split_dB);
- join_A.domain(join_dA);
- join_B.domain(join_dB);
+ itl::domain(split_dA, split_A);
+ itl::domain(split_dB, split_B);
+ itl::domain(join_dA, join_A);
+ itl::domain(join_dB, join_B);
//-------------------------------------------------------------------------
insert(split_X, split_A);
@@ -1490,7 +1490,7 @@
split_A.add(I0_3D_1).add(I4_4I_1).add(I6_6I_1);
split_B.add(I4_4I_1).add(I6_6I_1);
- split_A.erase_if(size_greater_1<typename SplitIntervalMapT::value_type>());
+ itl::erase_if(size_greater_1<typename SplitIntervalMapT::value_type>(), split_A);
BOOST_CHECK_EQUAL( split_A, split_B );
}
Modified: sandbox/itl/libs/itl/test/test_interval_map_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_shared.hpp 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -456,7 +456,7 @@
itv_map += itv_map2;
BOOST_CHECK_EQUAL( call::contains(itv_map, itv_map2), true );
IntervalSetT itv_set2;
- itv_map2.domain(itv_set2);
+ itl::domain(itv_set2, itv_map2);
BOOST_CHECK_EQUAL( call::contains(itv_map, itv_set2), true );
}
@@ -825,8 +825,8 @@
BOOST_CHECK_EQUAL( intersects(map_A, map_B), false );
BOOST_CHECK_EQUAL( intersects(map_B, map_A), false );
- map_A.domain(set_A);
- map_B.domain(set_B);
+ itl::domain(set_A, map_A);
+ itl::domain(set_B, map_B);
BOOST_CHECK_EQUAL( disjoint(map_A, set_B), true );
BOOST_CHECK_EQUAL( disjoint(set_B, map_A), true );
BOOST_CHECK_EQUAL( disjoint(set_A, map_B), true );
@@ -843,8 +843,8 @@
BOOST_CHECK_EQUAL( intersects(map_A, map_B), true );
BOOST_CHECK_EQUAL( intersects(map_B, map_A), true );
- map_A.domain(set_A);
- map_B.domain(set_B);
+ itl::domain(set_A, map_A);
+ itl::domain(set_B, map_B);
BOOST_CHECK_EQUAL( disjoint(map_A, set_B), false );
BOOST_CHECK_EQUAL( disjoint(set_B, map_A), false );
BOOST_CHECK_EQUAL( disjoint(set_A, map_B), false );
@@ -1187,9 +1187,9 @@
BOOST_CHECK_EQUAL( inclusion_compare(itv_map_a, itv_map_c), inclusion::unrelated );
IntervalSetT set_sub_a, set_a, set_a2, set_b, set_c;
- itv_map_a.domain(set_a);
- itv_map_a2.domain(set_a2);
- itv_map_sub_a.domain(set_sub_a);
+ itl::domain(set_a, itv_map_a);
+ itl::domain(set_a2, itv_map_a2);
+ itl::domain(set_sub_a, itv_map_sub_a);
BOOST_CHECK_EQUAL( inclusion_compare(IntervalMapT(), IntervalSetT()), inclusion::equal );
BOOST_CHECK_EQUAL( inclusion_compare(IntervalSetT(), IntervalMapT()), inclusion::equal );
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 2010-09-12 17:39:29 EDT (Sun, 12 Sep 2010)
@@ -84,8 +84,9 @@
//TestLawT;
//typedef Antisymmetry<itl::map<int,int>, itl::sub_super_set, itl::element_equal> TestLawT;
+ //typedef InplaceAssociativity<itl::interval_map<int,itl::set<int> >, itl::inplace_caret, itl::element_equal> TestLawT;
- typedef InplaceAssociativity<itl::interval_map<int,itl::set<int> >, itl::inplace_caret, itl::element_equal> TestLawT;
+ typedef InplaceFlip<itl::interval_map<int,int> > TestLawT;
LawValidater<TestLawT> test_law;
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