|
The Vish Visualization Shell 0.3
Vish
|
An abstract base class for object creators. More...
#include <elementary/memcore/Creature.hpp>
Classes | |
| struct | Exception |
| Associated Exception class. More... | |
Public Member Functions | |
| std::string | addrstr () const |
| make a string containing hex numbers from the object's adress. | |
| string & | appendProvenance (const RefPtr< Provenance > &P) |
| Append a Provenance object. | |
| string & | appendProvenance (const string &s) |
| Append a provenance information string. | |
| Creature (const WCachePtr &myCache) | |
| Constructor, keeps track of the cache, but does NOT insert this object into the Cache. | |
| virtual bool | discardCreation () |
| Asynchron mode: aha. | |
| void | enableCaching (bool CreateAsOld=false) const |
| Insert the available Cacheable object, as retrieved by the getCacheable() function to the Cache associated with this Creator. | |
| virtual CacheablePtr | getCacheable () const =0 |
| Get a pointer to the associated cacheable object, if such is available in a child class. | |
| RefPtr< Provenance > | getFirstCreationSource () const |
| Retrieve the first creation source if there are any defined. | |
| virtual bool | hasData () const |
| Query whether data exist here. | |
| virtual std::string | hasProducer () const |
| Query some more info about the kind of re-production facility associated with this creature. | |
| virtual bool | isReproducible () const |
| Query whether this Creature can be reproduced (i.e., be created again ) after release(). | |
| virtual bool | isUnderCreation () const |
| Asynchron mode: check if the requested data are just under creation. | |
| const WCachePtr & | myCache () const |
| Return the associated Cache object. | |
| virtual ReasonForReleasal | release ()=0 |
| Query the object to release as much memory as it can. | |
| template<class RefType > | |
| ReasonForReleasal | releasePtr (RefPtr< RefType > &Data) const |
| Template helper function to release a data pointer in a derived class. | |
| void | resetStatistics () |
| Reset statistic info, creation times and number of creations. | |
| string & | setProvenance (const RefPtr< Provenance > &P) |
| Append provenance information. | |
| string & | setProvenance (const string &s) |
| Overwrite latest provenance information. | |
Public Member Functions inherited from MemCore::ReferenceBase< Creature > | |
| auto | getObjectCountID () const noexcept |
| Get a unique ID for this object in the given domain. | |
| bool | isIdentical (const WeakPtr< Creature, Creature > &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 (Creature *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. | |
Public Member Functions inherited from MemCore::Intercube | |
| void | addInterface (const RefPtr< InterfaceBase > &I) const |
| Add an interface class object. | |
| template<class Data > | |
| void | addInterfaceData (const Data &D) |
| Add data via an interface class object. | |
| template<class Data , typename TypeSelector > | |
| void | addInterfaceData (const Data &D) |
| Add data via an interface class object. | |
| void | clearInterfaces () |
| Remove all interfaces. | |
| bool | const_iterateInterfaces (const RefPtr< InterfaceIterationParameter > &IIP) const |
| Constant iterator. | |
| virtual RefPtr< InterfaceBase > | createInterface (const type_info &) const |
| Virtual function which allows derived objects to create Interface objects on demand. | |
| RefPtr< InterfaceBase > | findInterface (const type_info &t) const |
| Find a certain interface of specified type. | |
| RefPtr< InterfaceBase > | getInterface (const type_info &t) |
| Retrieve an interface object from a certain type. | |
| std::string | getInterfaceNames (const char delim=';') const |
| Debug function retrieving all interfaces as human-readable string. | |
| template<class Data > | |
| bool | gotNewInterfaceData (const Data &D) |
| Check whether data on the given interface have changed, and if so, set new data as interface. | |
| template<class Data > | |
| bool | gotNewInterfaceData (mutex &M, const Data &D) |
| Check whether interface data have changed, if so, then set new interface data and return true. | |
| template<class Data , typename Selector > | |
| bool | gotNewInterfaceData (mutex &M, const Data &D) |
| Check whether interface data have changed, if so, then set new interface data and return true. | |
| template<class Data , typename Selector > | |
| bool | gotNewInterfaceData (mutex &M, const Data &D, const Selector &S) |
| Check whether interface data have changed, if so, then set new interface data and return true. | |
| template<class Data , typename Selector > | |
| bool | gotNewInterfaceData (mutex &M, const Data &D, const Selector *S) |
| Check whether interface data have changed, if so, then set new interface data and return true. | |
| template<class Data > | |
| bool | hasChangedInterfaceData (const Data &D) const |
| Check whether interface data have changed. | |
| template<class Data , typename Selector > | |
| bool | hasChangedInterfaceData (const Data &D) const |
| Check whether interface data have changed. | |
| template<class Data , typename Selector > | |
| bool | hasChangedInterfaceData (const Data &D, const Selector &) const |
| Check whether interface data have changed. | |
| template<class Data , typename Selector > | |
| bool | hasChangedInterfaceData (const Data &D, const Selector *) const |
| Check whether interface data have changed. | |
| bool | hasInterface (const type_info &t) const |
| Check if some Interface might exist. | |
| Intercube () | |
| Constructor. | |
| bool | iterateInterfaces (const RefPtr< InterfaceIterationParameter > &IIP) |
| Modifyable iterator. | |
| void | printInterfaces () const |
| Debug function that prints the names of all interfaces. | |
| void | registerInterface (const type_info &t) |
| Register an interface type; when the interface is actually required, the virtual createInterface() function will be called. | |
| template<class InterfaceType > | |
| void | removeInterface () |
| Remove an interface. | |
| void | removeInterfaceBase (const type_info &InterfaceBaseID) |
| Remove an interface. | |
| virtual | ~Intercube () |
| Destructor. | |
Public Member Functions inherited from MemCore::Ageable | |
| Ageable () noexcept | |
| Constructor; remembers birth time from current time counter. | |
| constexpr | Ageable (age_t t) noexcept |
| Constructor with explicit time value. | |
| constexpr | Ageable (const Ageable &A) noexcept |
| Copy constructor. | |
| Ageable (const volatile Ageable &A) noexcept | |
| Copy constructor. | |
| constexpr const Ageable & | getAge () const |
| Return reference to this age, useful for derived classes. | |
| bool | isNewerThan (const Ageable &a) const noexcept |
| Comparison operator. | |
| bool | isOlderThan (const Ageable &a) const noexcept |
| Comparison operator. | |
| bool | isYoungerThan (const Ageable &a) const noexcept |
| Comparison operator (alias to isNewerThan() ) | |
| bool | operator!= (const Ageable &a) const noexcept |
| Comparison operator. | |
| bool | operator< (const Ageable &a) const noexcept |
| Comparison operator. | |
| bool | operator<= (const Ageable &a) const noexcept |
| Comparision operator. | |
| bool | operator<= (const volatile Ageable &a) const volatile noexcept |
| Comparision operator. | |
| bool | operator== (const Ageable &a) const noexcept |
| Comparison operator. | |
| bool | operator> (const Ageable &a) const noexcept |
| Comparison operator. | |
| bool | operator> (const volatile Ageable &a) const volatile throw () |
| Comparision operator. | |
| bool | operator>= (const Ageable &a) const noexcept |
| Comparision operator. | |
| bool | operator>= (const volatile Ageable &a) const volatile noexcept |
| Comparison operator. | |
| constexpr void | resetAge () noexcept |
| Set time value to InfinitelyOld(). | |
| void | setInfinitelyNew () noexcept |
| Set time value to InfinitelyOld(). | |
| age_t | time_value () const noexcept |
| Return an object's current age. | |
| age_t | time_value () const volatile noexcept |
| Return an object's current age. | |
| Ageable & | touch () noexcept |
| Mark the current object as being modified "now". | |
| age_t | update (age_t age) noexcept |
| Set the age of the current object to a specific age if that is newer than the current one. | |
| age_t | update (const Ageable &Other) noexcept |
| Set the age of the current object to the age of another object if that other one is newer than the current one. | |
| age_t | update (const volatile Ageable &Other) volatile noexcept |
| Set the age of the current object to the age of another object if that other one is newer than the current one. | |
| ~Ageable () noexcept | |
| Destructor. | |
Public Attributes | |
| std::string | creationError |
| Indicator of possible creation errors. | |
| double | LastCreationTime = 0.0 |
| Seconds, last call. | |
| std::list< RefPtr< Provenance > > | myCreationSources |
| Optional information about this Creator, how it was born and to which data origin it may refer to. | |
| double | TotalCreationTime = 0.0 |
| Seconds, total. | |
Protected Member Functions | |
| virtual | ~Creature ()=0 |
| Destructor (virtual) | |
Protected Member Functions inherited from MemCore::ReferenceBase< Creature > | |
| virtual void | extremeUnction () |
| A virtual function that will be called just before the object is destroyed. | |
| ReferenceBase & | operator= (const ReferenceBase &R) |
| Protected assignment operator (should not be called). | |
| void | suicide () |
| Delete this. | |
| virtual | ~ReferenceBase () |
| Virtual destructor. | |
Additional Inherited Members | |
Public Types inherited from MemCore::ReferenceBase< Creature > | |
| using | reference_domain_t = Creature |
| The type of the base class. | |
| using | SelfPtr_t = WeakPtr< Creature, Creature > |
| Type for a pointer to this object itself. | |
Static Public Member Functions inherited from MemCore::Ageable | |
| static const Ageable & | InfinitelyNew () noexcept |
| Return a time that is infinitely in the future (well, sort of). | |
| static constexpr const Ageable & | InfinitelyOld () noexcept |
| Return a time that is infinitely in the past (well, sort of). | |
| static age_t | now () noexcept |
| Return the current global time. | |
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 WeakPtrImpl<Creature>.
| 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.
|
virtual |
Asynchron mode: aha.
Data are under creation, but we don't want them any longer. Soo... cancel this creation request. Hopefully that works.
| void MemCore::Creature::enableCaching | ( | bool | CreateAsOld = false | ) | 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.
This function may throw an exception if the associated Cache decides to do so.
| CreateAsOld | A rarely used parameter to insert the current object as the oldest one instead of being the newest. Such allows insertion of temporary objects. This may be required to avoid infinite recursions when creating new objects that require temporary creation of other objects. |
That is ok, because enableCaching() may also be called for freshly constructed creators with no data yet.
References getCacheable(), myCache(), and MemCore::ReferenceBase< Creature >::self().
Referenced by MemCore::CreatorBase< Domain >::create(), Wizt::AnemoneCreator< AnemoneInitializer >::produce(), Wizt::VBOCreator::produce(), and MemCore::Creator< RefType, MyCreatorBase >::supersede().
|
virtual |
Query some more info about the kind of re-production facility associated with this creature.
An empty string if no such re-production is not possible. Even with a re-production capability, isReproducible() may still return false due to certain circumstances.
Reimplemented in MemCore::CreatorBase< Domain >, MemCore::CreatorBase< Anemone >, MemCore::CreatorBase< DisplayList >, MemCore::CreatorBase< MyPreciousDataClass >, MemCore::CreatorBase< Object >, MemCore::CreatorBase< RefType >, MemCore::CreatorBase< TextureBase >, MemCore::CreatorBase< VBO >, and MemCore::CreatorBase<::Data >.
|
virtual |
Asynchron mode: check if the requested data are just under creation.
If this returns true, then the create() function will return block - 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 OR they are not currently under creation, so the create() function would block when called.
The recommended behavior when returned true is to skip this very Creature, do something else in the meantime, and query it again sometime later.
Reimplemented in MemCore::CreatorBase< Domain >, MemCore::CreatorBase< Anemone >, MemCore::CreatorBase< DisplayList >, MemCore::CreatorBase< MyPreciousDataClass >, MemCore::CreatorBase< Object >, MemCore::CreatorBase< RefType >, MemCore::CreatorBase< TextureBase >, MemCore::CreatorBase< VBO >, and MemCore::CreatorBase<::Data >.
|
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.
Implemented in MemCore::AlzheimerCreator< Object, MyCreatorBase >, MemCore::AlzheimerCreator< ::Data >, MemCore::AlzheimerCreator< Anemone, AnemoneCreatorBase >, MemCore::Creator< RefType, MyCreatorBase >, MemCore::Creator< ::Data, CreatorBase<::Data > >, MemCore::Creator< Object, CreatorBase< Object > >, MyOnDemandDataCreator, Wizt::TextureCreator, Wizt::DisplayListCreator, and Wizt::VBOCreator.
|
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.
Referenced by MemCore::AlzheimerCreator< Object, MyCreatorBase >::release(), Wizt::TextureCreator::release(), and Wizt::VBOCreator::release().
| string & MemCore::Creature::setProvenance | ( | const RefPtr< Provenance > & | P | ) |
Append provenance information.
Return string property of the provided provenance.
References myCreationSources.
| std::string MemCore::Creature::creationError |
Indicator of possible creation errors.
An error happened during creation if this string is non-empty.