The Vish Visualization Shell 0.3
Vish
MemCore::CreatorBase< Domain > Class Template Referenceabstract

A Domain-related abstract base class for reference-counted objects which occupy some memory but are able to release it on demand. More...

#include <elementary/memcore/CreatorBase.hpp>

Inheritance diagram for MemCore::CreatorBase< Domain >:
MemCore::Creator< RefType, MyCreatorBase > MemCore::AlzheimerCreator< ::Data > MemCore::AlzheimerCreator< Object, MyCreatorBase > OnDemandCreator

Classes

struct  Exception
 Associated Exception class. More...
class  Producer
 Interface class for Creatures that allow on-demand creation of Creatures. More...

Public Member Functions

RefPtr< Domain > create (bool CreateAsOld=false)
 Actually create the object, using an existing one if existent via the get() function, otherwise calling the virtual produce() function.
RefPtr< Domain > createAsOld ()
 Get and possibly create data here without touching it, which is useful if the data is required only temporary.
 CreatorBase (const WCachePtr &theCache)
 Construct with Cache object given.
virtual RefPtr< Domain > get () const =0
 Try to get data if possible.
RefPtr< Domain > get_or_request (const result &R=nullptr)
 Asynchronous data access: Get the data if available, otherwise request them if possible and return nullptr.
virtual const type_info & getType ()=0
 Query the associated value type of this creator object.
bool isUnderCreation () const override
 return true while a request issued by the producer is still ongoing
virtual bool request (const result &R=nullptr)
 Asynchron mode: Request data to be created.
virtual RefPtr< Domain > take ()
 Take the data out of this creator and yield it as return value.

Detailed Description

template<class Domain>
class MemCore::CreatorBase< Domain >

A Domain-related abstract base class for reference-counted objects which occupy some memory but are able to release it on demand.

Note
CreatorBase(R) is a registered trademark of CreatorCo.com. The nomenclature used within the MemCore library is unrelated to this webservice.

Constructor & Destructor Documentation

◆ CreatorBase()

template<class Domain>
MemCore::CreatorBase< Domain >::CreatorBase ( const WCachePtr & theCache)
inline

Construct with Cache object given.

Note that enableCaching() has to be called explicitly later once a Creator has been associated with this Creature.

Member Function Documentation

◆ createAsOld()

template<class Domain>
RefPtr< Domain > MemCore::CreatorBase< Domain >::createAsOld ( )
inline

Get and possibly create data here without touching it, which is useful if the data is required only temporary.

It will not be marked as "important" and will be removed from memory as soon as possible if memory is tight.

References create().

◆ get_or_request()

template<class Domain>
RefPtr< Domain > MemCore::CreatorBase< Domain >::get_or_request ( const result & R = nullptr)
inline

Asynchronous data access: Get the data if available, otherwise request them if possible and return nullptr.

If requesting data is not possible then the data will be created via the create() call.

References create(), get(), and request().

◆ getType()

template<class Domain>
virtual const type_info & MemCore::CreatorBase< Domain >::getType ( )
pure virtual

Query the associated value type of this creator object.

This type information can possibly be determined without actually loading any data. Whether or not this is the case is up to the implementation of the child class.

Implemented in MemCore::Creator< RefType, MyCreatorBase >, MemCore::Creator< ::Data, CreatorBase<::Data > >, MemCore::Creator< Object, CreatorBase< Object > >, MyOnDemandDataCreator, Wizt::DisplayListCreator, Wizt::TextureCreator, and Wizt::VBOCreator.

◆ request()

template<class Domain>
virtual bool MemCore::CreatorBase< Domain >::request ( const result & R = nullptr)
inlinevirtual

Asynchron mode: Request data to be created.

Returns false if that is not possible. If create() returned false, and this request() as well, then we have a problem.

Referenced by get_or_request().

◆ take()

template<class Domain>
virtual RefPtr< Domain > MemCore::CreatorBase< Domain >::take ( )
inlinevirtual

Take the data out of this creator and yield it as return value.

This function implies a release() once the strong reference pointer to the data object is gone. This creator will no longer keep the data alive.

Reimplemented in MemCore::Creator< RefType, MyCreatorBase >, MemCore::Creator< ::Data, CreatorBase<::Data > >, and MemCore::Creator< Object, CreatorBase< Object > >.