LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar::details::bulk_allocator::ReferenceCounter Class Reference

A simple reference counter, keep track of a number of users. More...

#include "BulkAllocator.h"

Inheritance diagram for lar::details::bulk_allocator::ReferenceCounter:
lar::details::bulk_allocator::BulkAllocatorBase< T >

Public Types

typedef unsigned int Counter_t
 type of user counter More...
 

Public Member Functions

bool hasUsers () const
 Returns whether there are currently users. More...
 
Counter_t Count () const
 Returns the number of registered users. More...
 
void AddUser ()
 Adds a user to the users count. More...
 
bool RemoveUser ()
 Removed a user to the users count; returns false if no user yet. More...
 

Private Attributes

Counter_t counter = 0
 

Detailed Description

A simple reference counter, keep track of a number of users.

Definition at line 227 of file BulkAllocator.h.

Member Typedef Documentation

type of user counter

Definition at line 229 of file BulkAllocator.h.

Member Function Documentation

void lar::details::bulk_allocator::ReferenceCounter::AddUser ( )
inline

Adds a user to the users count.

Definition at line 238 of file BulkAllocator.h.

References util::counter().

Referenced by lar::details::bulk_allocator::BulkAllocatorBase< T >::AddUser().

Counter_t lar::details::bulk_allocator::ReferenceCounter::Count ( ) const
inline

Returns the number of registered users.

Definition at line 235 of file BulkAllocator.h.

References util::counter().

bool lar::details::bulk_allocator::ReferenceCounter::hasUsers ( ) const
inline

Returns whether there are currently users.

Definition at line 232 of file BulkAllocator.h.

References util::counter().

Referenced by lar::details::bulk_allocator::BulkAllocatorBase< T >::RemoveUser().

bool lar::details::bulk_allocator::ReferenceCounter::RemoveUser ( )
inline

Removed a user to the users count; returns false if no user yet.

Definition at line 241 of file BulkAllocator.h.

References util::counter().

Referenced by lar::details::bulk_allocator::BulkAllocatorBase< T >::RemoveUser().

242  {
243  if (!counter) return false;
244  --counter;
245  return true;
246  }

Member Data Documentation

Counter_t lar::details::bulk_allocator::ReferenceCounter::counter = 0
private

Definition at line 249 of file BulkAllocator.h.


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