VISH  0.2
Classes | Public Types | Public Member Functions
MemCore::Creature Class Reference

An abstract base class for object creators. More...

#include </home/werner/origo/vish/memcore/Creature.hpp>

List of all members.

Classes

Public Types

Public Member Functions


Detailed Description

An abstract base class for object creators.

A memory management repository might want to keep track of all `Creatures' and try to release some of them when memory gets tight. The virtual release() function will then ask each object to remove itself from memory. If the object dies by itself, it will be removed from the cache list if that correctly refers to the Creature via a WeakPtr<Creature>.


Constructor & Destructor Documentation

MemCore::Creature::Creature ( const WCachePtr myCache)

Constructor, keeps track of the cache, but does NOT insert this object into the Cache.

This has to be done later, once a Creator has been associated and externally referenced, using the enableCaching() function.


Member Function Documentation

bool MemCore::Creature::discardCreation ( ) [virtual]

Asynchron mode: aha.

Data are under creation, but we don't want them any longer. Soo... cancel this creation request. Hopefully that works.

bool MemCore::Creature::enableCaching ( ) const

Insert the available Cacheable object, as retrieved by the getCacheable() function to the Cache associated with this Creator.

This function must be called in a derived create() function if a new data object has been allocated.

bool MemCore::Creature::isUnderCreation ( ) [virtual]

Asynchron mode: check if the requested data are just under creation.

If this returns true, then the create() function will return false - better not ask the create() function, as we know than that this creator is already busy.

By default, returns false, meaning that data are just there.

Creature::ReasonForReleasal MemCore::Creature::release ( ) [pure virtual]

Query the object to release as much memory as it can.

Return false if the memory could not be released. In this case, the object remains in the queue.

template<class RefType >
ReasonForReleasal MemCore::Creature::releasePtr ( RefPtr< RefType > &  Data) const [inline]

Template helper function to release a data pointer in a derived class.

This function checks if there is only one strong reference to the given data pointer, and if so, set the pointer to NullPtr() which is supposed to delete the data object. If there is more than one strong reference pointer, then the type temporarily_unreleasable will be returned as ReasonForReleasal, because setting the data pointer to null would not release the data. The calling function is then supposed to try releasing the data again once those external strong references have been removed.


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