Page 1 of 1

DataTypeDictionary consistency and lifetime

Posted: 18 Jan 2018, 09:49
by ralphlange
On the client side (C++),
I can get the structure definition of an ExtensionObject through calling the DataTypeDictionary that is an interface, i.e. a part of the Session.

Question: is the definition for any given DataTypeId constant over the lifetime of the session? Or can the server change a user defined data structure while keeping the session alive?

Use case: the client is monitoring a large user defined structure, and needs to get out a small number of its elements that it knows by name. Getting the structure definition and searching for the matching elements takes time. Can the client store the indices of the elements it is interested in when doing the first read, and just directly read the elements using the stored indices on all further data updates during the session?

Re: DataTypeDictionary consistency and lifetime

Posted: 20 Mar 2018, 21:46
by Support Team

it is strongly recommended that the server keeps the data structure layout (DataTypes) unchanged (except for dynamic data like arrays or strings).
If a structure data type changes, it is strongly recommended to create a new DataType with a new NodeId.
But a server may miss-behave.

But a change in the structure would most likely cause an decoding error on the client side or creates random invalid data in the resulting structure.

If you refer in your question to the index of the structure field, you can assume the index as stable.