21 #ifndef LIST_POOL_IMPL_H 22 #define LIST_POOL_IMPL_H 25 #include "SheafSystem/list_pool.h" 28 #ifndef SHEAF_DLL_SPEC_H 29 #include "SheafSystem/sheaf_dll_spec.h" 32 #ifndef ASSERT_CONTRACT_H 33 #include "SheafSystem/assert_contract.h" 68 typename allocated_type::iterator itr = _allocated.begin();
70 while(itr != _allocated.end())
87 ensure(unexecutable(
"All allocated objects have been deleted."));
105 if(_free_list.empty())
113 _allocated.insert(result);
119 result = _free_list.front();
120 _free_list.pop_front();
125 ensure(allocated(*result));
132 template <
typename T>
139 require(allocated(xobj));
143 _free_list.push_front(&xobj);
147 ensure(is_basic_query);
154 template <
typename T>
163 T& lobj =
const_cast<T&
>(xobj);
165 bool result = (_allocated.find(&lobj) != _allocated.end());
169 ensure(is_basic_query);
176 template <
typename T>
204 template <
typename T>
212 size_t result = xinclude_shallow ?
sizeof(xpool) : 0;
215 for(itr = xpool._allocated.begin(); itr != xpool._allocated.end(); ++itr)
229 #endif // ifndef LIST_POOL_IMPL_H virtual ~list_pool()
Destructor.
T & get()
Allocates an object of type T from this pool.
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
bool allocated(const T &xobj) const
True if and only if this pool allocated object xobj.
void release(T &xobj)
Return the object xobj to the free list of this pool.
list_pool()
Default constructor.
Namespace for the sheaves component of the sheaf system.
unsigned long int size_type
An unsigned integral type used to represent sizes and capacities.
A reallocated pool of objects of type T. Objects in the pool are either allocated or stored in a free...