A Creator is a forwarding of some data object to its creational object. More...
#include <memcore/Creator.hpp>
A Creator is a forwarding of some data object to its creational object.
Instead of referring to data objects, one can refer to CreatorBase's to this data object domain, and install Creators on this object by default. The references to the CreatorBase can be used like references to the objects, but optionally something else than an Creator of the object can be installed there. In this case, the object does not exist right from the beginning, but its creation is delayed until access.
Example code: Instead of
RefPtr<Object> objPtr;
objPtr = new Object;
Object*P = objPtr;
use
RefPtr<CreatorBase<Object> > objPtr; objPtr = new Creator(new Object); Object*P = objPtr;
Creator< RefType >::Creator | ( | const RefPtr< RefType > & | D, | |
const WeakPtr< CacheBase > & | MyCache | |||
) | [inline] |
Construct a creator with a data object.
Note that if the RefType is a Cacheable, it rather needs to get this Creator object defined as its creator (see Cacheable::setCreator() ). This constructor does not do this, because the RefType object might be anything refcountable. To automatize such functionality it needs to be implemented in a domain-specific base class.