There are three different two mappings for a Slice dictionary, depending on its key and value type:
Key Type | Value Type | Mapped Type | Comments | |||
---|---|---|---|---|---|---|
string , enum or numeric | Any | containers.Map | Enumeration keys must be converted to integers. | |||
struct | Any | Native struct array | containers.Map does not support user-defined key types.struct | class | Ice.StructArrayHandle | Maps to a handle type to support the Ice run time's unmarshaling requirements. |
The mapping generates a class with the same name as the dictionary. This class provides one useful function for applications: a new
function that returns an empty instance of the mapped type.
...
We recommend using the new
function to reduce the possibility of run-time errors.
Ztop |
---|
Mapping to struct array
...
Each element of the struct array must have key
and value
fields whose types are compatible with those of the mapped types for the Slice dictionary's key and value.
Ztop |
---|
Mapping to Ice.StructArrayHandle
A dictionary with a structure key type and a class value type maps to Ice.StructArrayHandle
. As its name implies, this simple class derives from handle
and has a single member that is a struct array:
Code Block | ||
---|---|---|
| ||
classdef StructArrayHandle < handle
properties
array
end
end |
You will use the array
member as described above for the struct array mapping.
Consider this example:
Code Block | ||||
---|---|---|---|---|
| ||||
struct ID
{
string symbol;
string exchange;
}
class Quote
{
double price;
string currency;
}
dictionary<ID, Quote> Quotes; |
We can construct this dictionary in MATLAB as follows:
...
title | MATLAB |
---|
...
value
...
.
...
Ztop |
---|