| Home | Libraries | People | FAQ | More

## Class template interval_base_set

boost::icl::interval_base_set — Implements a set as a set of intervals (base class)

## Synopsis

    // In header: <boost/icl/interval_base_set.hpp>

    template<typename SubType, typename DomainT,
             ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT),
             ICL_INTERVAL(ICL_COMPARE) Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, DomainT, Compare),
             ICL_ALLOC Alloc = std::allocator>
    class interval_base_set {
    public:
      // types
      typedef interval_base_set< SubType, DomainT, Compare, Interval, Alloc >   type;
      typedef SubType                                                           sub_type;                        // The designated derived or sub_type of this base class.
      typedef type                                                              overloadable_type;               // Auxilliary type for overloadresolution.
      typedef DomainT                                                           domain_type;                     // The domain type of the set.
      typedef DomainT                                                           codomain_type;                   // The codomaintype is the same as domain_type.
      typedef DomainT                                                           element_type;                    // The element type of the set.
      typedef interval_type                                                     segment_type;                    // The segment type of the set.
      typedef difference_type_of< domain_type >::type                           difference_type;                 // The difference type of an interval which is sometimes different form the data_type.
      typedef size_type_of< domain_type >::type                                 size_type;                       // The size type of an interval which is mostly std::size_t.
      typedef exclusive_less_than< interval_type >                              interval_compare;                // Comparison functor for intervals.
      typedef exclusive_less_than< interval_type >                              key_compare;                     // Comparison functor for keys.
      typedef ICL_IMPL_SPACE::set< DomainT, domain_compare, Alloc< DomainT > >  atomized_type;                   // The atomized type representing the corresponding container of elements.
      typedef Alloc< interval_type >                                            allocator_type;                  // The allocator type of the set.
      typedef Alloc< DomainT >                                                  domain_allocator_type;           // allocator type of the corresponding element set
      typedef ICL_IMPL_SPACE::set< interval_type, key_compare, allocator_type > ImplSetT;                        // Container type for the implementation.
      typedef ImplSetT::key_type                                                key_type;                        // key type of the implementing container
      typedef ImplSetT::key_type                                                data_type;                       // data type of the implementing container
      typedef ImplSetT::value_type                                              value_type;                      // value type of the implementing container
      typedef ImplSetT::pointer                                                 pointer;                         // pointer type
      typedef ImplSetT::const_pointer                                           const_pointer;                   // const pointer type
      typedef ImplSetT::reference                                               reference;                       // reference type
      typedef ImplSetT::const_reference                                         const_reference;                 // const reference type
      typedef ImplSetT::iterator                                                iterator;                        // iterator for iteration over intervals
      typedef ImplSetT::const_iterator                                          const_iterator;                  // const_iterator for iteration over intervals
      typedef ImplSetT::reverse_iterator                                        reverse_iterator;                // iterator for reverse iteration over intervals
      typedef ImplSetT::const_reverse_iterator                                  const_reverse_iterator;          // const_iterator for iteration over intervals
      typedef boost::icl::element_iterator< iterator >                          element_iterator;                // element iterator: Depreciated, see documentation.
      typedef boost::icl::element_iterator< const_iterator >                    element_const_iterator;          // element const iterator: Depreciated, see documentation.
      typedef boost::icl::element_iterator< reverse_iterator >                  element_reverse_iterator;        // element reverse iterator: Depreciated, see documentation.
      typedef boost::icl::element_iterator< const_reverse_iterator >            element_const_reverse_iterator;  // element const reverse iterator: Depreciated, see documentation.

      // public member functions
      typedef ICL_INTERVAL_TYPE(Interval, DomainT, Compare);
      typedef ICL_COMPARE_DOMAIN(Compare, DomainT);
      typedef ICL_COMPARE_DOMAIN(Compare, segment_type);
       BOOST_STATIC_CONSTANT(int, fineness = 0);
      interval_base_set();
      interval_base_set(const interval_base_set &);
      interval_base_set(interval_base_set &&);
      interval_base_set & operator=(interval_base_set);
      void swap(interval_base_set &);
      void clear();
      bool empty() const;
      size_type size() const;
      std::size_t iterative_size() const;
      const_iterator find(const element_type &) const;
      const_iterator find(const interval_type &) const;
      SubType & add(const element_type &);
      SubType & add(const segment_type &);
      iterator add(iterator, const segment_type &);
      SubType & subtract(const element_type &);
      SubType & subtract(const segment_type &);
      SubType & insert(const element_type &);
      SubType & insert(const segment_type &);
      iterator insert(iterator, const segment_type &);
      SubType & erase(const element_type &);
      SubType & erase(const segment_type &);
      void erase(iterator);
      void erase(iterator, iterator);
      SubType & flip(const element_type &);
      SubType & flip(const segment_type &);
      iterator begin();
      iterator end();
      const_iterator begin() const;
      const_iterator end() const;
      reverse_iterator rbegin();
      reverse_iterator rend();
      const_reverse_iterator rbegin() const;
      const_reverse_iterator rend() const;
      iterator lower_bound(const value_type &);
      iterator upper_bound(const value_type &);
      const_iterator lower_bound(const value_type &) const;
      const_iterator upper_bound(const value_type &) const;
      std::pair< iterator, iterator > equal_range(const key_type &);
      std::pair< const_iterator, const_iterator >
      equal_range(const key_type &) const;

      // private member functions
      iterator _add(const segment_type &);
      iterator _add(iterator, const segment_type &);

      // protected member functions
      void add_front(const interval_type &, iterator &);
      void add_main(interval_type &, iterator &, const iterator &);
      void add_segment(const interval_type &, iterator &);
      void add_rear(const interval_type &, iterator &);
      sub_type * that();
      const sub_type * that() const;
    };

## Description

### `interval_base_set` public member functions

1.     typedef ICL_INTERVAL_TYPE(Interval, DomainT, Compare);

   The interval type of the set.

2.     typedef ICL_COMPARE_DOMAIN(Compare, DomainT);

   Comparison functor for domain values.

3.     typedef ICL_COMPARE_DOMAIN(Compare, segment_type);

4.      BOOST_STATIC_CONSTANT(int, fineness = 0);

5.     interval_base_set();

   Default constructor for the empty object

6.     interval_base_set(const interval_base_set & src);

   Copy constructor

7.     interval_base_set(interval_base_set && src);

   Move constructor

8.     interval_base_set & operator=(interval_base_set src);

   Move assignment operator

9.     void swap(interval_base_set & operand);

   swap the content of containers

10.     void clear();

    sets the container empty

11.     bool empty() const;

    is the container empty?

12.     size_type size() const;

    An interval set's size is it's cardinality

13.     std::size_t iterative_size() const;

    Size of the iteration over this container

14.     const_iterator find(const element_type & key_value) const;

    Find the interval, that contains element `key_value`

15.     const_iterator find(const interval_type & key_interval) const;

    Find the first interval, that collides with interval `key_interval`

16.     SubType & add(const element_type & key);

    Add a single element `key` to the set

17.     SubType & add(const segment_type & inter_val);

    Add an interval of elements `inter_val` to the set

18.     iterator add(iterator prior_, const segment_type & inter_val);

    Add an interval of elements `inter_val` to the set. Iterator `prior_` is a hint to the position `inter_val` can be inserted after.

19.     SubType & subtract(const element_type & key);

    Subtract a single element `key` from the set

20.     SubType & subtract(const segment_type & inter_val);

    Subtract an interval of elements `inter_val` from the set

21.     SubType & insert(const element_type & key);

    Insert an element `key` into the set

22.     SubType & insert(const segment_type & inter_val);

    Insert an interval of elements `inter_val` to the set

23.     iterator insert(iterator prior_, const segment_type & inter_val);

    Insert an interval of elements `inter_val` to the set. Iterator `prior_` is a hint to the position `inter_val` can be inserted after.

24.     SubType & erase(const element_type & key);

    Erase an element `key` from the set

25.     SubType & erase(const segment_type & inter_val);

    Erase an interval of elements `inter_val` from the set

26.     void erase(iterator position);

    Erase the interval that iterator `position` points to.

27.     void erase(iterator first, iterator past);

    Erase all intervals in the range `[first,past)` of iterators.

28.     SubType & flip(const element_type & key);

    If `*this` set contains `key` it is erased, otherwise it is added.

29.     SubType & flip(const segment_type & inter_val);

    If `*this` set contains `inter_val` it is erased, otherwise it is added.

30.     iterator begin();

31.     iterator end();

32.     const_iterator begin() const;

33.     const_iterator end() const;

34.     reverse_iterator rbegin();

35.     reverse_iterator rend();

36.     const_reverse_iterator rbegin() const;

37.     const_reverse_iterator rend() const;

38.     iterator lower_bound(const value_type & interval);

39.     iterator upper_bound(const value_type & interval);

40.     const_iterator lower_bound(const value_type & interval) const;

41.     const_iterator upper_bound(const value_type & interval) const;

42.     std::pair< iterator, iterator > equal_range(const key_type & interval);

43.     std::pair< const_iterator, const_iterator >
        equal_range(const key_type & interval) const;

### `interval_base_set` private member functions

1.     iterator _add(const segment_type & addend);

2.     iterator _add(iterator prior, const segment_type & addend);

### `interval_base_set` protected member functions

1.     void add_front(const interval_type & inter_val, iterator & first_);

2.     void add_main(interval_type & inter_val, iterator & it_,
                     const iterator & last_);

3.     void add_segment(const interval_type & inter_val, iterator & it_);

4.     void add_rear(const interval_type & inter_val, iterator & it_);

5.     sub_type * that();

6.     const sub_type * that() const;