# IRsGenArray Struct Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | Clear (void)
HRESULT | SetDim ([in] RtUlong ulDim)
HRESULT | GetDim ([out, retval] RtUlong *pulDim)
HRESULT | SetSize ([in, satype(VARIANT)]SAFEARRAY *psa)
HRESULT | GetSize ([in, optional] VARIANT optionalDim,[out, retval] RtUlong *pulSize)
HRESULT | SetAt ([in, satype(VARIANT)]SAFEARRAY *psa)
HRESULT | GetAt ([in, satype(VARIANT)]SAFEARRAY *psa,[out, retval] VARIANT *pVal)
HRESULT | Add ([in] VARIANT newVal)
HRESULT | InsertAt ([in] RtUlong ulIndex,[in] VARIANT newVal)
HRESULT | RemoveAt ([in] RtUlong ulIndex)

## Detailed Description

IRsGenArray is a general interface for common array data objects.

## Member Function Documentation

HRESULT IRsGenArray::Clear | ( | void |  | ) |

Clear (initialize) the data object

HRESULT IRsGenArray::SetDim | ( | [in] RtUlong | ulDim | ) |

Set dimension of the array (default is 1)

Parameters:

  | ulDim | - dimension

HRESULT IRsGenArray::GetDim | ( | [out, retval] RtUlong * | pulDim | ) |

Get dimension of the array

Parameters:

  | pulDim | - return dimension

HRESULT IRsGenArray::SetSize | ( | [in, satype(VARIANT)] SAFEARRAY * | psa | ) |

Set array size (one number for each dimension). Note: The Add method automatically increase the size in case of one-dim array.

Parameters:

  | psa | - variable number of size integers - one for each dimension

Example: define 2 dimensional array

     array.SetDim(2); array.SetSize(10, 10);

HRESULT IRsGenArray::GetSize | ( | [in, optional] VARIANT | optionalDim,
|  | [out, retval] RtUlong * | pulSize |
| ) |  |  |

Get array size (one number for each dimension).

Parameters:

  | optionalDim | - optional, requested dimension to get size for (zero-based)
  | pulSize | - return size for given dimension

HRESULT IRsGenArray::SetAt | ( | [in, satype(VARIANT)] SAFEARRAY * | psa | ) |

Set one item to the array at given position. Array indices are zero-based.

Parameters:

  | psa | - variable number of item coordinates, the last parameter is the item value to be set

Example: set item to 1 dim array

     array.SetAt(2, "foosa")

set item to 2 dim array

     array.SetAt(3, 5, myObject)

HRESULT IRsGenArray::GetAt | ( | [in, satype(VARIANT)] SAFEARRAY * | psa,
|  | [out, retval] VARIANT * | pVal |
| ) |  |  |

Get one item from array at given position. Array indices are zero-based.

Parameters:

  | psa | - variable number of item coordinates
  | pVal | - return item value

Example: get item from 1 dim array

     item = array.GetAt(5)

HRESULT IRsGenArray::Add | ( | [in] VARIANT | newVal | ) |

Append new item to the array Note: only works for 1 dimensional arrays!

Parameters:

  | newVal | - new item value

HRESULT IRsGenArray::InsertAt | ( | [in] RtUlong | ulIndex,
|  | [in] VARIANT | newVal |
| ) |  |  |

Insert new item at specified position, increasing array size Note: only works for 1 dimensional arrays!

Parameters:

  | ulIndex | - zero based array index
  | newVal | - new item value

HRESULT IRsGenArray::RemoveAt | ( | [in] RtUlong | ulIndex | ) |

Remove item with specified index, decreasing array size Note: only works for 1 dimensional arrays!

Parameters:

  | ulIndex | - zero based array index