|
The Vish Visualization Shell 0.3
Vish
|
Intermediate class for storing (named) references to parameters. More...
#include <ocean/plankton/VSlot.hpp>
Classes | |
| struct | Empty |
| Internal type for computational constructor. More... | |
Public Member Functions | |
| bool | AddAction (const RefPtr< ValueActionBase > &VAB) const |
| Associate the change of a slot value with an arbitrary action. | |
| const Ageable & | age (const RefPtr< ValuePool > &VP) const |
| Get the age of this value relative to the given value pool or the age of the most recent connection, whatever is younger (happened more recently). | |
| bool | assignParameter (const RefPtr< VParameter > ¶m, const string &member={}) |
| Assign a parameter to this Slot and update its connection age. | |
| bool | attachSlot (const VSlotPtr &SlotSource) |
| Connect another Slot's parameter here. | |
| const Ageable & | ConnectionAge () const |
| Get the age when this slot was most recently connected to another parameter. | |
| template<class T > | |
| bool | forceSetProperty (const string &theName, const T &value) const |
| Set a certain property of this parameter, and issue a notification event for the parameter's input object. | |
| WeakVObjectPtr | getExternalOwner () const |
| Get an external object only if this slot's parameter belongs to an object that is not its owner. | |
| RefPtr< VValueBase > | getGlobalValue () const |
| Return the GLOBAL value associated with this slot. | |
| const string & | getMemberName () const |
| Eventually, the member of the parameter which is used for this VObject. | |
| const RefPtr< VParameter > & | getParameter () const |
| Get the associated parameter. | |
| string | getParameterName () const |
| Global name of this parameter, i.e. how it is actually called. | |
| RefPtr< VValueBase > | getProperty (const string &s) const |
| Retrieve a certain property with yet unknown type. | |
| template<class T > | |
| bool | getProperty (const string &s, T &value) const |
| Retrieve a certain property of a parameter. | |
| const string & | getSlotName () const |
| Local name of this parameter, i.e. how it is accessed from an VObject. | |
| const WeakPtrToVSlotContainer & | getSlotOwner () const |
| Return the VObject that owns this current VSlot. | |
| RefPtr< VManagedObject > | getSource () const |
| Return a possible source object of this slot, telling where these values stem from. | |
| string | getStatus () const |
| Provide the current status string. | |
| template<class Type > | |
| bool | getValue (Type &Variable, const RefPtr< ValuePool > &VP) const |
| Get a value for a certain parameter. | |
| string | getValueAsText (const RefPtr< ValuePool > &VP, const string &theMember={}) |
| Get the parameter to a certain value as some textual description. | |
| RefPtr< VValueBase > | getValueBase (const RefPtr< ValuePool > &VP) const |
| Gets a value from the reference parameter. | |
| void | Globalize (const RefPtr< ValuePool > &GhostValues) |
| If a context-local parameter should rather be set to a global value, call this function. | |
| bool | isLocal () const |
| Tell if the current parameter is local relative to a given context. | |
| bool | isNew (const RefPtr< ValuePool > &VP) const |
| Tell if this Slot is newer than its owner, i.e. | |
| void | Localize () |
| New object parameters start as global parameters. | |
| const string & | MemberName () const |
| Eventually, the member of the parameter which is used for this VObject. | |
| RefPtr< VValueBase > | operator() (const RefPtr< ValuePool > &VP) const |
| Return the value associated with this slot relative to a given value pool. | |
| const string & | operator/= (const string &s) |
| string | ParameterName () const |
| Global name of this parameter, i.e. how it is actually called. | |
| void | resetAge () |
| Reset the age of the associated parameter to infinitely old such to not trigger updates. | |
| void | setClass (const string &s) |
| template<class T > | |
| bool | setProperty (const string &theName, const T &value) const |
| Set a certain property of this parameter if it differs, and issue a notification event for the parameter's input object if it has changed. | |
| template<class T > | |
| bool | setPropertyIfNotExists (const string &theName, const T &defaultValue) const |
| Set a certain property of this parameter if it does not exist yet, and issue a notification event for the parameter's input object if it was created. | |
| void | setRelevance (int rel) |
| Set the relevance of the involved parameter. | |
| bool | setShadowValueFromText (const string &VariableText, const string &PoolName, const string &theMember={}) |
| Set a variable value from text with a context given via its name. | |
| void | setStatus (const string &newStatus, const ValuePoolPtr &Context) |
| Set the current status string and issue a parameter notification if the status has changed. | |
| template<class Type > | |
| bool | setValue (const Type &Variable, const RefPtr< ValuePool > &VP, const WeakPtr< ValueNotifier > &issuer=nullptr, const ValueNotifierList *Exclude=0) const |
| Set the value in the associated parameter. | |
| template<class Type > | |
| bool | setValueByPoolname (const Type &Variable, const string &PoolName, const WeakPtr< ValueNotifier > &issuer=nullptr, const ValueNotifierList *Exclude=0) const |
| Set the value in the associated parameter with the context given via its name. | |
| bool | setValueFromText (const string &VariableText, const RefPtr< ValuePool > &VP, const string &theMember={}) |
| Set the parameter to a certain value from some textual description. | |
| const string & | SlotName () const |
| Local name of this parameter, i.e. how it is accessed from an VObject. | |
| const Ageable & | ValueAge (const RefPtr< ValuePool > &VP) const |
| Get the age of this value relative to the given value pool. | |
| VSlot () | |
| Empty constructor. | |
| VSlot (VSlotContainer *theSlotOwner, const RefPtr< VParameter > &p, const string &name, const string &member={}) | |
| Construct slot from parameter and local name, optional member reference. | |
| ~VSlot () | |
| Destructor. | |
Public Member Functions inherited from MemCore::ReferenceBase< VSlot > | |
| auto | getObjectCountID () const noexcept |
| Get a unique ID for this object in the given domain. | |
| bool | isIdentical (const WeakPtr< VSlot, VSlot > &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 (VSlot *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. | |
Static Public Member Functions | |
| static WeakVObjectPtr | getVObjectPtr (VObject *) |
| Internal helper function. | |
Public Attributes | |
| unsigned int | AllowAutoConnection:1 |
| Specify whether this slot maybe be automatically connected with the slots of another VObject when connectSlots() is called. | |
| unsigned int | cached:1 |
| Specify whether this parameter should be cached, meaning: if this parameter is changed, should it trigger computing a new output result, or will that just be used from somewhere else? It is up to the VObject::update() routine to proper handle caching, which is non-trivial. | |
| unsigned int | dontSave:1 |
| A flag to specify that this slot shall never be saved, for instance if it is computed anyway or its associated type is unsaveable. | |
| string | helptext |
| An help text for users, to be used to describe the functionality of this Slot relative to the current context where it is used. | |
| unsigned int | ignoreConnectionAge:1 = 0 |
| A flag to tell whether the connection age should be ignored when checking whether this Slot has changed during an update(). | |
| unsigned int | inactive:1 |
| A flag to tell that this slot is currently inactive. | |
| int | myInputClass = 0 |
| By default, all slots are class zero. | |
| std::set< MemCore::RefPtr< ValueNotifier > > | myNotifiers |
| A set of possible value notifiers that are lurking for events here. | |
| unsigned int | pinned:2 = 0 |
| Specification whether this slot is considered relevant to be displayed in a certain application scenario. | |
| string | status |
| An status for users, to be used to describe the current state this Slot relative to the current context where it is used. | |
Friends | |
| const ValueSetPair & | operator+= (const ValueSetPair &VSP, const VSlotPtr &VS) |
| const ValueSetPair & | operator, (const ValueSetPair &VSP, const VSlotPtr &VS) |
Related Symbols | |
(Note that these are not member symbols.) | |
| typedef std::pair< const RefPtr< VSlot >, const RefPtr< ValuePool > > | SlotContext |
| Reference to an InputSlot plus context. | |
Additional Inherited Members | |
Public Types inherited from MemCore::ReferenceBase< VSlot > | |
| using | reference_domain_t = VSlot |
| The type of the base class. | |
| using | SelfPtr_t = WeakPtr< VSlot, VSlot > |
| Type for a pointer to this object itself. | |
Protected Member Functions inherited from MemCore::ReferenceBase< VSlot > | |
| 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. | |
Intermediate class for storing (named) references to parameters.
This reference class is used whereever we want to refer to a certain parameter, but the parameter itself may change since it might be connected to one or another object. This reference slot implements an edge in the data flow graph. Independently, each parameter may be related to one or many inputs, which are related through the control flow graph.
Note that global operators are provided that enable user-friendly convenient retrieval of slot values. Code looks like this:
| struct Wizt::VSlot::Empty |
Internal type for computational constructor.
It is templatized to avoid early instantiation of constructors that depend on this argument.
| Wizt::VSlot::VSlot | ( | VSlotContainer * | theSlotOwner, |
| const RefPtr< VParameter > & | p, | ||
| const string & | name, | ||
| const string & | member = {} |
||
| ) |
Construct slot from parameter and local name, optional member reference.
| theSlotOwner | Where this slot will live, a VObject . |
References inactive, and MemCore::ReferenceBase< VSlot >::self().
| bool Wizt::VSlot::assignParameter | ( | const RefPtr< VParameter > & | param, |
| const string & | member = {} |
||
| ) |
Assign a parameter to this Slot and update its connection age.
This function should not be called by application code, use attachSlot() instead as these function will announce all changes.
RefPtr<VObject> MyOwner = getSlotOwner();
References getSlotName(), getSlotOwner(), and MemCore::Ageable::touch().
| bool Wizt::VSlot::attachSlot | ( | const VSlotPtr & | SlotSource | ) |
Connect another Slot's parameter here.
This slot's parameter will be removed.
References Wizt::VConnectable::attachSlot(), and MemCore::ReferenceBase< VSlot >::self().
|
inline |
Set a certain property of this parameter, and issue a notification event for the parameter's input object.
| WeakVObjectPtr Wizt::VSlot::getExternalOwner | ( | ) | const |
Get an external object only if this slot's parameter belongs to an object that is not its owner.
This is equivalent to checking
References getSlotOwner(), and getSource().
|
inline |
Return the VObject that owns this current VSlot.
This is not necessarily the Source(), since the associated parameter of a VSlot may be provided by another VObject. In order to check if a VSlot's value stems from another object, compare the getSlotOwner() with the getSource(), which refers to the owner of the parameter value.
Referenced by assignParameter(), getExternalOwner(), and isNew().
|
inline |
Return a possible source object of this slot, telling where these values stem from.
The returned object will provide a parameter that is referenced by this Slot.
Referenced by getExternalOwner(), Wizt::VObject::iterateParents(), and ~VSlot().
|
inline |
Get a value for a certain parameter.
Typical usage:
If a context-local parameter should rather be set to a global value, call this function.
Some context needs to be provided though in order to set the global state from this local context.
Tell if this Slot is newer than its owner, i.e.
the object where it belongs to, its getSlotOwner().
Equivalent to
References age(), and getSlotOwner().
|
inline |
New object parameters start as global parameters.
If the value of a parameter is supposed to be context-local, then this may be specified by calling this function.
|
inline |
Syntactic sugar to set the class for
this slot such that it can be reused
for other slots, e.g. as in
Make sure to call VObject::recognizeInputClass("texture") to make these slots "visible".
| void Wizt::VSlot::setClass | ( | const string & | s | ) |
References Wizt::VInputClass::getClass(), and myInputClass.
|
inline |
Set a certain property of this parameter if it differs, and issue a notification event for the parameter's input object if it has changed.
|
inline |
Set a certain property of this parameter if it does not exist yet, and issue a notification event for the parameter's input object if it was created.
|
inline |
Set the parameter to a certain value from some textual description.
| VP | The value pool specifying the context. Has no effect if the parameter is not set to local. |
Get the age of this value relative to the given value pool.
References getValueBase(), and MemCore::Ageable::InfinitelyOld().
Referenced by age().
|
friend |
|
friend |
| unsigned int Wizt::VSlot::AllowAutoConnection |
Specify whether this slot maybe be automatically connected with the slots of another VObject when connectSlots() is called.
This is the case for instance when a new VObject is created as an input object for some VObject. Here, usually it were beneficial to have all compatible slots (same type, same name) to be connected to the same input. However, there are case where this should not be the case. This flag (default is true) allows to specify such slots that are to be kept private.
| unsigned int Wizt::VSlot::cached |
Specify whether this parameter should be cached, meaning: if this parameter is changed, should it trigger computing a new output result, or will that just be used from somewhere else? It is up to the VObject::update() routine to proper handle caching, which is non-trivial.
By default, parameters are not cached, so any change will trigger a new computation. This flag is checked by VObject::YoungestUncachedInput(). The typical use case scenario is like this:
The function VObject::YoungestUncachedInput() will determine the youngest age of all input slots that are have not set cached to be enabled.
| unsigned int Wizt::VSlot::ignoreConnectionAge |
| unsigned int Wizt::VSlot::inactive |
A flag to tell that this slot is currently inactive.
Means it is not used at the moment at all. It will therefore not be considered for any caching, and some GUI might want to hide it. Be cautious when setting this flag, because the activity of a slot might depend on the context, whereas this flag is global.
The flag must be set to true to specify inactivity. By default it is false.
Referenced by VSlot().
| int Wizt::VSlot::myInputClass = 0 |
By default, all slots are class zero.
By default, all slots that are not class zero will be ignored
Referenced by setClass().
| unsigned int Wizt::VSlot::pinned |
Specification whether this slot is considered relevant to be displayed in a certain application scenario.
Two bits are available to manage four levels of relevance.