2358 |
02 Dec 10 |
peter |
1 |
#ifndef theplu_yat_utility_segment_map |
2358 |
02 Dec 10 |
peter |
2 |
#define theplu_yat_utility_segment_map |
2291 |
07 Jul 10 |
peter |
3 |
|
2291 |
07 Jul 10 |
peter |
// $Id$ |
2291 |
07 Jul 10 |
peter |
5 |
|
2291 |
07 Jul 10 |
peter |
6 |
/* |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2010 Peter Johansson |
2291 |
07 Jul 10 |
peter |
8 |
|
2291 |
07 Jul 10 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
2291 |
07 Jul 10 |
peter |
10 |
|
2291 |
07 Jul 10 |
peter |
The yat library is free software; you can redistribute it and/or |
2291 |
07 Jul 10 |
peter |
modify it under the terms of the GNU General Public License as |
2291 |
07 Jul 10 |
peter |
published by the Free Software Foundation; either version 3 of the |
2291 |
07 Jul 10 |
peter |
License, or (at your option) any later version. |
2291 |
07 Jul 10 |
peter |
15 |
|
2291 |
07 Jul 10 |
peter |
The yat library is distributed in the hope that it will be useful, |
2291 |
07 Jul 10 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2291 |
07 Jul 10 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2291 |
07 Jul 10 |
peter |
General Public License for more details. |
2291 |
07 Jul 10 |
peter |
20 |
|
2291 |
07 Jul 10 |
peter |
You should have received a copy of the GNU General Public License |
2291 |
07 Jul 10 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
2291 |
07 Jul 10 |
peter |
23 |
*/ |
2291 |
07 Jul 10 |
peter |
24 |
|
2291 |
07 Jul 10 |
peter |
25 |
#include "Segment.h" |
2358 |
02 Dec 10 |
peter |
26 |
#include "SegmentTree.h" |
2360 |
04 Dec 10 |
peter |
27 |
#include "stl_utility.h" |
2291 |
07 Jul 10 |
peter |
28 |
|
2358 |
02 Dec 10 |
peter |
29 |
#include <map> |
2291 |
07 Jul 10 |
peter |
30 |
|
2291 |
07 Jul 10 |
peter |
31 |
namespace theplu { |
2291 |
07 Jul 10 |
peter |
32 |
namespace yat { |
2291 |
07 Jul 10 |
peter |
33 |
namespace utility { |
2291 |
07 Jul 10 |
peter |
34 |
|
2291 |
07 Jul 10 |
peter |
35 |
/** |
2358 |
02 Dec 10 |
peter |
\brief a map of Segments |
2291 |
07 Jul 10 |
peter |
37 |
|
2358 |
02 Dec 10 |
peter |
A map with key Segment. The Segments cannot overlap. |
2291 |
07 Jul 10 |
peter |
39 |
|
2291 |
07 Jul 10 |
peter |
\since new in yat 0.7 |
2291 |
07 Jul 10 |
peter |
41 |
*/ |
2358 |
02 Dec 10 |
peter |
42 |
template<typename T, typename Tp, class Compare = std::less<T> > |
2703 |
12 Mar 12 |
peter |
43 |
class SegmentMap |
2703 |
12 Mar 12 |
peter |
44 |
: public SegmentTree<std::map<Segment<T, Compare>, Tp, |
2358 |
02 Dec 10 |
peter |
45 |
SegmentCompare<T, Compare> >, |
2360 |
04 Dec 10 |
peter |
46 |
Compare, |
2360 |
04 Dec 10 |
peter |
47 |
PairFirst<const std::pair<const Segment<T, Compare>, Tp> > > |
2291 |
07 Jul 10 |
peter |
48 |
{ |
2291 |
07 Jul 10 |
peter |
49 |
public: |
2358 |
02 Dec 10 |
peter |
/// mapped type |
2358 |
02 Dec 10 |
peter |
51 |
typedef Tp mapped_type; |
2703 |
12 Mar 12 |
peter |
52 |
|
2291 |
07 Jul 10 |
peter |
53 |
/** |
2357 |
01 Dec 10 |
peter |
\brief creates a set with no segments |
2291 |
07 Jul 10 |
peter |
55 |
*/ |
2358 |
02 Dec 10 |
peter |
56 |
SegmentMap(void) {} |
2291 |
07 Jul 10 |
peter |
57 |
|
2291 |
07 Jul 10 |
peter |
58 |
private: |
2291 |
07 Jul 10 |
peter |
// using compiler generated copying |
2358 |
02 Dec 10 |
peter |
//SegmentMap(const SegmentMap&); |
2358 |
02 Dec 10 |
peter |
//SegmentMap& operator=(const SegmentMap&); |
2291 |
07 Jul 10 |
peter |
62 |
}; |
2291 |
07 Jul 10 |
peter |
63 |
|
2291 |
07 Jul 10 |
peter |
64 |
}}} |
2291 |
07 Jul 10 |
peter |
65 |
#endif |