Public Member Functions | Static Public Member Functions | Private Types | Static Private Member Functions | List of all members
boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key > Class Template Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/geant4/v4_10_4_p02ba/source/geant4.10.04.p02/environments/g4py/source/boost/indexing_suite.hpp"

Inheritance diagram for boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >:

Public Member Functions

template<class Class >
void visit (Class &cl) const
 
template<class Class >
void visit (Class &cl) const
 

Static Public Member Functions

template<class Class >
static void extension_def (Class &cl)
 
template<class Class >
static void extension_def (Class &cl)
 

Private Types

typedef mpl::or_< mpl::bool_< NoProxy >, mpl::not_< is_class< Data > > > no_proxy
 
typedef detail::container_element< Container, Index, DerivedPolicies > container_element_t
 
typedef return_internal_reference return_policy
 
typedef mpl::if_< no_proxy, iterator< Container >, iterator< Container, return_policy > >::type def_iterator
 
typedef mpl::if_< no_proxy, detail::no_proxy_helper< Container, DerivedPolicies, container_element_t, Index >, detail::proxy_helper< Container, DerivedPolicies, container_element_t, Index > >::type proxy_handler
 
typedef mpl::if_< mpl::bool_< NoSlice >, detail::no_slice_helper< Container, DerivedPolicies, proxy_handler, Data, Index >, detail::slice_helper< Container, DerivedPolicies, proxy_handler, Data, Index > >::type slice_handler
 
typedef mpl::or_< mpl::bool_< NoProxy >, mpl::not_< is_class< Data > > > no_proxy
 
typedef detail::container_element< Container, Index, DerivedPolicies > container_element_t
 
typedef return_internal_reference return_policy
 
typedef mpl::if_< no_proxy, iterator< Container >, iterator< Container, return_policy > >::type def_iterator
 
typedef mpl::if_< no_proxy, detail::no_proxy_helper< Container, DerivedPolicies, container_element_t, Index >, detail::proxy_helper< Container, DerivedPolicies, container_element_t, Index > >::type proxy_handler
 
typedef mpl::if_< mpl::bool_< NoSlice >, detail::no_slice_helper< Container, DerivedPolicies, proxy_handler, Data, Index >, detail::slice_helper< Container, DerivedPolicies, proxy_handler, Data, Index > >::type slice_handler
 

Static Private Member Functions

static object base_get_item (back_reference< Container & > container, PyObject *i)
 
static void base_set_item (Container &container, PyObject *i, PyObject *v)
 
static void base_delete_item (Container &container, PyObject *i)
 
static size_t base_size (Container &container)
 
static bool base_contains (Container &container, PyObject *key)
 
static object base_get_item (back_reference< Container & > container, PyObject *i)
 
static void base_set_item (Container &container, PyObject *i, PyObject *v)
 
static void base_delete_item (Container &container, PyObject *i)
 
static size_t base_size (Container &container)
 
static bool base_contains (Container &container, PyObject *key)
 

Detailed Description

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
class boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >

Definition at line 106 of file indexing_suite.hpp.

Member Typedef Documentation

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef detail::container_element<Container, Index, DerivedPolicies> boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::container_element_t
private

Definition at line 126 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef detail::container_element<Container, Index, DerivedPolicies> boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::container_element_t
private

Definition at line 126 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef mpl::if_< no_proxy , iterator<Container> , iterator<Container, return_policy> >::type boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::def_iterator
private

Definition at line 138 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef mpl::if_< no_proxy , iterator<Container> , iterator<Container, return_policy> >::type boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::def_iterator
private

Definition at line 138 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef mpl::or_< mpl::bool_<NoProxy> , mpl::not_<is_class<Data> > > boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::no_proxy
private

Definition at line 123 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef mpl::or_< mpl::bool_<NoProxy> , mpl::not_<is_class<Data> > > boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::no_proxy
private

Definition at line 123 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef mpl::if_< no_proxy , detail::no_proxy_helper< Container , DerivedPolicies , container_element_t , Index> , detail::proxy_helper< Container , DerivedPolicies , container_element_t , Index> >::type boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::proxy_handler
private

Definition at line 152 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef mpl::if_< no_proxy , detail::no_proxy_helper< Container , DerivedPolicies , container_element_t , Index> , detail::proxy_helper< Container , DerivedPolicies , container_element_t , Index> >::type boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::proxy_handler
private

Definition at line 152 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef return_internal_reference boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::return_policy
private

Definition at line 131 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef return_internal_reference boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::return_policy
private

Definition at line 131 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef mpl::if_< mpl::bool_<NoSlice> , detail::no_slice_helper< Container , DerivedPolicies , proxy_handler , Data , Index> , detail::slice_helper< Container , DerivedPolicies , proxy_handler , Data , Index> >::type boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::slice_handler
private

Definition at line 168 of file indexing_suite.hpp.

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
typedef mpl::if_< mpl::bool_<NoSlice> , detail::no_slice_helper< Container , DerivedPolicies , proxy_handler , Data , Index> , detail::slice_helper< Container , DerivedPolicies , proxy_handler , Data , Index> >::type boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::slice_handler
private

Definition at line 168 of file indexing_suite.hpp.

Member Function Documentation

template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static bool boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_contains ( Container &  container,
PyObject *  key 
)
inlinestaticprivate

Definition at line 271 of file indexing_suite.hpp.

Referenced by boost::python::indexing_suite< Container, DerivedPolicies, NoProxy >::visit().

272  {
273  extract<Key const&> x(key);
274  // try if key is an exact Key type
275  if (x.check())
276  {
278  }
279  else
280  {
281  // try to convert key to Key type
282  extract<Key> x(key);
283  if (x.check())
285  else
286  return false;
287  }
288  }
dictionary contains
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static bool boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_contains ( Container &  container,
PyObject *  key 
)
inlinestaticprivate

Definition at line 271 of file indexing_suite.hpp.

272  {
273  extract<Key const&> x(key);
274  // try if key is an exact Key type
275  if (x.check())
276  {
278  }
279  else
280  {
281  // try to convert key to Key type
282  extract<Key> x(key);
283  if (x.check())
285  else
286  return false;
287  }
288  }
dictionary contains
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static void boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_delete_item ( Container &  container,
PyObject *  i 
)
inlinestaticprivate

Definition at line 250 of file indexing_suite.hpp.

251  {
252  if (PySlice_Check(i))
253  {
254  slice_handler::base_delete_slice(
255  container, reinterpret_cast<PySliceObject*>(i));
256  return;
257  }
258 
259  Index index = DerivedPolicies::convert_index(container, i);
260  proxy_handler::base_erase_index(container, index, mpl::bool_<NoSlice>());
261  DerivedPolicies::delete_item(container, index);
262  }
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static void boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_delete_item ( Container &  container,
PyObject *  i 
)
inlinestaticprivate

Definition at line 250 of file indexing_suite.hpp.

Referenced by boost::python::indexing_suite< Container, DerivedPolicies, NoProxy >::visit().

251  {
252  if (PySlice_Check(i))
253  {
254  slice_handler::base_delete_slice(
255  container, reinterpret_cast<PySliceObject*>(i));
256  return;
257  }
258 
259  Index index = DerivedPolicies::convert_index(container, i);
260  proxy_handler::base_erase_index(container, index, mpl::bool_<NoSlice>());
261  DerivedPolicies::delete_item(container, index);
262  }
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static object boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_get_item ( back_reference< Container & >  container,
PyObject *  i 
)
inlinestaticprivate

Definition at line 201 of file indexing_suite.hpp.

Referenced by boost::python::indexing_suite< Container, DerivedPolicies, NoProxy >::visit().

202  {
203  if (PySlice_Check(i))
204  return slice_handler::base_get_slice(
205  container.get(), reinterpret_cast<PySliceObject*>(i));
206 
207  return proxy_handler::base_get_item_(container, i);
208  }
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static object boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_get_item ( back_reference< Container & >  container,
PyObject *  i 
)
inlinestaticprivate

Definition at line 201 of file indexing_suite.hpp.

202  {
203  if (PySlice_Check(i))
204  return slice_handler::base_get_slice(
205  container.get(), reinterpret_cast<PySliceObject*>(i));
206 
207  return proxy_handler::base_get_item_(container, i);
208  }
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static void boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_set_item ( Container &  container,
PyObject *  i,
PyObject *  v 
)
inlinestaticprivate

Definition at line 211 of file indexing_suite.hpp.

Referenced by boost::python::indexing_suite< Container, DerivedPolicies, NoProxy >::visit().

212  {
213  if (PySlice_Check(i))
214  {
215  slice_handler::base_set_slice(container,
216  reinterpret_cast<PySliceObject*>(i), v);
217  }
218  else
219  {
220  extract<Data&> elem(v);
221  // try if elem is an exact Data
222  if (elem.check())
223  {
224  DerivedPolicies::
225  set_item(container,
226  DerivedPolicies::
227  convert_index(container, i), elem());
228  }
229  else
230  {
231  // try to convert elem to Data
232  extract<Data> elem(v);
233  if (elem.check())
234  {
235  DerivedPolicies::
236  set_item(container,
237  DerivedPolicies::
238  convert_index(container, i), elem());
239  }
240  else
241  {
242  PyErr_SetString(PyExc_TypeError, "Invalid assignment");
243  throw_error_already_set();
244  }
245  }
246  }
247  }
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static void boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_set_item ( Container &  container,
PyObject *  i,
PyObject *  v 
)
inlinestaticprivate

Definition at line 211 of file indexing_suite.hpp.

212  {
213  if (PySlice_Check(i))
214  {
215  slice_handler::base_set_slice(container,
216  reinterpret_cast<PySliceObject*>(i), v);
217  }
218  else
219  {
220  extract<Data&> elem(v);
221  // try if elem is an exact Data
222  if (elem.check())
223  {
224  DerivedPolicies::
225  set_item(container,
226  DerivedPolicies::
227  convert_index(container, i), elem());
228  }
229  else
230  {
231  // try to convert elem to Data
232  extract<Data> elem(v);
233  if (elem.check())
234  {
235  DerivedPolicies::
236  set_item(container,
237  DerivedPolicies::
238  convert_index(container, i), elem());
239  }
240  else
241  {
242  PyErr_SetString(PyExc_TypeError, "Invalid assignment");
243  throw_error_already_set();
244  }
245  }
246  }
247  }
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static size_t boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_size ( Container &  container)
inlinestaticprivate

Definition at line 265 of file indexing_suite.hpp.

266  {
268  }
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
static size_t boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::base_size ( Container &  container)
inlinestaticprivate

Definition at line 265 of file indexing_suite.hpp.

Referenced by boost::python::indexing_suite< Container, DerivedPolicies, NoProxy >::visit().

266  {
268  }
::xsd::cxx::tree::type container
Definition: Database.h:112
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
template<class Class >
static void boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::extension_def ( Class &  cl)
inlinestatic

Definition at line 192 of file indexing_suite.hpp.

193  {
194  // default.
195  // no more extensions
196  }
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
template<class Class >
static void boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::extension_def ( Class &  cl)
inlinestatic

Definition at line 192 of file indexing_suite.hpp.

193  {
194  // default.
195  // no more extensions
196  }
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
template<class Class >
void boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::visit ( Class &  cl) const
inline

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  }
static object base_get_item(back_reference< Container & > container, PyObject *i)
static size_t base_size(Container &container)
static void base_set_item(Container &container, PyObject *i, PyObject *v)
static void base_delete_item(Container &container, PyObject *i)
mpl::if_< no_proxy, iterator< Container >, iterator< Container, return_policy > >::type def_iterator
static bool base_contains(Container &container, PyObject *key)
template<class Container, class DerivedPolicies, bool NoProxy = false, bool NoSlice = false, class Data = typename Container::value_type, class Index = typename Container::size_type, class Key = typename Container::value_type>
template<class Class >
void boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, NoSlice, Data, Index, Key >::visit ( Class &  cl) const
inline

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  }
static object base_get_item(back_reference< Container & > container, PyObject *i)
static size_t base_size(Container &container)
static void base_set_item(Container &container, PyObject *i, PyObject *v)
static void base_delete_item(Container &container, PyObject *i)
mpl::if_< no_proxy, iterator< Container >, iterator< Container, return_policy > >::type def_iterator
static bool base_contains(Container &container, PyObject *key)

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