24#include <polyconstr.h>
27#ifndef _libint2_src_bin_libint_iter_h_
28#define _libint2_src_bin_libint_iter_h_
52 virtual operator int()
const =0;
73 typedef typename T::iter_type iter_type;
74 typedef Tr<T> TPolicy;
75 typedef typename TPolicy::obj_stype tref;
76 typedef typename TPolicy::subobj_stype iref;
83 const iref&
elem()
const;
88 unsigned int num_iter()
const override;
94 operator int()
const override;
98 std::vector<iref> subobj_;
107 template <
class X>
void init_subobj();
108 template <
class X>
void delete_subobj();
110 void delete_subobj();
113 template <
typename X,
bool return_smart_ptr>
116 template <
typename X>
117 struct PElemImpl<X,true> {
119 SafePtr<ConstructablePolymorphically> elem_cast = dynamic_pointer_cast<ConstructablePolymorphically,X>(
elem);
120 return *(elem_cast.get());
123 template <
typename X>
124 struct PElemImpl<X,false> {
132 template <
class T,
template <
class>
class P>
133 SubIteratorBase<T,P>::SubIteratorBase(
const tref& obj) :
134 obj_(obj), subobj_(0), iter_(0)
136#ifdef ALLOW_PARTIALLY_SPECIALIZED_NESTED_TEMPLATES
143 template <
class T,
template <
class>
class P>
144 SubIteratorBase<T,P>::~SubIteratorBase()
146#ifdef ALLOW_PARTIALLY_SPECIALIZED_NESTED_TEMPLATES
153 template <
class T,
template <
class>
class P>
157 return subobj_.size();
160 template <
class T,
template <
class>
class P>
161 const typename SubIteratorBase<T,P>::iref&
164 return subobj_.at(iter_);
167 template <
class T,
template <
class>
class P>
171 return PElemImpl<iter_type,detail::IsSafePtr<iref>::result>::pelem(elem());
175 template <
class T,
template <
class>
class P>
176 const SafePtr<ConstructablePolymorphically>
179 return dynamic_pointer_cast<ConstructablePolymorphically,iter_type>(elem());
183 template <
class T,
template <
class>
class P>
190 template <
class T,
template <
class>
class P>
198 template <
class T,
template <
class>
class P>
201 return (iter_ < num_iter()) ? 1 : 0;
204 template <
class T,
template <
class>
class P>
208 P<T>::init_subobj(obj_,subobj_);
211 template <
class T,
template <
class>
class P>
213 SubIteratorBase<T,P>::delete_subobj()
215 P<T>::dealloc_subobj(subobj_);
ConstructablePolymorphically is a base for all objects which can be constructed using a SafePtr to a ...
Definition: polyconstr.h:31
SubIteratorBase<T> provides a base class for a sub-iterator class for T.
Definition: iter.h:70
void init() override
Initializes the iterator.
Definition: iter.h:185
const ConstructablePolymorphically & cp_rettype
Return reference to ConstructablePolymorphically as object of this type.
Definition: iter.h:78
const iref & elem() const
Returns current element.
Definition: iter.h:162
unsigned int num_iter() const override
Returns a number of iterations (number of elements in a set over which to iterate).
Definition: iter.h:155
cp_rettype pelem() const override
Returns current element. Implements SubIterator's pelem().
Definition: iter.h:169
SubIterator & operator++() override
Iterates to the next element. Only prefix form is provided.
Definition: iter.h:192
Iterator provides a base class for all object iterator classes.
Definition: iter.h:42
virtual const ConstructablePolymorphically & pelem() const
Return current element via base class.
Definition: iter.cc:38
virtual SubIterator & operator++()=0
Iterates to the next element. Only prefix form is provided.
virtual unsigned int num_iter() const =0
Returns a number of iterations (number of elements in a set over which to iterate).
virtual void init()=0
Initializes the iterator.
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24