I am sorry to ask such a basic question, but I have tied myself in knots over this.
I would like to have an object that has a reference (pointer) to another object, not an embedded copy of the object. In fact a list of pointers to objects something like tuple(classname, objectref)*
I probably haven't found the right part of the documentation - once gain apologies.
-
- Posts: 15
- Joined: 9 May 2021 9:55
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
Re: An Object 'pointer' - how to store references to objects
Here are three ways to store a "set/list" of person objects in an object:
If you actually need to store the person's under a key you can use a map:
Code: Select all
implement myObject
facts
person_fact : (person Person) nondeterm.
% use assert(person_fact(P)) to insert one more person.
facts
personList : person* := [].
% set a new list using personList := PL
facts
personSet : setM{person} := setM_redBlack::new().
% insert a person using personSet:insert(P).
Code: Select all
facts
personMap : mapM{string Name, person Person} := mapM_redBlack::new().
% insert a person using personMap:set(N, P)
Regards Thomas Linder Puls
PDC
PDC