LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
boost::python::detail::final_vector_derived_policies< Container, NoProxy > Class Template Reference

#include "vector_indexing_suite.hpp"

Inheritance diagram for boost::python::detail::final_vector_derived_policies< Container, NoProxy >:
boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > > boost::python::indexing_suite< Container, final_vector_derived_policies< Container, NoProxy >, NoProxy >

Public Types

typedef Container::value_type data_type
 
typedef Container::value_type key_type
 
typedef Container::size_type index_type
 
typedef Container::size_type size_type
 
typedef Container::difference_type difference_type
 

Public Member Functions

void visit (Class &cl) const
 

Static Public Member Functions

static void extension_def (Class &cl)
 
static mpl::if_< is_class< data_type >, data_type &, data_type >::type get_item (Container &container, index_type i)
 
static object get_slice (Container &container, index_type from, index_type to)
 
static void set_item (Container &container, index_type i, data_type const &v)
 
static void set_slice (Container &container, index_type from, index_type to, data_type const &v)
 
static void set_slice (Container &container, index_type from, index_type to, Iter first, Iter last)
 
static void delete_item (Container &container, index_type i)
 
static void delete_slice (Container &container, index_type from, index_type to)
 
static size_t size (Container &container)
 
static bool contains (Container &container, key_type const &key)
 
static index_type get_min_index (Container &container)
 
static index_type get_max_index (Container &container)
 
static bool compare_index (Container &container, index_type a, index_type b)
 
static index_type convert_index (Container &container, PyObject *i_)
 
static void append (Container &container, data_type const &v)
 
static void extend (Container &container, Iter first, Iter last)
 

Detailed Description

template<class Container, bool NoProxy>
class boost::python::detail::final_vector_derived_policies< Container, NoProxy >

Definition at line 22 of file vector_indexing_suite.hpp.

Member Typedef Documentation

typedef Container::value_type boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::data_type
inherited

Definition at line 53 of file vector_indexing_suite.hpp.

typedef Container::difference_type boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::difference_type
inherited

Definition at line 57 of file vector_indexing_suite.hpp.

typedef Container::size_type boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::index_type
inherited

Definition at line 55 of file vector_indexing_suite.hpp.

typedef Container::value_type boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::key_type
inherited

Definition at line 54 of file vector_indexing_suite.hpp.

typedef Container::size_type boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::size_type
inherited

Definition at line 56 of file vector_indexing_suite.hpp.

Member Function Documentation

static void boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::append ( Container &  container,
data_type const &  v 
)
inlinestaticinherited

Definition at line 192 of file vector_indexing_suite.hpp.

193  {
194  container.push_back(v);
195  }
static bool boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::compare_index ( Container &  container,
index_type  a,
index_type  b 
)
inlinestaticinherited

Definition at line 164 of file vector_indexing_suite.hpp.

165  {
166  return a < b;
167  }
static bool boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::contains ( Container &  container,
key_type const &  key 
)
inlinestaticinherited

Definition at line 145 of file vector_indexing_suite.hpp.

146  {
147  return std::find(container.begin(), container.end(), key)
148  != container.end();
149  }
static index_type boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::convert_index ( Container &  container,
PyObject *  i_ 
)
inlinestaticinherited

Definition at line 170 of file vector_indexing_suite.hpp.

References util::size().

171  {
172  extract<long> i(i_);
173  if (i.check())
174  {
175  long index = i();
176  if (index < 0)
177  index += DerivedPolicies::size(container);
178  if (index >= long(container.size()) || index < 0)
179  {
180  PyErr_SetString(PyExc_IndexError, "Index out of range");
181  throw_error_already_set();
182  }
183  return index;
184  }
185 
186  PyErr_SetString(PyExc_TypeError, "Invalid index type");
187  throw_error_already_set();
188  return index_type();
189  }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
static void boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::delete_item ( Container &  container,
index_type  i 
)
inlinestaticinherited

Definition at line 123 of file vector_indexing_suite.hpp.

124  {
125  container.erase(container.begin()+i);
126  }
static void boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::delete_slice ( Container &  container,
index_type  from,
index_type  to 
)
inlinestaticinherited

Definition at line 129 of file vector_indexing_suite.hpp.

130  {
131  if (from > to) {
132  // A null-op.
133  return;
134  }
135  container.erase(container.begin()+from, container.begin()+to);
136  }
static void boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::extend ( Container &  container,
Iter  first,
Iter  last 
)
inlinestaticinherited

Definition at line 199 of file vector_indexing_suite.hpp.

200  {
201  container.insert(container.end(), first, last);
202  }
static mpl::if_< is_class<data_type> , data_type& , data_type >::type boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::get_item ( Container &  container,
index_type  i 
)
inlinestaticinherited

Definition at line 76 of file vector_indexing_suite.hpp.

77  {
78  return container[i];
79  }
static index_type boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::get_max_index ( Container &  container)
inlinestaticinherited

Definition at line 158 of file vector_indexing_suite.hpp.

159  {
160  return container.size();
161  }
static index_type boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::get_min_index ( Container &  container)
inlinestaticinherited

Definition at line 152 of file vector_indexing_suite.hpp.

153  {
154  return 0;
155  }
static object boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::get_slice ( Container &  container,
index_type  from,
index_type  to 
)
inlinestaticinherited

Definition at line 82 of file vector_indexing_suite.hpp.

83  {
84  if (from > to)
85  return object(Container());
86  return object(Container(container.begin()+from, container.begin()+to));
87  }
static void boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::set_item ( Container &  container,
index_type  i,
data_type const &  v 
)
inlinestaticinherited

Definition at line 90 of file vector_indexing_suite.hpp.

91  {
92  container[i] = v;
93  }
static void boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::set_slice ( Container &  container,
index_type  from,
index_type  to,
data_type const &  v 
)
inlinestaticinherited

Definition at line 96 of file vector_indexing_suite.hpp.

98  {
99  if (from > to) {
100  return;
101  }
102  else {
103  container.erase(container.begin()+from, container.begin()+to);
104  container.insert(container.begin()+from, v);
105  }
106  }
static void boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::set_slice ( Container &  container,
index_type  from,
index_type  to,
Iter  first,
Iter  last 
)
inlinestaticinherited

Definition at line 110 of file vector_indexing_suite.hpp.

112  {
113  if (from > to) {
114  container.insert(container.begin()+from, first, last);
115  }
116  else {
117  container.erase(container.begin()+from, container.begin()+to);
118  container.insert(container.begin()+from, first, last);
119  }
120  }
static size_t boost::python::vector_indexing_suite< Container, NoProxy, final_vector_derived_policies< Container, NoProxy > >::size ( Container &  container)
inlinestaticinherited

Definition at line 139 of file vector_indexing_suite.hpp.

140  {
141  return container.size();
142  }
void boost::python::indexing_suite< Container, final_vector_derived_policies< Container, NoProxy > , NoProxy, false , typename Container::value_type , typename Container::size_type , typename Container::value_type >::visit ( Class &  cl) const
inlineinherited

Definition at line 173 of file indexing_suite.hpp.

174  {
175  // Hook into the class_ generic visitation .def function
176  proxy_handler::register_container_element();
177 
178  cl
179  .def("__len__", base_size)
180  .def("__setitem__", &base_set_item)
181  .def("__delitem__", &base_delete_item)
182  .def("__getitem__", &base_get_item)
183  .def("__contains__", &base_contains)
184  .def("__iter__", def_iterator())
185  ;
186 
187  DerivedPolicies::extension_def(cl);
188  }
mpl::if_< no_proxy, iterator< Container >, iterator< Container, return_policy > >::type def_iterator

The documentation for this class was generated from the following file: