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

#include "map_indexing_suite.hpp"

Inheritance diagram for boost::python::detail::final_map_derived_policies< Container, NoProxy >:
boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > > boost::python::indexing_suite< Container, final_map_derived_policies< Container, NoProxy >, NoProxy, true, Container::value_type::second_type, Container::key_type, Container::key_type >

Public Types

typedef Container::value_type value_type
 
typedef Container::value_type::second_type data_type
 
typedef Container::key_type key_type
 
typedef Container::key_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 object print_elem (typename Container::value_type const &e)
 
static mpl::if_< is_class< data_type >, data_type &, data_type >::type get_data (typename Container::value_type &e)
 
static Container::key_type get_key (typename Container::value_type &e)
 
static data_typeget_item (Container &container, index_type i_)
 
static void set_item (Container &container, index_type i, data_type const &v)
 
static void delete_item (Container &container, index_type i)
 
static size_t size (Container &container)
 
static bool contains (Container &container, key_type const &key)
 
static bool compare_index (Container &container, index_type a, index_type b)
 
static index_type convert_index (Container &container, PyObject *i_)
 

Detailed Description

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

Definition at line 23 of file map_indexing_suite.hpp.

Member Typedef Documentation

typedef Container::value_type::second_type boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::data_type
inherited

Definition at line 63 of file map_indexing_suite.hpp.

typedef Container::difference_type boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::difference_type
inherited

Definition at line 67 of file map_indexing_suite.hpp.

typedef Container::key_type boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::index_type
inherited

Definition at line 65 of file map_indexing_suite.hpp.

typedef Container::key_type boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::key_type
inherited

Definition at line 64 of file map_indexing_suite.hpp.

typedef Container::size_type boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::size_type
inherited

Definition at line 66 of file map_indexing_suite.hpp.

typedef Container::value_type boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::value_type
inherited

Definition at line 62 of file map_indexing_suite.hpp.

Member Function Documentation

static bool boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::compare_index ( Container &  container,
index_type  a,
index_type  b 
)
inlinestaticinherited

Definition at line 153 of file map_indexing_suite.hpp.

154  {
155  return container.key_comp()(a, b);
156  }
static bool boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::contains ( Container &  container,
key_type const &  key 
)
inlinestaticinherited

Definition at line 147 of file map_indexing_suite.hpp.

148  {
149  return container.find(key) != container.end();
150  }
static index_type boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::convert_index ( Container &  container,
PyObject *  i_ 
)
inlinestaticinherited

Definition at line 159 of file map_indexing_suite.hpp.

160  {
161  extract<key_type const&> i(i_);
162  if (i.check())
163  {
164  return i();
165  }
166  else
167  {
168  extract<key_type> i(i_);
169  if (i.check())
170  return i();
171  }
172 
173  PyErr_SetString(PyExc_TypeError, "Invalid index type");
174  throw_error_already_set();
175  return index_type();
176  }
static void boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::delete_item ( Container &  container,
index_type  i 
)
inlinestaticinherited

Definition at line 135 of file map_indexing_suite.hpp.

136  {
137  container.erase(i);
138  }
static void boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::extension_def ( Class &  cl)
inlinestaticinherited

Definition at line 71 of file map_indexing_suite.hpp.

72  {
73  // Wrap the map's element (value_type)
74  std::string elem_name = "map_indexing_suite_";
75  object class_name(cl.attr("__name__"));
76  extract<std::string> class_name_extractor(class_name);
77  elem_name += class_name_extractor();
78  elem_name += "_entry";
79 
80  typedef typename mpl::if_<
81  is_class<data_type>
82  , return_internal_reference<>
83  , default_call_policies
84  >::type get_data_return_policy;
85 
86  class_<value_type>(elem_name.c_str())
87  .def("__repr__", &DerivedPolicies::print_elem)
88  .def("data", &DerivedPolicies::get_data, get_data_return_policy())
89  .def("key", &DerivedPolicies::get_key)
90  ;
91  }
static mpl::if_< is_class<data_type> , data_type& , data_type >::type boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::get_data ( typename Container::value_type &  e)
inlinestaticinherited

Definition at line 105 of file map_indexing_suite.hpp.

106  {
107  return e.second;
108  }
Float_t e
Definition: plot.C:35
static data_type& boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::get_item ( Container &  container,
index_type  i_ 
)
inlinestaticinherited

Definition at line 117 of file map_indexing_suite.hpp.

118  {
119  typename Container::iterator i = container.find(i_);
120  if (i == container.end())
121  {
122  PyErr_SetString(PyExc_KeyError, "Invalid key");
123  throw_error_already_set();
124  }
125  return i->second;
126  }
intermediate_table::iterator iterator
static Container::key_type boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::get_key ( typename Container::value_type &  e)
inlinestaticinherited

Definition at line 111 of file map_indexing_suite.hpp.

112  {
113  return e.first;
114  }
Float_t e
Definition: plot.C:35
static object boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::print_elem ( typename Container::value_type const &  e)
inlinestaticinherited

Definition at line 94 of file map_indexing_suite.hpp.

95  {
96  return "(%s, %s)" % python::make_tuple(e.first, e.second);
97  }
Float_t e
Definition: plot.C:35
static void boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::set_item ( Container &  container,
index_type  i,
data_type const &  v 
)
inlinestaticinherited

Definition at line 129 of file map_indexing_suite.hpp.

130  {
131  container[i] = v;
132  }
static size_t boost::python::map_indexing_suite< Container, NoProxy, final_map_derived_policies< Container, NoProxy > >::size ( Container &  container)
inlinestaticinherited

Definition at line 141 of file map_indexing_suite.hpp.

142  {
143  return container.size();
144  }
void boost::python::indexing_suite< Container, final_map_derived_policies< Container, NoProxy > , NoProxy, NoSlice, Container::value_type::second_type , Container::key_type , Container::key_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  }

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