Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies > Class Template Reference

#include <vector_indexing_suite.hpp>

Inheritance diagram for boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >:
Collaboration diagram for boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >:

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
 
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
 

Static Public Member Functions

template<class Class >
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)
 
template<class Iter >
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)
 
template<class Iter >
static void extend (Container &container, Iter first, Iter last)
 
template<class Class >
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)
 
template<class Iter >
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)
 
template<class Iter >
static void extend (Container &container, Iter first, Iter last)
 
- Static Public Member Functions inherited from boost::python::indexing_suite< Container, DerivedPolicies, NoProxy >
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 >
void visit (Class &cl) const
 
void visit (Class &cl) const
 

Detailed Description

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

Definition at line 17 of file vector_indexing_suite.hpp.

Member Typedef Documentation

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

Definition at line 53 of file vector_indexing_suite.hpp.

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

Definition at line 53 of file vector_indexing_suite.hpp.

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

Definition at line 57 of file vector_indexing_suite.hpp.

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

Definition at line 57 of file vector_indexing_suite.hpp.

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

Definition at line 55 of file vector_indexing_suite.hpp.

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

Definition at line 55 of file vector_indexing_suite.hpp.

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

Definition at line 54 of file vector_indexing_suite.hpp.

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

Definition at line 54 of file vector_indexing_suite.hpp.

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

Definition at line 56 of file vector_indexing_suite.hpp.

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

Definition at line 56 of file vector_indexing_suite.hpp.

Member Function Documentation

template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::append ( Container &  container,
data_type const &  v 
)
inlinestatic

Definition at line 192 of file vector_indexing_suite.hpp.

193  {
194  container.push_back(v);
195  }
tuple v
Definition: test.py:18
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::append ( Container &  container,
data_type const &  v 
)
inlinestatic

Definition at line 192 of file vector_indexing_suite.hpp.

193  {
194  container.push_back(v);
195  }
tuple v
Definition: test.py:18
template<class Container, bool NoProxy, class DerivedPolicies>
static bool boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::compare_index ( Container &  container,
index_type  a,
index_type  b 
)
inlinestatic

Definition at line 164 of file vector_indexing_suite.hpp.

165  {
166  return a < b;
167  }
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
tuple b
Definition: test.py:12
template<class Container, bool NoProxy, class DerivedPolicies>
static bool boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::compare_index ( Container &  container,
index_type  a,
index_type  b 
)
inlinestatic

Definition at line 164 of file vector_indexing_suite.hpp.

165  {
166  return a < b;
167  }
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
tuple b
Definition: test.py:12
template<class Container, bool NoProxy, class DerivedPolicies>
static bool boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::contains ( Container &  container,
key_type const &  key 
)
inlinestatic

Definition at line 145 of file vector_indexing_suite.hpp.

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

Definition at line 145 of file vector_indexing_suite.hpp.

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

Definition at line 170 of file vector_indexing_suite.hpp.

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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static index_type boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::convert_index ( Container &  container,
PyObject *  i_ 
)
inlinestatic

Definition at line 170 of file vector_indexing_suite.hpp.

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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::delete_item ( Container &  container,
index_type  i 
)
inlinestatic

Definition at line 123 of file vector_indexing_suite.hpp.

124  {
125  container.erase(container.begin()+i);
126  }
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::delete_item ( Container &  container,
index_type  i 
)
inlinestatic

Definition at line 123 of file vector_indexing_suite.hpp.

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

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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::delete_slice ( Container &  container,
index_type  from,
index_type  to 
)
inlinestatic

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  }
template<class Container, bool NoProxy, class DerivedPolicies>
template<class Iter >
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::extend ( Container &  container,
Iter  first,
Iter  last 
)
inlinestatic

Definition at line 199 of file vector_indexing_suite.hpp.

200  {
201  container.insert(container.end(), first, last);
202  }
template<class Container, bool NoProxy, class DerivedPolicies>
template<class Iter >
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::extend ( Container &  container,
Iter  first,
Iter  last 
)
inlinestatic

Definition at line 199 of file vector_indexing_suite.hpp.

200  {
201  container.insert(container.end(), first, last);
202  }
template<class Container, bool NoProxy, class DerivedPolicies>
template<class Class >
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::extension_def ( Class &  cl)
inlinestatic

Definition at line 61 of file vector_indexing_suite.hpp.

62  {
63  cl
64  .def("append", &base_append)
65  .def("push_back", &base_append)
66  .def("extend", &base_extend)
67  ;
68  }
template<class Container, bool NoProxy, class DerivedPolicies>
template<class Class >
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::extension_def ( Class &  cl)
inlinestatic

Definition at line 61 of file vector_indexing_suite.hpp.

62  {
63  cl
64  .def("append", &base_append)
65  .def("push_back", &base_append)
66  .def("extend", &base_extend)
67  ;
68  }
template<class Container, bool NoProxy, class DerivedPolicies>
static mpl::if_< is_class<data_type> , data_type& , data_type >::type boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::get_item ( Container &  container,
index_type  i 
)
inlinestatic

Definition at line 76 of file vector_indexing_suite.hpp.

77  {
78  return container[i];
79  }
template<class Container, bool NoProxy, class DerivedPolicies>
static mpl::if_< is_class<data_type> , data_type& , data_type >::type boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::get_item ( Container &  container,
index_type  i 
)
inlinestatic

Definition at line 76 of file vector_indexing_suite.hpp.

77  {
78  return container[i];
79  }
template<class Container, bool NoProxy, class DerivedPolicies>
static index_type boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::get_max_index ( Container &  container)
inlinestatic

Definition at line 158 of file vector_indexing_suite.hpp.

159  {
160  return container.size();
161  }
template<class Container, bool NoProxy, class DerivedPolicies>
static index_type boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::get_max_index ( Container &  container)
inlinestatic

Definition at line 158 of file vector_indexing_suite.hpp.

159  {
160  return container.size();
161  }
template<class Container, bool NoProxy, class DerivedPolicies>
static index_type boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::get_min_index ( Container &  container)
inlinestatic

Definition at line 152 of file vector_indexing_suite.hpp.

153  {
154  return 0;
155  }
template<class Container, bool NoProxy, class DerivedPolicies>
static index_type boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::get_min_index ( Container &  container)
inlinestatic

Definition at line 152 of file vector_indexing_suite.hpp.

153  {
154  return 0;
155  }
template<class Container, bool NoProxy, class DerivedPolicies>
static object boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::get_slice ( Container &  container,
index_type  from,
index_type  to 
)
inlinestatic

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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static object boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::get_slice ( Container &  container,
index_type  from,
index_type  to 
)
inlinestatic

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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::set_item ( Container &  container,
index_type  i,
data_type const &  v 
)
inlinestatic

Definition at line 90 of file vector_indexing_suite.hpp.

91  {
92  container[i] = v;
93  }
tuple v
Definition: test.py:18
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::set_item ( Container &  container,
index_type  i,
data_type const &  v 
)
inlinestatic

Definition at line 90 of file vector_indexing_suite.hpp.

91  {
92  container[i] = v;
93  }
tuple v
Definition: test.py:18
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::set_slice ( Container &  container,
index_type  from,
index_type  to,
data_type const &  v 
)
inlinestatic

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  }
tuple v
Definition: test.py:18
template<class Container, bool NoProxy, class DerivedPolicies>
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::set_slice ( Container &  container,
index_type  from,
index_type  to,
data_type const &  v 
)
inlinestatic

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  }
tuple v
Definition: test.py:18
template<class Container, bool NoProxy, class DerivedPolicies>
template<class Iter >
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::set_slice ( Container &  container,
index_type  from,
index_type  to,
Iter  first,
Iter  last 
)
inlinestatic

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  }
template<class Container, bool NoProxy, class DerivedPolicies>
template<class Iter >
static void boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::set_slice ( Container &  container,
index_type  from,
index_type  to,
Iter  first,
Iter  last 
)
inlinestatic

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  }
template<class Container, bool NoProxy, class DerivedPolicies>
static size_t boost::python::vector_indexing_suite< Container, NoProxy, DerivedPolicies >::size ( Container &  container)
inlinestatic

Definition at line 139 of file vector_indexing_suite.hpp.

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

Definition at line 139 of file vector_indexing_suite.hpp.

140  {
141  return container.size();
142  }

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