The Vish Visualization Shell 0.3
Vish
Public Member Functions | List of all members
MemCore::CacheMap Class Reference

A list of cache queues for each cacheable type. More...

#include <elementary/memcore/CacheMap.hpp>

Inheritance diagram for MemCore::CacheMap:
MemCore::ReferenceBase< CacheMap > MemCore::typemap< CacheMultiQueue >

Public Member Functions

bool adjust (const type_info &CreatorType, const CacheBase &, memsize_t newCost)
 Try to adjust the cache by releasing objects from the queue until the new cost is achieved.
 
 CacheMap ()
 Constructor.
 
void insert (const WeakPtr< Cacheable > &Ca, bool InsertAtBack)
 Insert a cacheable object into this cache map.
 
void insert_zombie (const WeakPtr< Cacheable > &Ca)
 insert an object that is already dead.
 
void list_info () const
 Print debug info for cacheable objects.
 
void list_info (const type_info &CacheableDomain) const
 Print debug info for a certain type of cacheable objects.
 
memsize_t memsize (bool FreeableOnly=false) const
 
int nEntries () const
 Return the number of cached entries in a very slow way.
 
memsize_t purge ()
 Remove all objects from the CacheMap.
 
memsize_t purge_Hades ()
 cleanse all dead objects
 
bool touch (const WeakPtr< Cacheable > &Ca)
 Put in queue of appropriate creator domain.
 
 ~CacheMap ()
 Destructor.
 
- Public Member Functions inherited from MemCore::ReferenceBase< CacheMap >
auto getObjectCountID () const noexcept
 Get a unique ID for this object in the given domain.
 
bool isIdentical (const WeakPtr< CacheMap, CacheMap > &PossibleSelf) const noexcept
 Check if this object is identical to the one used by the given pointer.
 
void mkAutoDestructive ()
 Marks this object as being automatically destructed, e.g.
 
refcount_t refcount () const noexcept
 The strong reference count.
 
 ReferenceBase (CacheMap *that) noexcept
 Constructor, initializes reference counter to zero.
 
const auto & self () const
 Return weak pointer to the object self.
 
refcount_t wrefcount () const noexcept
 The weak reference count.
 

Additional Inherited Members

- Public Types inherited from MemCore::ReferenceBase< CacheMap >
using reference_domain_t = CacheMap
 The type of the base class.
 
using SelfPtr_t = WeakPtr< CacheMap, CacheMap >
 Type for a pointer to this object itself.
 
- Protected Member Functions inherited from MemCore::ReferenceBase< CacheMap >
virtual void extremeUnction ()
 A virtual function that will be called just before the object is destroyed.
 
ReferenceBaseoperator= (const ReferenceBase &R)
 Protected assignment operator (should not be called).
 
void suicide ()
 Delete this.
 
virtual ~ReferenceBase ()
 Virtual destructor.
 

Detailed Description

A list of cache queues for each cacheable type.

Member Function Documentation

◆ adjust()

bool MemCore::CacheMap::adjust ( const type_info &  CreatorType,
const CacheBase theCache,
memsize_t  newCost 
)

Try to adjust the cache by releasing objects from the queue until the new cost is achieved.

Parameters
CreatorTypeThe type of the creator domain that shall be used primarily.

raise exception here??????

References MemCore::CacheMultiQueue::adjust(), memsize(), MemCore::VerboseStream::MemString(), and MemCore::Cache::verbosity().

◆ memsize()

memsize_t MemCore::CacheMap::memsize ( bool  FreeableOnly = false) const
Note
This is a very slow function and should be called only for debugging purposes

Referenced by adjust().

◆ nEntries()

int MemCore::CacheMap::nEntries ( ) const

Return the number of cached entries in a very slow way.

Don't ever call it except for rare debugging purposes.

Note
This is a very slow function and should be called only for debugging purposes

References nEntries().

Referenced by nEntries().

◆ touch()

bool MemCore::CacheMap::touch ( const WeakPtr< Cacheable > &  Ca)

Put in queue of appropriate creator domain.

Returns
false of no appropriate creator domain exists. Must use insert() function for that.