MBVariableDeclaration Class Reference

Inherits from MBConditionalDeclaration : MBDataModel : MBFormattedDescriptionObject
Declared in MBVariableDeclaration.h

Overview

A partially-implemented root class that represents a variable declared in MBML.

The MBConcreteVariableDeclaration, MBSingletonVariableDeclaration, and MBDynamicVariableDeclaration classes provide specific implementations.

Variable information

  name

Returns the name of the variable.

@property (nullable, nonatomic, readonly) NSString *name

Declared In

MBVariableDeclaration.h

  isReadOnly

Returns YES if the variable contains a read-only value.

@property (nonatomic, readonly) BOOL isReadOnly

Declared In

MBVariableDeclaration.h

  disallowsValueCaching

Returns YES if the variable’s value should not be cached by the MBVariableSpace. By definition, such variables are also read-only.

@property (nonatomic, readonly) BOOL disallowsValueCaching

Declared In

MBVariableDeclaration.h

Accessing variable values

– initialValueInVariableSpace:error:

Returns the initial value of the variable in the given variable space.

- (nullable id)initialValueInVariableSpace:(nonnull MBVariableSpace *)space error:(MBExpressionErrorPtrPtr)errPtr

Parameters

space

The MBVariableSpace for which the initial value is to be retrieved.

errPtr

If non-nil and an error occurs during retrival of the variable value, *errPtr will be set to an MBExpressionError object describing the error.

Discussion

Note: This method should not be called for variables whose disallowsValueCaching property returns YES; in such cases, an exception is raised.

Declared In

MBVariableDeclaration.h

– currentValueInVariableSpace:error:

Returns the current value of the variable in the given variable space.

- (nullable id)currentValueInVariableSpace:(nonnull MBVariableSpace *)space error:(MBExpressionErrorPtrPtr)errPtr

Parameters

space

The MBVariableSpace for which the current value is to be retrieved.

errPtr

If non-nil and an error occurs during retrival of the variable value, *errPtr will be set to an MBExpressionError object describing the error.

Declared In

MBVariableDeclaration.h

Variable value change hook

– valueChangedTo:inVariableSpace:

Called when a mutable variable value has changed.

- (void)valueChangedTo:(nullable id)value inVariableSpace:(nonnull MBVariableSpace *)space

Parameters

value

The new value of the variable.

space

The MBVariableSpace instance that owns the receiver.

Declared In

MBVariableDeclaration.h