5.8.3 ArraySlot classes

class ArraySlot( multiplicity=1, constraint=None)
Create an array slot.

multiplicity is the ``array length'' of one individual item.

constraint is a SizeConstraint object that constrains the size of the array slot (see section 5.8.4).

size( )
Return the number of elements in this array slot.

isResizable( size, ignorelocalconstraint=False)
Check if this slot can currently be resized to a particular size. This method can be used to check if calling resize() with size as argument would succeed or not.

The method returns False if either the slot itself is size constrained or it is connected to a size constrained slot. In the latter case, the function will return True again if the connection is removed. The method will also return True if size matches the constraint size.

If ignorelocalconstraint is True the method will compute its result as if there would no constraint be present in this slot (so only dependent objects could reject the resize operation).

resize( size)
Resize the array slot so that it can carry size elements. The values in the array are not modified by this operation.

multiplicity( )
Return the multiplicity of the array slot.

copyValues( begin, end, target, index)
Copies the slice [begin : end] into position index of the slot target. If you want to copy one single value you have to pass [n, n+1]. It is also possible to pass negative values. For the copy operation to succeed, target has to be of the same type than this slot.

If any index is out of range, an exception is thrown.

Note: If this method is used to copy values within the same slot then the target range shouldn't currently overlap with the source slice.

isSlotCompatible( slot)
Return True if slot is compatible with this slot. Two slots are compatible if they hold the same type of value. Only compatible slots can be connected to each other. But note that even when this method returns true, it can happen that the slots can not be connected. This is the case whenever the target just doesn't accept input connections (for example, because it's computing its output value procedurally).

typeName( )
Return a string containing the name of the stored type. This name can be used to display the type of the slot to the user. The name should be chosen so that if two slots cannot be connected to each other then they should also return different names (however, if two slots have different names it is still possible that they can be connected to each other).

getController( )
Return the associated controlling slot or None.

setController( slot)
Set or remove a controller for this slot. The current controller is replaced with slot which may also be None to remove the current controller only. If the controller is not compatible with this slot an EIncompatibleSlotTypes exception is thrown.

getValue( index)
Return one item of the array slot. If the multiplicity of the slot is 1 then return value is just an individual value, otherwise it's a tuple containing the values.

setValue( index, value)
Set one item to a new value. If the multiplicity of the slot is 1 value has to be one single value, otherwise it must be a sequence containing multiplicity elements.

connect( slot)
Connect the output of this slot with the input of slot. Calling this method is equivalent to calling slot.setController(self).

addDependent( d)
Establish a dependency between this slot and another object d. The argument d is added to the list of dependent objects. This means that d somehow depends on the value of this slot and that d has to be notified whenever the value of this slot changes. The actual notification is done by calling notifyDependents() which in turn calls onValueChanged() on all dependent objects.

Todo: C++ warning!

removeDependent( d)
Remove the dependency between this slot and another object d.