Interface ModelCenter::IArray
Last update: 16.07.2025
Definition: ModelCenter/src/ModelCenter.odl (line 421)
Base class for all array types. Has common functionality for getting/setting array sizes and getting/setting values as strings.
Arrays start at 0 length by default. So you must set the size before you can assign individual array elements.
Inherits from:
Inherited by:
- ModelCenter::IBooleanArray
- ModelCenter::IDoubleArray
- ModelCenter::IFileArray
- ModelCenter::IIntegerArray
- ModelCenter::IReferenceArray
- ModelCenter::IStringArray
Members
- autoSize
- dependentLinks
- dependents
- directDependents
- directPrecedents
- fromString
- fromStringEx
- getDimensions
- getFullName
- getLength
- getMetadata
- getName
- getSize
- getType
- hasChanged
- hide
- invalidate
- isInput
- isInputToComponent
- isInputToModel
- isValid
- length
- numDimensions
- OwningComponent
- precedentLinks
- precedents
- setDimensions
- setLength
- setMetadata
- setSize
- size
- toString
- toStringAbsolute
- toStringAbsoluteEx
- toStringEx
- validate
Properties
Property hasChanged
Definition: ModelCenter/src/ModelCenter.odl (line 1)
boolean ModelCenter::IArray::hasChanged
Return type: boolean
Property hide
Definition: ModelCenter/src/ModelCenter.odl (line 1)
boolean ModelCenter::IArray::hide
Return type: boolean
Property OwningComponent
Definition: ModelCenter/src/ModelCenter.odl (line 1)
LPDISPATCH ModelCenter::IArray::OwningComponent
Return type: LPDISPATCH
Property size
Definition: ModelCenter/src/ModelCenter.odl (line 1)
long ModelCenter::IArray::size
Alias for length property
Return type: long
Property autoSize
Definition: ModelCenter/src/ModelCenter.odl (line 1)
boolean ModelCenter::IArray::autoSize
Whether or not the array is set to automatically size itself. If false and the array is linked from upstream, the upstream array must be exactly the same size or an error ensues. If true, the array will resize itself when the link is validated.
Return type: boolean
Property numDimensions
Definition: ModelCenter/src/ModelCenter.odl (line 1)
long ModelCenter::IArray::numDimensions
Number of dimensions this array has. Defaults to 1. Changing the number of dimensions will lose all previous data in the array.
Return type: long
Property length
Definition: ModelCenter/src/ModelCenter.odl (line 1)
long ModelCenter::IArray::length
Size of the array. Alias for the length property. Only useful if the array is 1 dimensional. Use the getLength(), setLength(), numDimensions, or setDimensions() methods and properties for multi-dimensional arrays On initialization, the array is 0 length by default. To fill in values on a newly created array, set the size/length first.
Return type: long
Public functions
Function isValid
boolean ModelCenter::IArray::isValid()
Finds out whether or not the array is valid.
Returns:
yes(TRUE) or no(FALSE).
Return type: boolean
Reimplements: isValid
Reimplemented by:
Function validate
void ModelCenter::IArray::validate()
Causes the array to validate itself.
Return type: void
Reimplements: validate
Reimplemented by:
Function getName
BSTR ModelCenter::IArray::getName()
Gets the name of the array.
Returns:
The name of the array.
Return type: BSTR
Reimplements: getName
Reimplemented by:
Function getFullName
BSTR ModelCenter::IArray::getFullName()
Gets the full ModelCenter path of the array.
Returns:
The full ModelCenter path of the array.
Return type: BSTR
Reimplements: getFullName
Reimplemented by:
Function getType
BSTR ModelCenter::IArray::getType()
Gets the type of the array.
Returns:
The type of the array as a string.
Return type: BSTR
Reimplements: getType
Reimplemented by:
Function isInput
boolean ModelCenter::IArray::isInput()
Finds out whether or not the variable is an input with respect to the model. Returns the same value as isInputToModel.
Return values:
- true: Input
- false: Output
Return type: boolean
Reimplements: isInput
Reimplemented by:
Function toString
BSTR ModelCenter::IArray::toString()
Converts the array to a string, validating the array if necessary. If the variable is an array, it will to be of the form "1, 2, 3" for one-dimensional arrays or "bounds[3,3] {1, 2, 3, 4, 5, 6, 7, 8, 9}" for multi-dimensional arrays.
Returns:
The converted string value of the array.
Return type: BSTR
Reimplements: toString
Reimplemented by:
Function fromString
void ModelCenter::IArray::fromString(BSTR value)
Sets the value of the array from a specified string. For 1D arrays, the specification is of the form '1,2,3'.
For nD arrays, the specification is of the form 'bounds[2,2,2] {1,2,3,4,5,6,7,8}'.
String arrays may optionally have the elements quoted in the form 'bounds[2,3] {"a", "b,c", "d", "", "e", "f"}'
Parameters:
- value: New value.
Parameters:
- BSTR value
Return type: void
Reimplements: fromString
Reimplemented by:
Function toStringAbsolute
BSTR ModelCenter::IArray::toStringAbsolute()
Converts the array to a string. If the variable is an array, it will to be of the form "1, 2, 3" for one-dimensional arrays or "bounds[3,3] {1, 2, 3, 4, 5, 6, 7, 8, 9}" for multi-dimensional arrays.
Returns:
The converted string value of the array.
Return type: BSTR
Reimplements: toStringAbsolute
Reimplemented by:
- toStringAbsolute
- toStringAbsolute
- toStringAbsolute
- toStringAbsolute
- toStringAbsolute
- toStringAbsolute
Function invalidate
void ModelCenter::IArray::invalidate()
Marks the variable as invalid (needs to be computed). This will set all dependent variables invalid also.
Return type: void
Reimplements: invalidate
Reimplemented by:
Function directPrecedents
LPDISPATCH ModelCenter::IArray::directPrecedents([optional]VARIANT followSuspended, [optional]VARIANT reserved)
Returns a list of variables that are immediate precedents to the value of this variable. This function returns all variables that influence this variable and are directly connected via a link to it.
Parameters:
- followSuspended: Optional boolean specifies whether links which are suspended should be included in the search. Default is false.
- reserved: Reserved for future use.
Returns:
IDispatch* to an IVariables object.
Parameters:
- [optional] VARIANT followSuspended
- [optional] VARIANT reserved
Return type: LPDISPATCH
Reimplements: directPrecedents
Reimplemented by:
- directPrecedents
- directPrecedents
- directPrecedents
- directPrecedents
- directPrecedents
- directPrecedents
Function directDependents
LPDISPATCH ModelCenter::IArray::directDependents([optional]VARIANT followSuspended, [optional]VARIANT reserved)
Returns a list of variables that are immediate dependents of the value of this variable. This function returns all variables that are influenced by this variable and are directly connected via a link to it.
Parameters:
- followSuspended: Optional boolean specifies whether links which are suspended should be included in the search. Default is false.
- reserved: Reserved for future use.
Returns:
IDispatch* to an IVariables object.
Parameters:
- [optional] VARIANT followSuspended
- [optional] VARIANT reserved
Return type: LPDISPATCH
Reimplements: directDependents
Reimplemented by:
- directDependents
- directDependents
- directDependents
- directDependents
- directDependents
- directDependents
Function precedentLinks
LPDISPATCH ModelCenter::IArray::precedentLinks([optional]VARIANT reserved)
Returns a list of links that are immediate precedents to the value of this variable. All the returned links will have this variable as the LHS of the equation. Except for arrays, the returned list will be 1 element long.
Parameters:
- reserved: Reserved for future use.
Returns:
IDispatch* to an IVariableLinks object.
Parameters:
- [optional] VARIANT reserved
Return type: LPDISPATCH
Reimplements: precedentLinks
Reimplemented by:
Function dependentLinks
LPDISPATCH ModelCenter::IArray::dependentLinks([optional]VARIANT reserved)
Returns a list of links that immediately depend on the value of this variable. All the returned links will have this variable as part of a RHS equation.
Parameters:
- reserved: Reserved for future use.
Returns:
IDispatch* to an IVariableLinks object.
Parameters:
- [optional] VARIANT reserved
Return type: LPDISPATCH
Reimplements: dependentLinks
Reimplemented by:
Function precedents
LPDISPATCH ModelCenter::IArray::precedents([optional]VARIANT followSuspended, [optional]VARIANT reserved)
Returns a list of variables that are precedents to the value of this variable. This function returns all variables that influence this variable, not just directly connected ones.
Parameters:
- followSuspended: Optional boolean specifies whether links which are suspended should be included in the search. Default is false.
- reserved: Reserved for future use.
Returns:
IDispatch* to an IVariables object.
Parameters:
- [optional] VARIANT followSuspended
- [optional] VARIANT reserved
Return type: LPDISPATCH
Reimplements: precedents
Reimplemented by:
Function dependents
LPDISPATCH ModelCenter::IArray::dependents([optional]VARIANT followSuspended, [optional]VARIANT reserved)
Returns a list of variables that are dependent upon the value of this variable. This function returns all variables that are influenced by this variable, not just directly connected ones.
Parameters:
- followSuspended: Optional boolean specifies whether links which are suspended should be included in the search. Default is false.
- reserved: Reserved for future use.
Returns:
IDispatch* to an IVariables object.
Parameters:
- [optional] VARIANT followSuspended
- [optional] VARIANT reserved
Return type: LPDISPATCH
Reimplements: dependents
Reimplemented by:
Function isInputToComponent
boolean ModelCenter::IArray::isInputToComponent()
Checks whether or not the variable is an input. Returns true if the variable was originally added as an input, ignoring the current state that can change based off of links.
Return values:
- true: Input
- false: Output
Return type: boolean
Reimplements: isInputToComponent
Reimplemented by:
- isInputToComponent
- isInputToComponent
- isInputToComponent
- isInputToComponent
- isInputToComponent
- isInputToComponent
Function isInputToModel
boolean ModelCenter::IArray::isInputToModel()
Checks whether or not the variable is an input. A linked input returns false (Output).
Return values:
- true: Input
- false: Output
Return type: boolean
Reimplements: isInputToModel
Reimplemented by:
Function setMetadata
void ModelCenter::IArray::setMetadata(BSTR name, MetadataType type, VARIANT value, MetadataAccess access, boolean archive)
Sets the meta data value of the given meta data key name.
Parameters:
- name: Metadata specifier used to store the data.
- type:
- value:
- access:
- archive:
Parameters:
- BSTR name
- MetadataType type
- VARIANT value
- MetadataAccess access
- boolean archive
Return type: void
Reimplements: setMetadata
Reimplemented by:
Function getMetadata
VARIANT ModelCenter::IArray::getMetadata(BSTR name)
Gets the meta data value of the given meta data key name.
Parameters:
- name: Metadata key name.
Returns:
Metadata value.
Parameters:
- BSTR name
Return type: VARIANT
Reimplements: getMetadata
Reimplemented by:
Function toStringEx
BSTR ModelCenter::IArray::toStringEx(long index)
Converts the value of an array element to a string, validating the array if necessary.
Parameters:
- index: Index of the array element (0-based index).
Returns:
The value of the element as a string.
Parameters:
- long index
Return type: BSTR
Reimplemented by:
Function fromStringEx
void ModelCenter::IArray::fromStringEx(BSTR value, long index)
Sets the value of an array element from a specified string.
Parameters:
- value: New value.
- index: Index of the array element (0-based index).
Parameters:
- BSTR value
- long index
Return type: void
Reimplemented by:
Function toStringAbsoluteEx
BSTR ModelCenter::IArray::toStringAbsoluteEx(long index)
Converts the value of an array element to a string.
Parameters:
- index: Index of the array element (0-based index).
Returns:
The value of the element as a string.
Parameters:
- long index
Return type: BSTR
Reimplemented by:
- toStringAbsoluteEx
- toStringAbsoluteEx
- toStringAbsoluteEx
- toStringAbsoluteEx
- toStringAbsoluteEx
- toStringAbsoluteEx
Function getLength
long ModelCenter::IArray::getLength([optional] VARIANT dim)
Get the length of the n'th dimension of the array.
Parameters:
- dim: Dimension of the array to query. This uses a 0 based index, so 0 will give you the first dimension, 1 the second, etc. If omitted, gives the first dimension
Returns:
Length(size) of the array.
Parameters:
- [optional] VARIANT dim
Return type: long
Reimplemented by:
Function setLength
void ModelCenter::IArray::setLength(long length, [optional] VARIANT dim)
Sets the length of the n'th dimension of the array
Parameters:
- length: New length of the n'th dimension of the array
- dim: The dimension to set. This uses a 0 based index, so 0 will set the first dimension, 1 the second, etc. If omitted, sets the first dimension
Parameters:
- long length
- [optional] VARIANT dim
Return type: void
Reimplemented by:
Function setDimensions
void ModelCenter::IArray::setDimensions(long d1, [optional] VARIANT d2, [optional] VARIANT d3, [optional] VARIANT d4, [optional] VARIANT d5, [optional] VARIANT d6, [optional] VARIANT d7, [optional] VARIANT d8, [optional] VARIANT d9, [optional] VARIANT d10)
Sets the number of dimensions of an array and the length of each dimension in one call. An array initializes to 0 length. If any dimension of the array has 0 length, the whole array contains no data. You must set the array size before filling in values unless you are using the setArray() call.
Parameters:
- d1: length of the 1st dimension of the array
- d2: length of the 2nd dimension of the array. If omitted, the array is 1 dimensional
- d3: length of the 3rd dimension of the array. If omitted, the array is 2 dimensional
- d4: length of the 4th dimension of the array. If omitted, the array is 3 dimensional
- d5: length of the 5th dimension of the array. If omitted, the array is 4 dimensional
- d6: length of the 6th dimension of the array. If omitted, the array is 5 dimensional
- d7: length of the 7th dimension of the array. If omitted, the array is 6 dimensional
- d8: length of the 8th dimension of the array. If omitted, the array is 7 dimensional
- d9: length of the 9th dimension of the array. If omitted, the array is 8 dimensional
- d10: length of the 10th dimension of the array. If omitted, the array is 9 dimensional
Parameters:
- long d1
- [optional] VARIANT d2
- [optional] VARIANT d3
- [optional] VARIANT d4
- [optional] VARIANT d5
- [optional] VARIANT d6
- [optional] VARIANT d7
- [optional] VARIANT d8
- [optional] VARIANT d9
- [optional] VARIANT d10
Return type: void
Reimplemented by:
Function getSize
long ModelCenter::IArray::getSize([optional] VARIANT dim)
Alias for the getLength() call
Parameters:
- dim: Dimension of the array to query(0-based index).
Returns:
Size of the dimension
Parameters:
- [optional] VARIANT dim
Return type: long
Function setSize
void ModelCenter::IArray::setSize(long length, [optional] VARIANT dim)
Alias for the setLength() call
Parameters:
- length: Length of the specified dimension
- dim: The dimension to set (0-based index).
Parameters:
- long length
- [optional] VARIANT dim
Return type: void
Function getDimensions
VARIANT ModelCenter::IArray::getDimensions()
Gets the dimensions of the array.
Returns:
Variant - either a single integer, in the case of a 1D array, or an array of integers, in the case of multi-dimensional arrays.
Return type: VARIANT