Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions
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 source/boost/detail/indexing_suite_detail.hpp.

Member Typedef Documentation

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

Member Function Documentation

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

Definition at line 89 of file source/boost/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::first_proxy().

90  {
92  // Add a proxy
93  proxies.insert(
94  first_proxy(extract<Proxy&>(prox)().get_index()), prox);
96  }
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::add ( PyObject *  prox)
inline
template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  i,
mpl::false_   
)
inline

Definition at line 99 of file source/boost/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::replace().

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)
template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  i,
mpl::false_   
)
inline

Definition at line 99 of file tests/test12/include/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::replace().

100  {
102  // Erase the proxy with index i
103  replace(i, i+1, 0);
105  }
void replace(index_type from, index_type to, typename std::vector< PyObject * >::size_type len)
template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  i,
mpl::true_   
)
inline

Definition at line 108 of file source/boost/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::first_proxy().

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
template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  i,
mpl::true_   
)
inline

Definition at line 108 of file tests/test12/include/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::first_proxy().

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
template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  from,
index_type  to 
)
inline

Definition at line 126 of file source/boost/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::replace().

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)
template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::erase ( index_type  from,
index_type  to 
)
inline

Definition at line 126 of file tests/test12/include/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::replace().

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  }
void replace(index_type from, index_type to, typename std::vector< PyObject * >::size_type len)
template<class Proxy >
PyObject* boost::python::detail::proxy_group< Proxy >::find ( index_type  i)
inline

Definition at line 186 of file source/boost/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::first_proxy().

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
template<class Proxy >
PyObject* boost::python::detail::proxy_group< Proxy >::find ( index_type  i)
inline

Definition at line 186 of file tests/test12/include/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::first_proxy().

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  }
template<class Proxy >
iterator boost::python::detail::proxy_group< Proxy >::first_proxy ( index_type  i)
inline

Definition at line 64 of file tests/test12/include/detail/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 source/boost/detail/indexing_suite_detail.hpp.

Referenced by boost::python::detail::proxy_group< Proxy >::add(), boost::python::detail::proxy_group< Proxy >::erase(), boost::python::detail::proxy_group< Proxy >::find(), boost::python::detail::proxy_group< Proxy >::remove(), and boost::python::detail::proxy_group< Proxy >::replace().

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 >
void boost::python::detail::proxy_group< Proxy >::remove ( Proxy &  proxy)
inline

Definition at line 73 of file tests/test12/include/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::first_proxy().

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  }
template<class Proxy >
void boost::python::detail::proxy_group< Proxy >::remove ( Proxy &  proxy)
inline

Definition at line 73 of file source/boost/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, and boost::python::detail::proxy_group< Proxy >::first_proxy().

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
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 tests/test12/include/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, boost::python::detail::proxy_group< Proxy >::first_proxy(), left, and right.

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 char * p
Definition: xmltok.h:285
const XML_Char int len
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 source/boost/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT, boost::python::detail::proxy_group< Proxy >::first_proxy(), left, and right.

Referenced by boost::python::detail::proxy_group< Proxy >::erase().

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 char * p
Definition: xmltok.h:285
#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT
const XML_Char int len
template<class Proxy >
std::vector<PyObject*>::size_type boost::python::detail::proxy_group< Proxy >::size ( ) const
inline

Definition at line 204 of file source/boost/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT.

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 tests/test12/include/detail/indexing_suite_detail.hpp.

References BOOST_PYTHON_INDEXING_CHECK_INVARIANT.

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

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