![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
06/13/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Hi,
My address space models needs to represent at several places a list of objects.
- The list entries need to be of node class Object (cannot be of node class Variable).
- The entries of the list might change quite frequently (but not so frequently that insert/remove performance should be an issue).
The solution I know of so far is to use the 'OptionalPlaceholder' modelling rule. I see that often models define a MyObjectListType object which just has a single reference as OptionalPlaceholder pointing to a MyObject. This might be fine for an ObjectType which once instantiated refers to a static list of MyObject children. However, how would a client for a dynamically changing MyObjectListType instance handle:
- Get the length of the list
- Get an object with a specific index in the list.
- Add, remove objects
- etc...
So, basically, I'm looking for something which implements list semantics for objects.
Does something like that exist? Am I completely missing something here? If the answer is 'just use the OptionalPlaceholder solution', how would you address the above points?
Any input is much appreciated.
![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
07/05/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Jonas,
I would create an ObjectType,say MyObjectListType that includes:
- a method for addition of an object (maybe also deletion) - parameters to method can be use to provide any information needed for the creation of the child Object instance (would these child object have there own type?)
- an method for getting a specific instance object from the list.
- a variable that is part of the object that displays the length of the list.
- object includes a folder sub object that has all of the added instances (the instance could also just be added directly to the object if desired, but maybe a folder would make it easier to see what the dynamically added objects are)
I would use the method instead of the AddNode service, so that I could maintain items like the count of objects in the list and a structure that provides the ordering that is being asked for. Usually objects have relationships and are not an ordered list, just a list.
Paul
1 Guest(s)