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

#include "indexing_suite_detail.hpp"

Public Types

typedef Index index_type
 
typedef Container container_type
 
typedef Policies::data_type element_type
 
typedef Policies policies_type
 
typedef container_element< Container, Index, Policies > self_t
 
typedef proxy_group< self_tlinks_type
 

Public Member Functions

 container_element (object container, Index index)
 
 container_element (container_element const &ce)
 
 ~container_element ()
 
element_typeoperator* () const
 
element_typeget () const
 
void detach ()
 
bool is_detached () const
 
Container & get_container () const
 
Index get_index () const
 
void set_index (Index i)
 

Static Public Member Functions

static proxy_links< self_t, Container > & get_links ()
 

Private Member Functions

container_elementoperator= (container_element const &ce)
 

Private Attributes

scoped_ptr< element_typeptr
 
object container
 
Index index
 

Detailed Description

template<class Container, class Index, class Policies>
class boost::python::detail::container_element< Container, Index, Policies >

Definition at line 352 of file indexing_suite_detail.hpp.

Member Typedef Documentation

template<class Container, class Index, class Policies>
typedef Container boost::python::detail::container_element< Container, Index, Policies >::container_type

Definition at line 357 of file indexing_suite_detail.hpp.

template<class Container, class Index, class Policies>
typedef Policies::data_type boost::python::detail::container_element< Container, Index, Policies >::element_type

Definition at line 358 of file indexing_suite_detail.hpp.

template<class Container, class Index, class Policies>
typedef Index boost::python::detail::container_element< Container, Index, Policies >::index_type

Definition at line 356 of file indexing_suite_detail.hpp.

template<class Container, class Index, class Policies>
typedef proxy_group<self_t> boost::python::detail::container_element< Container, Index, Policies >::links_type

Definition at line 361 of file indexing_suite_detail.hpp.

template<class Container, class Index, class Policies>
typedef Policies boost::python::detail::container_element< Container, Index, Policies >::policies_type

Definition at line 359 of file indexing_suite_detail.hpp.

template<class Container, class Index, class Policies>
typedef container_element<Container, Index, Policies> boost::python::detail::container_element< Container, Index, Policies >::self_t

Definition at line 360 of file indexing_suite_detail.hpp.

Constructor & Destructor Documentation

template<class Container, class Index, class Policies>
boost::python::detail::container_element< Container, Index, Policies >::container_element ( object  container,
Index  index 
)
inline
template<class Container, class Index, class Policies>
boost::python::detail::container_element< Container, Index, Policies >::container_element ( container_element< Container, Index, Policies > const &  ce)
inline

Definition at line 370 of file indexing_suite_detail.hpp.

371  : ptr(ce.ptr.get() == 0 ? 0 : new element_type(*ce.ptr.get()))
372  , container(ce.container)
373  , index(ce.index)
374  {
375  }
template<class Container, class Index, class Policies>
boost::python::detail::container_element< Container, Index, Policies >::~container_element ( )
inline

Definition at line 377 of file indexing_suite_detail.hpp.

378  {
379  if (!is_detached())
380  get_links().remove(*this);
381  }
static proxy_links< self_t, Container > & get_links()

Member Function Documentation

template<class Container, class Index, class Policies>
void boost::python::detail::container_element< Container, Index, Policies >::detach ( )
inline

Definition at line 398 of file indexing_suite_detail.hpp.

399  {
400  if (!is_detached())
401  {
402  ptr.reset(
403  new element_type(
404  Policies::get_item(get_container(), index)));
405  container = object(); // free container. reset it to None
406  }
407  }
template<class Container, class Index, class Policies>
element_type* boost::python::detail::container_element< Container, Index, Policies >::get ( ) const
inline

Definition at line 390 of file indexing_suite_detail.hpp.

References boost::python::detail::get_pointer().

Referenced by boost::python::detail::get_pointer().

391  {
392  if (is_detached())
393  return get_pointer(ptr);
394  return &Policies::get_item(get_container(), index);
395  }
Policies::data_type * get_pointer(python::detail::container_element< Container, Index, Policies > const &p)
template<class Container, class Index, class Policies>
Container& boost::python::detail::container_element< Container, Index, Policies >::get_container ( ) const
inline

Definition at line 416 of file indexing_suite_detail.hpp.

417  {
418  return extract<Container&>(container)();
419  }
template<class Container, class Index, class Policies>
Index boost::python::detail::container_element< Container, Index, Policies >::get_index ( ) const
inline

Definition at line 422 of file indexing_suite_detail.hpp.

423  {
424  return index;
425  }
template<class Container, class Index, class Policies>
static proxy_links<self_t, Container>& boost::python::detail::container_element< Container, Index, Policies >::get_links ( )
inlinestatic

Definition at line 434 of file indexing_suite_detail.hpp.

435  {
436  // All container_element(s) maintain links to
437  // its container in a global map (see proxy_links).
438  // This global "links" map is a singleton.
439 
440  static proxy_links<self_t, Container> links;
441  return links; // singleton
442  }
template<class Container, class Index, class Policies>
bool boost::python::detail::container_element< Container, Index, Policies >::is_detached ( ) const
inline

Definition at line 410 of file indexing_suite_detail.hpp.

References boost::python::detail::get_pointer().

411  {
412  return get_pointer(ptr) != 0;
413  }
Policies::data_type * get_pointer(python::detail::container_element< Container, Index, Policies > const &p)
template<class Container, class Index, class Policies>
element_type& boost::python::detail::container_element< Container, Index, Policies >::operator* ( ) const
inline

Definition at line 383 of file indexing_suite_detail.hpp.

References boost::python::detail::get_pointer().

384  {
385  if (is_detached())
386  return *get_pointer(ptr);
387  return Policies::get_item(get_container(), index);
388  }
Policies::data_type * get_pointer(python::detail::container_element< Container, Index, Policies > const &p)
template<class Container, class Index, class Policies>
container_element& boost::python::detail::container_element< Container, Index, Policies >::operator= ( container_element< Container, Index, Policies > const &  ce)
private
template<class Container, class Index, class Policies>
void boost::python::detail::container_element< Container, Index, Policies >::set_index ( Index  i)
inline

Definition at line 428 of file indexing_suite_detail.hpp.

Member Data Documentation

template<class Container, class Index, class Policies>
object boost::python::detail::container_element< Container, Index, Policies >::container
private

Definition at line 449 of file indexing_suite_detail.hpp.

template<class Container, class Index, class Policies>
Index boost::python::detail::container_element< Container, Index, Policies >::index
private

Definition at line 450 of file indexing_suite_detail.hpp.

template<class Container, class Index, class Policies>
scoped_ptr<element_type> boost::python::detail::container_element< Container, Index, Policies >::ptr
private

Definition at line 448 of file indexing_suite_detail.hpp.


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