]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/icl/example/itvset_shell_/itvset_shell.cpp
1 /*-----------------------------------------------------------------------------+
2 Copyright (c) 2007-2009: Joachim Faulhaber
3 +------------------------------------------------------------------------------+
4 Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
5 +------------------------------------------------------------------------------+
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENCE.txt or copy at
8 http://www.boost.org/LICENSE_1_0.txt)
9 +-----------------------------------------------------------------------------*/
11 /*-----------------------------------------------------------------------------+
12 itvset_shell.cpp provides a simple test shells for interval sets.
13 The shell also gives you a good idea how interval container are working.
14 +-----------------------------------------------------------------------------*/
17 #include <boost/icl/split_interval_set.hpp>
18 #include <boost/icl/split_interval_map.hpp>
21 using namespace boost
;
22 using namespace boost::icl
;
26 cout
<< "+++++ Test shell for interval set +++++\n";
27 cout
<< "Type: q e or 0 to quit\n";
28 cout
<< "Type: + for insertions\n";
29 cout
<< "Type: - for subtraction\n";
30 cout
<< "Type: j to join contiguous intervals\n";
31 cout
<< "Type: s to compute total size\n";
36 cout
<< "Wrong Input ------------------\n";
41 template <class SetTV
>
48 typename
SetTV::domain_type lwb
= typename
SetTV::domain_type();
49 typename
SetTV::domain_type upb
= typename
SetTV::domain_type();
62 case '0': cout
<< "good bye\n"; return;
65 cout
<< "input: lwb upb >> ";
67 typename
SetTV::interval_type itv
68 = typename
SetTV::interval_type(lwb
,upb
);
69 // SetTV::IntervalTD itv = rightOpenInterval(lwb,upb);
72 cout
<< "+" << itv
<< " =" << endl
;
73 cout
<< "{" << m1
<< "}" << endl
;
79 cout
<< "input: lwb upb >> ";
81 typename
SetTV::interval_type itv
82 = typename
SetTV::interval_type(lwb
,upb
);
88 cout
<< "-" << itv
<< " =" << endl
;
89 cout
<< "{" << m1
<< "}" << endl
;
96 cout
<< "{" << m1
<< "}" << endl
;
101 cout
<< "size = " << m1
.size() << endl
;
105 default: wrongInput();
112 cout
<< "itvset_shell: exception caught: " << endl
117 cout
<< "itvset_shell: unknown exception caught" << endl
;
126 cout
<< ">>Interval Container Library: Test itvset_shell.cpp <<\n";
127 cout
<< "------------------------------------------------------\n";
128 setTestShell
< interval_set
<int> >();