/usr/include/polymake/internal/tree_containers.h is in libpolymake-dev-common 3.2r2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | /* Copyright (c) 1997-2018
Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
http://www.polymake.org
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version: http://www.gnu.org/licenses/gpl.txt.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
--------------------------------------------------------------------------------
*/
#ifndef POLYMAKE_INTERNAL_TREE_CONTAINERS_H
#define POLYMAKE_INTERNAL_TREE_CONTAINERS_H
#include "polymake/internal/modified_containers.h"
namespace pm {
template <typename Top, typename TParams=typename Top::manipulator_params,
bool TModified=mtagged_list_extract<TParams, OperationTag>::is_specified>
class modified_tree_impl
: public modified_container_impl<Top, TParams> {
typedef modified_container_impl<Top, TParams> base_t;
public:
using typename base_t::iterator;
using typename base_t::const_iterator;
using typename base_t::reverse_iterator;
using typename base_t::const_reverse_iterator;
typedef typename base_t::container::tree_type tree_type;
protected:
iterator finalize(typename tree_type::iterator it)
{
return iterator(it, this->manip_top().get_operation());
}
const_iterator finalize(typename tree_type::const_iterator it) const
{
return const_iterator(it, this->manip_top().get_operation());
}
reverse_iterator finalize(typename tree_type::reverse_iterator it)
{
return reverse_iterator(it, this->manip_top().get_operation());
}
const_reverse_iterator finalize(typename tree_type::const_reverse_iterator it) const
{
return const_reverse_iterator(it, this->manip_top().get_operation());
}
};
template <typename Top, typename TParams>
class modified_tree_impl<Top, TParams, false>
: public redirected_container<Top, TParams> {
typedef redirected_container<Top, TParams> base_t;
public:
using typename base_t::iterator;
using typename base_t::const_iterator;
using typename base_t::reverse_iterator;
using typename base_t::const_reverse_iterator;
protected:
iterator finalize(iterator it) { return it; }
const_iterator finalize(const_iterator it) const { return it; }
reverse_iterator finalize(reverse_iterator it) { return it; }
const_reverse_iterator finalize(const_reverse_iterator it) const { return it; }
};
template <typename Top, typename TParams=typename Top::manipulator_params>
class modified_tree
: public modified_tree_impl<Top, TParams> {
typedef modified_tree_impl<Top, TParams> base_t;
public:
using typename base_t::iterator;
using typename base_t::const_iterator;
using typename base_t::reverse_iterator;
using typename base_t::const_reverse_iterator;
typedef typename base_t::container::tree_type tree_type;
template <typename Key>
iterator find(const Key& k)
{
return this->finalize(this->manip_top().get_container().find(k));
}
template <typename Key>
const_iterator find(const Key& k) const
{
return this->finalize(this->manip_top().get_container().find(k));
}
template <typename Key, typename Comparator>
iterator find(const Key& k, const Comparator& comparator)
{
return this->finalize(this->manip_top().get_container().find(k,comparator));
}
template <typename Key, typename Comparator>
const_iterator find(const Key& k, const Comparator& comparator) const
{
return this->finalize(this->manip_top().get_container().find(k,comparator));
}
template <typename Key, typename RelOp>
iterator find_nearest(const Key& k, const RelOp& relop)
{
return this->finalize(this->manip_top().get_container().find_nearest(k,relop));
}
template <typename Key, typename RelOp>
const_iterator find_nearest(const Key& k, const RelOp& relop) const
{
return this->finalize(this->manip_top().get_container().find_nearest(k,relop));
}
template <typename Key, typename RelOp, typename Comparator>
iterator find_nearest(const Key& k, const RelOp& relop, const Comparator& comparator)
{
return this->finalize(this->manip_top().get_container().find_nearest(k,relop,comparator));
}
template <typename Key, typename RelOp, typename Comparator>
const_iterator find_nearest(const Key& k, const RelOp& relop, const Comparator& comparator) const
{
return this->finalize(this->manip_top().get_container().find_nearest(k,relop,comparator));
}
template <typename Key>
bool exists(const Key& k) const
{
return this->manip_top().get_container().exists(k);
}
// synonym for sets
template <typename Key>
bool contains(const Key& k) const { return exists(k); }
protected:
template <typename First>
struct insert_helper {
static const bool is_reverse_iterator=tree_type::template insert_arg_helper<First>::is_reverse_iterator;
typedef typename std::conditional<is_reverse_iterator, typename base_t::reverse_iterator, iterator>::type return_type;
};
public:
template <typename First>
typename insert_helper<First>::return_type
insert(const First& first_arg)
{
return this->finalize(this->manip_top().get_container().insert(first_arg));
}
template <typename First, typename Second>
typename insert_helper<First>::return_type
insert(const First& first_arg, const Second& second_arg)
{
return this->finalize(this->manip_top().get_container().insert(first_arg,second_arg));
}
template <typename First, typename Second, typename Third>
typename insert_helper<First>::return_type
insert(const First& first_arg, const Second& second_arg, const Third& third_arg)
{
return this->finalize(this->manip_top().get_container().insert(first_arg,second_arg,third_arg));
}
template <typename Key_or_Iterator>
void erase(const Key_or_Iterator& k_or_it)
{
this->manip_top().get_container().erase(k_or_it);
}
template <typename Iterator>
void erase(const Iterator& pos, const Iterator& end)
{
this->manip_top().get_container().erase(pos,end);
}
template <typename Key>
iterator toggle(const Key& k)
{
return this->finalize(this->manip_top().get_container().toggle(k));
}
template <typename Key>
void push_front(const Key& k)
{
this->manip_top().get_container().push_front(k);
}
template <typename Key, typename Data>
void push_front(const Key& k, const Data& data)
{
this->manip_top().get_container().push_front(k,data);
}
template <typename Key>
void push_back(const Key& k)
{
this->manip_top().get_container().push_back(k);
}
template <typename Key, typename Data>
void push_back(const Key& k, const Data& data)
{
this->manip_top().get_container().push_back(k,data);
}
void pop_front()
{
this->manip_top().get_container().pop_front();
}
void pop_back()
{
this->manip_top().get_container().pop_back();
}
bool tree_form() const
{
return this->manip_top().get_container().tree_form();
}
int max_size() const
{
return this->manip_top().get_container().max_size();
}
void clear()
{
this->manip_top().get_container().clear();
}
const typename tree_type::key_comparator_type&
get_comparator() const
{
return this->manip_top().get_container().get_comparator();
}
};
} // end namespace pm
#endif // POLYMAKE_INTERNAL_TREE_CONTAINERS_H
// Local Variables:
// mode:C++
// c-basic-offset:3
// indent-tabs-mode:nil
// End:
|