Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
boost::python::detail::proxy_group< Proxy > Class Template Reference

#include <indexing_suite_detail.hpp>

Public Types

typedef std::vector< PyObject * >
::const_iterator 
const_iterator
 
typedef std::vector< PyObject * >
::iterator 
iterator
 
typedef Proxy::index_type index_type
 
typedef Proxy::policies_type policies_type
 
typedef std::vector< PyObject * >
::const_iterator 
const_iterator
 
typedef std::vector< PyObject * >
::iterator 
iterator
 
typedef Proxy::index_type index_type
 
typedef Proxy::policies_type policies_type
 

Public Member Functions

iterator first_proxy (index_type i)
 
void remove (Proxy &proxy)
 
void add (PyObject *prox)
 
void erase (index_type i, mpl::false_)
 
void erase (index_type i, mpl::true_)
 
void erase (index_type from, index_type to)
 
void replace (index_type from, index_type to, typename std::vector< PyObject * >::size_type len)
 
PyObject * find (index_type i)
 
std::vector< PyObject * >
::size_type 
size () const
 
iterator first_proxy (index_type i)
 
void remove (Proxy &proxy)
 
void add (PyObject *prox)
 
void erase (index_type i, mpl::false_)
 
void erase (index_type i, mpl::true_)
 
void erase (index_type from, index_type to)
 
void replace (index_type from, index_type to, typename std::vector< PyObject * >::size_type len)
 
PyObject * find (index_type i)
 
std::vector< PyObject * >
::size_type 
size () const
 

Detailed Description

template<class Proxy>
class boost::python::detail::proxy_group< Proxy >

Definition at line 54 of file indexing_suite_detail.hpp.

Member Typedef Documentation

template<class Proxy >
typedef std::vector<PyObject*>::const_iterator boost::python::detail::proxy_group< Proxy >::const_iterator

Definition at line 58 of file indexing_suite_detail.hpp.

template<class Proxy >
typedef std::vector<PyObject*>::const_iterator boost::python::detail::proxy_group< Proxy >::const_iterator

Definition at line 58 of file indexing_suite_detail.hpp.

template<class Proxy >
typedef Proxy::index_type boost::python::detail::proxy_group< Proxy >::index_type

Definition at line 60 of file indexing_suite_detail.hpp.

template<class Proxy >
typedef Proxy::index_type boost::python::detail::proxy_group< Proxy >::index_type

Definition at line 60 of file indexing_suite_detail.hpp.

template<class Proxy >
typedef std::vector<PyObject*>::iterator boost::python::detail::proxy_group< Proxy >::iterator

Definition at line 59 of file indexing_suite_detail.hpp.

template<class Proxy >
typedef std::vector<PyObject*>::iterator boost::python::detail::proxy_group< Proxy >::iterator

Definition at line 59 of file indexing_suite_detail.hpp.

template<class Proxy >
typedef Proxy::policies_type boost::python::detail::proxy_group< Proxy >::policies_type

Definition at line 61 of file indexing_suite_detail.hpp.

template<class Proxy >
typedef Proxy::policies_type boost::python::detail::proxy_group< Proxy >::policies_type

Definition at line 61 of file indexing_suite_detail.hpp.

Member Function Documentation

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::add ( PyObject *  prox)
inline

Definition at line 89 of file indexing_suite_detail.hpp.

90  {
92  // Add a proxy
93  proxies.insert(
94  first_proxy(extract<Proxy&>(prox)().get_index()), prox);
96  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::add ( PyObject *  prox)
inline

Definition at line 89 of file indexing_suite_detail.hpp.

90  {
92  // Add a proxy
93  proxies.insert(
94  first_proxy(extract<Proxy&>(prox)().get_index()), prox);
96  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  i,
mpl::false_   
)
inline

Definition at line 99 of file indexing_suite_detail.hpp.

100  {
102  // Erase the proxy with index i
103  replace(i, i+1, 0);
105  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
void replace(index_type from, index_type to, typename std::vector< PyObject * >::size_type len)

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  i,
mpl::false_   
)
inline

Definition at line 99 of file indexing_suite_detail.hpp.

100  {
102  // Erase the proxy with index i
103  replace(i, i+1, 0);
105  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
void replace(index_type from, index_type to, typename std::vector< PyObject * >::size_type len)

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  i,
mpl::true_   
)
inline

Definition at line 108 of file indexing_suite_detail.hpp.

109  {
111  // Erase the proxy with index i
112 
113  iterator iter = first_proxy(i);
114  extract<Proxy&> p(*iter);
115 
116  if (iter != proxies.end() && p().get_index() == i)
117  {
118  extract<Proxy&> p(*iter);
119  p().detach();
120  proxies.erase(iter);
121  }
123  }
const char * p
Definition: xmltok.h:285
std::vector< PyObject * >::iterator iterator
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  i,
mpl::true_   
)
inline

Definition at line 108 of file indexing_suite_detail.hpp.

109  {
111  // Erase the proxy with index i
112 
113  iterator iter = first_proxy(i);
114  extract<Proxy&> p(*iter);
115 
116  if (iter != proxies.end() && p().get_index() == i)
117  {
118  extract<Proxy&> p(*iter);
119  p().detach();
120  proxies.erase(iter);
121  }
123  }
const char * p
Definition: xmltok.h:285
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
std::vector< PyObject * >::iterator iterator

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  from,
index_type  to 
)
inline

Definition at line 126 of file indexing_suite_detail.hpp.

127  {
128  // note: this cannot be called when container is not sliceable
129 
131  // Erase all proxies with indexes from..to
132  replace(from, to, 0);
134  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
void replace(index_type from, index_type to, typename std::vector< PyObject * >::size_type len)

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  from,
index_type  to 
)
inline

Definition at line 126 of file indexing_suite_detail.hpp.

127  {
128  // note: this cannot be called when container is not sliceable
129 
131  // Erase all proxies with indexes from..to
132  replace(from, to, 0);
134  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
void replace(index_type from, index_type to, typename std::vector< PyObject * >::size_type len)

Here is the call graph for this function:

template<class Proxy >
PyObject* boost::python::detail::proxy_group< Proxy >::find ( index_type  i)
inline

Definition at line 186 of file indexing_suite_detail.hpp.

187  {
189  // Find the proxy with *exact* index i.
190  // Return 0 (null) if no proxy with the
191  // given index is found.
192  iterator iter = first_proxy(i);
193  if (iter != proxies.end()
194  && extract<Proxy&>(*iter)().get_index() == i)
195  {
197  return *iter;
198  }
200  return 0;
201  }
std::vector< PyObject * >::iterator iterator
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT

Here is the call graph for this function:

template<class Proxy >
PyObject* boost::python::detail::proxy_group< Proxy >::find ( index_type  i)
inline

Definition at line 186 of file indexing_suite_detail.hpp.

187  {
189  // Find the proxy with *exact* index i.
190  // Return 0 (null) if no proxy with the
191  // given index is found.
192  iterator iter = first_proxy(i);
193  if (iter != proxies.end()
194  && extract<Proxy&>(*iter)().get_index() == i)
195  {
197  return *iter;
198  }
200  return 0;
201  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
std::vector< PyObject * >::iterator iterator

Here is the call graph for this function:

template<class Proxy >
iterator boost::python::detail::proxy_group< Proxy >::first_proxy ( index_type  i)
inline

Definition at line 64 of file indexing_suite_detail.hpp.

65  {
66  // Return the first proxy with index <= i
67  return boost::detail::lower_bound(
68  proxies.begin(), proxies.end(),
69  i, compare_proxy_index<Proxy>());
70  }
template<class Proxy >
iterator boost::python::detail::proxy_group< Proxy >::first_proxy ( index_type  i)
inline

Definition at line 64 of file indexing_suite_detail.hpp.

65  {
66  // Return the first proxy with index <= i
67  return boost::detail::lower_bound(
68  proxies.begin(), proxies.end(),
69  i, compare_proxy_index<Proxy>());
70  }

Here is the caller graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::remove ( Proxy &  proxy)
inline

Definition at line 73 of file indexing_suite_detail.hpp.

74  {
75  // Remove a proxy
76  for (iterator iter = first_proxy(proxy.get_index());
77  iter != proxies.end(); ++iter)
78  {
79  if (&extract<Proxy&>(*iter)() == &proxy)
80  {
81  proxies.erase(iter);
82  break;
83  }
84  }
86  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
std::vector< PyObject * >::iterator iterator

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::remove ( Proxy &  proxy)
inline

Definition at line 73 of file indexing_suite_detail.hpp.

74  {
75  // Remove a proxy
76  for (iterator iter = first_proxy(proxy.get_index());
77  iter != proxies.end(); ++iter)
78  {
79  if (&extract<Proxy&>(*iter)() == &proxy)
80  {
81  proxies.erase(iter);
82  break;
83  }
84  }
86  }
std::vector< PyObject * >::iterator iterator
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::replace ( index_type  from,
index_type  to,
typename std::vector< PyObject * >::size_type  len 
)
inline

Definition at line 137 of file indexing_suite_detail.hpp.

141  {
142  // note: this cannot be called when container is not sliceable
143 
145  // Erase all proxies with indexes from..to.
146  // Adjust the displaced indexes such that the
147  // final effect is that we have inserted *len*
148  // number of proxies in the vacated region. This
149  // procedure involves adjusting the indexes of
150  // the proxies.
151 
152  iterator left = first_proxy(from);
153  iterator right = proxies.end(); // we'll adjust this later
154 
155  for (iterator iter = left; iter != right; ++iter)
156  {
157  if (extract<Proxy&>(*iter)().get_index() > to)
158  {
159  right = iter; // adjust right
160  break;
161  }
162  extract<Proxy&> p(*iter);
163  p().detach();
164  }
165 
166  typename std::vector<PyObject*>::size_type
167  offset = left-proxies.begin();
168  proxies.erase(left, right);
169  right = proxies.begin()+offset;
170 
171  while (right != proxies.end())
172  {
173  typedef typename Proxy::container_type::difference_type difference_type;
174  extract<Proxy&> p(*right);
175  p().set_index(
176  extract<Proxy&>(*right)().get_index()
177  - (difference_type(to) - from - len)
178  );
179 
180  ++right;
181  }
183  }
const XML_Char int len
Definition: expat.h:262
const char * p
Definition: xmltok.h:285
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
std::vector< PyObject * >::iterator iterator

Here is the call graph for this function:

template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::replace ( index_type  from,
index_type  to,
typename std::vector< PyObject * >::size_type  len 
)
inline

Definition at line 137 of file indexing_suite_detail.hpp.

141  {
142  // note: this cannot be called when container is not sliceable
143 
145  // Erase all proxies with indexes from..to.
146  // Adjust the displaced indexes such that the
147  // final effect is that we have inserted *len*
148  // number of proxies in the vacated region. This
149  // procedure involves adjusting the indexes of
150  // the proxies.
151 
152  iterator left = first_proxy(from);
153  iterator right = proxies.end(); // we'll adjust this later
154 
155  for (iterator iter = left; iter != right; ++iter)
156  {
157  if (extract<Proxy&>(*iter)().get_index() > to)
158  {
159  right = iter; // adjust right
160  break;
161  }
162  extract<Proxy&> p(*iter);
163  p().detach();
164  }
165 
166  typename std::vector<PyObject*>::size_type
167  offset = left-proxies.begin();
168  proxies.erase(left, right);
169  right = proxies.begin()+offset;
170 
171  while (right != proxies.end())
172  {
173  typedef typename Proxy::container_type::difference_type difference_type;
174  extract<Proxy&> p(*right);
175  p().set_index(
176  extract<Proxy&>(*right)().get_index()
177  - (difference_type(to) - from - len)
178  );
179 
180  ++right;
181  }
183  }
const XML_Char int len
Definition: expat.h:262
const char * p
Definition: xmltok.h:285
std::vector< PyObject * >::iterator iterator
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Proxy >
std::vector<PyObject*>::size_type boost::python::detail::proxy_group< Proxy >::size ( ) const
inline

Definition at line 204 of file indexing_suite_detail.hpp.

205  {
207  // How many proxies are there so far?
208  return proxies.size();
209  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
template<class Proxy >
std::vector<PyObject*>::size_type boost::python::detail::proxy_group< Proxy >::size ( ) const
inline

Definition at line 204 of file indexing_suite_detail.hpp.

205  {
207  // How many proxies are there so far?
208  return proxies.size();
209  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT

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