question

Kim Jh avatar image
1 Like"
Kim Jh asked Joerg Vogel edited

How to get the object(ex. Queue) that is connected to NetworkNode?

Choose One
network nodesnetwork station
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Brandon Peterson avatar image
4 Likes"
Brandon Peterson answered

Kim Jh,

The following code will print the names of the objects connected to a network node designated as the so() object. You can replace the so() reference with any method that you find easier to use.

treenode networknode = so();
treenode stations = getvarnode(networknode, "stations");
for(int i1 = 2; i1 <= content(stations); i1++){
	treenode tempobj = ownerobject(tonode(getnodenum(rank(stations, i1))));
	pr(); pt(getname(tempobj));
}

Basically, the references to the objects connected to the network nodes are stored as couplings in the stations variable on the network node. The first node is a coupling to itself and the remaining are to any objects that are connected to the network node (That is why the for loop starts at 2). The code that sets the tempobj variable is the method that I use for getting the object that owns the other side of the coupling reference.

Good Luck,

Brandon

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.