/usr/include/boost/icl/detail
Edit: /usr/include/boost/icl/detail/interval_morphism.hpp (4234B)
/*-----------------------------------------------------------------------------+
Copyright (c) 2008-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_ICL_DETAIL_INTERVAL_MORPHISM_HPP_JOFA_080315
#define BOOST_ICL_DETAIL_INTERVAL_MORPHISM_HPP_JOFA_080315
#include
#include
#include
#include
#include
#include
#include
namespace boost{namespace icl
{
namespace segmental
{
template
void atomize(ElementContainerT& result, const IntervalContainerT& src)
{
ICL_const_FORALL(typename IntervalContainerT, itv_, src)
{
const typename IntervalContainerT::key_type& itv = icl::key_value(itv_);
typename IntervalContainerT::codomain_type coval = icl::co_value(itv_);
for(typename IntervalContainerT::domain_type element = first(itv); element <= last(itv); ++element)
icl::insert(result, icl::make_value(element, coval));
}
}
template
void cluster(IntervalContainerT& result, const ElementContainerT& src)
{
typedef typename IntervalContainerT::key_type key_type;
ICL_const_FORALL(typename ElementContainerT, element_, src)
{
const typename ElementContainerT::key_type& key
= key_value(element_);
const typename codomain_type_of::type& coval
= co_value(element_);
result += icl::make_value(key_type(key), coval);
}
}
template
struct atomizer
{
void operator()(AtomizedType& atomized, const ClusteredType& clustered)
{
segmental::atomize(atomized, clustered);
}
};
template
struct clusterer
{
void operator()(ClusteredType& clustered, const AtomizedType& atomized)
{
segmental::cluster(clustered, atomized);
}
};
template
struct joiner
{
void operator()(JointType& joint, SplitType& split)
{
icl::join(split);
ICL_FORALL(typename SplitType, split_, split)
joint.insert(*split_);
}
};
template
struct identity_absorber
{
void operator()(AbsorberType& absorber, EnricherType& enricher)
{
icl::absorb_identities(enricher);
ICL_FORALL(typename EnricherType, enricher_, enricher)
absorber.insert(*enricher_);
}
};
} // namespace Interval
template<>
inline std::string binary_template_to_string::apply() { return "@"; }
template<>
inline std::string binary_template_to_string::apply() { return "&"; }
template<>
inline std::string binary_template_to_string::apply() { return "j"; }
template<>
inline std::string binary_template_to_string::apply() { return "a0"; }
}} // namespace boost icl
#endif // BOOST_ICL_DETAIL_INTERVAL_MORPHISM_HPP_JOFA_080315