Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Static Public Member Functions
boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies > Class Template Reference

#include <map_indexing_suite.hpp>

Inheritance diagram for boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >:
boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, true, Container::value_type::second_type, Container::key_type, Container::key_type > boost::python::indexing_suite< Container, DerivedPolicies, 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
 
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
 

Static Public Member Functions

template<class Class >
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_)
 
template<class Class >
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_)
 
- Static Public Member Functions inherited from boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, true, Container::value_type::second_type, Container::key_type, Container::key_type >
static void extension_def (Class &cl)
 
static void extension_def (Class &cl)
 

Additional Inherited Members

- Public Member Functions inherited from boost::python::indexing_suite< Container, DerivedPolicies, NoProxy, true, Container::value_type::second_type, Container::key_type, Container::key_type >
void visit (Class &cl) const
 
void visit (Class &cl) const
 

Detailed Description

template<class Container, bool NoProxy, class DerivedPolicies>
class boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >

Definition at line 18 of file source/boost/map_indexing_suite.hpp.

Member Typedef Documentation

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::value_type::second_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::data_type

Definition at line 63 of file source/boost/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::value_type::second_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::data_type

Definition at line 63 of file tests/test12/include/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::difference_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::difference_type

Definition at line 67 of file source/boost/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::difference_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::difference_type

Definition at line 67 of file tests/test12/include/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::key_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::index_type

Definition at line 65 of file source/boost/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::key_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::index_type

Definition at line 65 of file tests/test12/include/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::key_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::key_type

Definition at line 64 of file source/boost/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::key_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::key_type

Definition at line 64 of file tests/test12/include/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::size_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::size_type

Definition at line 66 of file tests/test12/include/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::size_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::size_type

Definition at line 66 of file source/boost/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::value_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::value_type

Definition at line 62 of file source/boost/map_indexing_suite.hpp.

template<class Container, bool NoProxy, class DerivedPolicies>
typedef Container::value_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::value_type

Definition at line 62 of file tests/test12/include/map_indexing_suite.hpp.

Member Function Documentation

template<class Container, bool NoProxy, class DerivedPolicies>
static bool boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::compare_index ( Container &  container,
index_type  a,
index_type  b 
)
inlinestatic

Definition at line 153 of file source/boost/map_indexing_suite.hpp.

154  {
155  return container.key_comp()(a, b);
156  }
template<class Container, bool NoProxy, class DerivedPolicies>
static bool boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::compare_index ( Container &  container,
index_type  a,
index_type  b 
)
inlinestatic

Definition at line 153 of file tests/test12/include/map_indexing_suite.hpp.

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

Definition at line 147 of file source/boost/map_indexing_suite.hpp.

148  {
149  return container.find(key) != container.end();
150  }
template<class Container, bool NoProxy, class DerivedPolicies>
static bool boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::contains ( Container &  container,
key_type const &  key 
)
inlinestatic

Definition at line 147 of file tests/test12/include/map_indexing_suite.hpp.

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

Definition at line 159 of file source/boost/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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static index_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::convert_index ( Container &  container,
PyObject *  i_ 
)
inlinestatic

Definition at line 159 of file tests/test12/include/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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::delete_item ( Container &  container,
index_type  i 
)
inlinestatic

Definition at line 135 of file tests/test12/include/map_indexing_suite.hpp.

136  {
137  container.erase(i);
138  }
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::delete_item ( Container &  container,
index_type  i 
)
inlinestatic

Definition at line 135 of file source/boost/map_indexing_suite.hpp.

136  {
137  container.erase(i);
138  }
template<class Container, bool NoProxy, class DerivedPolicies>
template<class Class >
static void boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::extension_def ( Class &  cl)
inlinestatic

Definition at line 71 of file source/boost/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  }
template<class Container, bool NoProxy, class DerivedPolicies>
template<class Class >
static void boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::extension_def ( Class &  cl)
inlinestatic

Definition at line 71 of file tests/test12/include/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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static mpl::if_< is_class<data_type> , data_type& , data_type >::type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::get_data ( typename Container::value_type &  e)
inlinestatic

Definition at line 105 of file tests/test12/include/map_indexing_suite.hpp.

106  {
107  return e.second;
108  }
template<class Container, bool NoProxy, class DerivedPolicies>
static mpl::if_< is_class<data_type> , data_type& , data_type >::type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::get_data ( typename Container::value_type &  e)
inlinestatic

Definition at line 105 of file source/boost/map_indexing_suite.hpp.

106  {
107  return e.second;
108  }
template<class Container, bool NoProxy, class DerivedPolicies>
static data_type& boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::get_item ( Container &  container,
index_type  i_ 
)
inlinestatic

Definition at line 117 of file tests/test12/include/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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static data_type& boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::get_item ( Container &  container,
index_type  i_ 
)
inlinestatic

Definition at line 117 of file source/boost/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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static Container::key_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::get_key ( typename Container::value_type &  e)
inlinestatic

Definition at line 111 of file source/boost/map_indexing_suite.hpp.

112  {
113  return e.first;
114  }
template<class Container, bool NoProxy, class DerivedPolicies>
static Container::key_type boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::get_key ( typename Container::value_type &  e)
inlinestatic

Definition at line 111 of file tests/test12/include/map_indexing_suite.hpp.

112  {
113  return e.first;
114  }
template<class Container, bool NoProxy, class DerivedPolicies>
static object boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::print_elem ( typename Container::value_type const &  e)
inlinestatic

Definition at line 94 of file source/boost/map_indexing_suite.hpp.

95  {
96  return "(%s, %s)" % python::make_tuple(e.first, e.second);
97  }
template<class Container, bool NoProxy, class DerivedPolicies>
static object boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::print_elem ( typename Container::value_type const &  e)
inlinestatic

Definition at line 94 of file tests/test12/include/map_indexing_suite.hpp.

95  {
96  return "(%s, %s)" % python::make_tuple(e.first, e.second);
97  }
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::set_item ( Container &  container,
index_type  i,
data_type const &  v 
)
inlinestatic

Definition at line 129 of file tests/test12/include/map_indexing_suite.hpp.

130  {
131  container[i] = v;
132  }
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::set_item ( Container &  container,
index_type  i,
data_type const &  v 
)
inlinestatic

Definition at line 129 of file source/boost/map_indexing_suite.hpp.

130  {
131  container[i] = v;
132  }
template<class Container, bool NoProxy, class DerivedPolicies>
static size_t boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::size ( Container &  container)
inlinestatic

Definition at line 141 of file source/boost/map_indexing_suite.hpp.

142  {
143  return container.size();
144  }
template<class Container, bool NoProxy, class DerivedPolicies>
static size_t boost::python::map_indexing_suite< Container, NoProxy, DerivedPolicies >::size ( Container &  container)
inlinestatic

Definition at line 141 of file tests/test12/include/map_indexing_suite.hpp.

142  {
143  return container.size();
144  }

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