VulkanRaytracingCycles 0.0.0
Cycles Render Engine With VulkanRaytracingShaderModules. ( Experiment , in progress)
front::local_counting_allocator< base_alloc_t, count_t > Class Template Reference

#include <AllocatorVk.h>

Classes

struct  rebind
 

Public Types

typedef base_alloc_t::pointer pointer
 
typedef base_alloc_t::const_pointer const_pointer
 
typedef base_alloc_t::reference reference
 
typedef base_alloc_t::const_reference const_reference
 
typedef base_alloc_t::value_type value_type
 
typedef base_alloc_t::size_type size_type
 
typedef base_alloc_t::difference_type difference_type
 

Public Member Functions

void set_counters (const count_t &a_items_allocated, const count_t &a_items_freed, const count_t &a_allocations, const count_t &a_frees, const count_t &a_max_items)
 
template<typename allocator_t >
void set_counters (const allocator_t &a)
 
void clear_counters ()
 
 local_counting_allocator () throw ()
 
 local_counting_allocator (const local_counting_allocator &a) throw ()
 
template<typename U , typename C >
 local_counting_allocator (const local_counting_allocator< U, C > &a) throw ()
 
bool operator== (const local_counting_allocator &a) const
 
pointer allocate (const size_type n)
 
pointer allocate (const size_type n, const void *const)
 
void deallocate (const pointer ptr, const size_type n)
 
void set_limits (size_type max=0)
 

Public Attributes

count_t items_allocated
 
count_t items_freed
 
count_t allocations
 
count_t frees
 
size_t max_items
 

Detailed Description

template<typename base_alloc_t, typename count_t = tbb::atomic<size_t>>
class front::local_counting_allocator< base_alloc_t, count_t >

Definition at line 256 of file AllocatorVk.h.

Inheritance diagram for front::local_counting_allocator< base_alloc_t, count_t >:

Member Typedef Documentation

◆ const_pointer

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
typedef base_alloc_t::const_pointer front::local_counting_allocator< base_alloc_t, count_t >::const_pointer

Definition at line 260 of file AllocatorVk.h.

◆ const_reference

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
typedef base_alloc_t::const_reference front::local_counting_allocator< base_alloc_t, count_t >::const_reference

Definition at line 262 of file AllocatorVk.h.

◆ difference_type

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
typedef base_alloc_t::difference_type front::local_counting_allocator< base_alloc_t, count_t >::difference_type

Definition at line 265 of file AllocatorVk.h.

◆ pointer

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
typedef base_alloc_t::pointer front::local_counting_allocator< base_alloc_t, count_t >::pointer

Definition at line 259 of file AllocatorVk.h.

◆ reference

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
typedef base_alloc_t::reference front::local_counting_allocator< base_alloc_t, count_t >::reference

Definition at line 261 of file AllocatorVk.h.

◆ size_type

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
typedef base_alloc_t::size_type front::local_counting_allocator< base_alloc_t, count_t >::size_type

Definition at line 264 of file AllocatorVk.h.

◆ value_type

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
typedef base_alloc_t::value_type front::local_counting_allocator< base_alloc_t, count_t >::value_type

Definition at line 263 of file AllocatorVk.h.

Constructor & Destructor Documentation

◆ local_counting_allocator() [1/3]

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
front::local_counting_allocator< base_alloc_t, count_t >::local_counting_allocator ( )
throw (
)
inline

Definition at line 295 of file AllocatorVk.h.

295 {
296 this->clear_counters();
297 }

◆ local_counting_allocator() [2/3]

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
front::local_counting_allocator< base_alloc_t, count_t >::local_counting_allocator ( const local_counting_allocator< base_alloc_t, count_t > &  a)
throw (
)
inline

Definition at line 299 of file AllocatorVk.h.

300 : base_alloc_t(a)
301 , items_allocated(a.items_allocated)
302 , items_freed(a.items_freed)
303 , allocations(a.allocations)
304 , frees(a.frees)
305 , max_items(a.max_items)
306 { }

◆ local_counting_allocator() [3/3]

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
template<typename U , typename C >
front::local_counting_allocator< base_alloc_t, count_t >::local_counting_allocator ( const local_counting_allocator< U, C > &  a)
throw (
)
inline

Definition at line 315 of file AllocatorVk.h.

316 : items_allocated(a.items_allocated)
317 , items_freed(a.items_freed)
318 , allocations(a.allocations)
319 , frees(a.frees)
320 , max_items(a.max_items)
321 { }

Member Function Documentation

◆ allocate() [1/2]

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
pointer front::local_counting_allocator< base_alloc_t, count_t >::allocate ( const size_type  n)
inline

Definition at line 328 of file AllocatorVk.h.

329 {
330 if (max_items && items_allocated + n >= max_items)
331 __TBB_THROW(std::bad_alloc());
332 pointer p = base_alloc_t::allocate(n, pointer(0));
333 ++allocations;
334 items_allocated += n;
335 return p;
336 }
base_alloc_t::pointer pointer
Definition: AllocatorVk.h:259

◆ allocate() [2/2]

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
pointer front::local_counting_allocator< base_alloc_t, count_t >::allocate ( const size_type  n,
const void * const   
)
inline

Definition at line 338 of file AllocatorVk.h.

339 {
340 return allocate(n);
341 }
pointer allocate(const size_type n)
Definition: AllocatorVk.h:328

◆ clear_counters()

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
void front::local_counting_allocator< base_alloc_t, count_t >::clear_counters ( )
inline

Definition at line 289 of file AllocatorVk.h.

289 {
290 count_t zero;
291 zero = 0;
292 this->set_counters(zero, zero, zero, zero, zero);
293 }
void set_counters(const count_t &a_items_allocated, const count_t &a_items_freed, const count_t &a_allocations, const count_t &a_frees, const count_t &a_max_items)
Definition: AllocatorVk.h:276

◆ deallocate()

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
void front::local_counting_allocator< base_alloc_t, count_t >::deallocate ( const pointer  ptr,
const size_type  n 
)
inline

Definition at line 343 of file AllocatorVk.h.

344 {
345 ++frees;
346 items_freed += n;
347 base_alloc_t::deallocate(ptr, n);
348 }

◆ operator==()

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
bool front::local_counting_allocator< base_alloc_t, count_t >::operator== ( const local_counting_allocator< base_alloc_t, count_t > &  a) const
inline

Definition at line 323 of file AllocatorVk.h.

324 {
325 return static_cast<const base_alloc_t&>(a) == *this;
326 }

◆ set_counters() [1/2]

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
template<typename allocator_t >
void front::local_counting_allocator< base_alloc_t, count_t >::set_counters ( const allocator_t &  a)
inline

Definition at line 285 of file AllocatorVk.h.

285 {
286 this->set_counters(a.items_allocated, a.items_freed, a.allocations, a.frees, a.max_items);
287 }

◆ set_counters() [2/2]

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
void front::local_counting_allocator< base_alloc_t, count_t >::set_counters ( const count_t &  a_items_allocated,
const count_t &  a_items_freed,
const count_t &  a_allocations,
const count_t &  a_frees,
const count_t &  a_max_items 
)
inline

Definition at line 276 of file AllocatorVk.h.

276 {
277 items_allocated = a_items_allocated;
278 items_freed = a_items_freed;
279 allocations = a_allocations;
280 frees = a_frees;
281 max_items = a_max_items;
282 }

◆ set_limits()

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
void front::local_counting_allocator< base_alloc_t, count_t >::set_limits ( size_type  max = 0)
inline

Definition at line 350 of file AllocatorVk.h.

350 {
351 max_items = max;
352 }

Member Data Documentation

◆ allocations

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
count_t front::local_counting_allocator< base_alloc_t, count_t >::allocations

Definition at line 272 of file AllocatorVk.h.

◆ frees

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
count_t front::local_counting_allocator< base_alloc_t, count_t >::frees

Definition at line 273 of file AllocatorVk.h.

◆ items_allocated

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
count_t front::local_counting_allocator< base_alloc_t, count_t >::items_allocated

Definition at line 270 of file AllocatorVk.h.

◆ items_freed

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
count_t front::local_counting_allocator< base_alloc_t, count_t >::items_freed

Definition at line 271 of file AllocatorVk.h.

◆ max_items

template<typename base_alloc_t , typename count_t = tbb::atomic<size_t>>
size_t front::local_counting_allocator< base_alloc_t, count_t >::max_items

Definition at line 274 of file AllocatorVk.h.


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