VISH
0.2
|
A ValuePool is the home of local values of certain input objects. More...
#include </home/werner/origo/vish/ocean/plankton/ValuePool.hpp>
A ValuePool is the home of local values of certain input objects.
When an input object is queried for its value, a VContext is specified. This VContext may refer to a pool of alternative copies.
The ValuePool provides two interfaces to access stored values:
However, the ValuePool may also host a local copy of variables which co-exist permanently. They are used by the VParameter only if it set to local, but are not destroyed when switching to global. As such, these local values may well reside as part of multiple VObjects.
Class skeleton (main purpose is to map ValueNotifierLists to VValueBases. It's basic structure is of the type
class ValuePool : public map<WeakPtr<ValueNotifierList>, RefPtr<VValueBase> > {};
whereby a ValuePool provides some additional properties like being an Intercube and a mutex for multithreaded operations. However, it should be avoided to lock an operation on a ValuePool since accessing the ValuePool is a very frequent operation.
Wizt::ValuePool::ValuePool | ( | ) |
Constructor, should set identifier name later since the default name is somewith unique, but weird.
Calling this constructor should be avoided.
void Wizt::ValuePool::activate | ( | const RefPtr< ValuePool > & | OldPool, |
const WeakPtr< ValueNotifier > & | who = NullPtr() , |
||
const ValueMap * | VP = 0 |
||
) | const |
Activate this set of variables, which induces sending a notification request (i.e.
ValueNotifier::valueChanged() ) for all stored values.
OldPool | The previous pool of variables. It is required to determine which variables are changing at this activate() request and should receive a notify() call. Such circumstances arise when
|
Broadcast a value change event to all listening notifiers.
void Wizt::ValuePool::createVariable | ( | const Key_t & | Key, |
const RefPtr< VValueBase > & | v | ||
) |
Create the shadow of a variable in this pool, using the specified value.
Key | The notifier list, which is used as reference |
v | An existing variable, which contains the value. |
Get a value pool that is associated with a certain name in the global database.
It is not recommended to use this function, value pools should always be passed to calling routines that need them.
bool Wizt::ValuePool::removeValue | ( | const string & | name | ) |
Remove the association of a local variable with a name.
Note that this association is removed anyway on destruction of a local variable since only weak pointers are stored here.