LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Type Map for Shared Variable

Solved!
Go to solution

Why is there no Data Type Map in Shared Variable?

I would love to share a map containing clusters of timestamp and variant.

0 Kudos
Message 1 of 6
(395 Views)

The Shared Variable predates LabVIEW Maps by many many years. And NI hasn't made significant updates to the Shared Variable engine in a long time. Besides, it is arguable if such complex data types such as Maps are very useful to transfer like that. The overhead of a Map in terms of memory to be able to reconstruct it exactly on the remote side is also considerable.

 

Maybe you can put it in a Variant and transfer it as such? It's a guess but may work. On the other hand I'm not exactly sure of the exact underlaying nature of a Map. If it is more analogues to a refnum rather than a value variable (there could be good performance arguments for that) the Variant may not capture the content of the Map but just its reference. And that would mean nothing on the remote side.

Rolf Kalbermatter
My Blog
Message 2 of 6
(366 Views)

@Quiztus2 wrote:

Why is there no Data Type Map in Shared Variable?

I would love to share a map containing clusters of timestamp and variant.


Are you talking about a network shared variable or something local? If you don't require the network part, you can contain your map fully into an action engine.

0 Kudos
Message 3 of 6
(330 Views)

It's the network case. A map would be great to share variables dynamically. Putting the map into a variant is a interesting idea.

0 Kudos
Message 4 of 6
(305 Views)
Solution
Accepted by Quiztus2

I am still trying to wrap my head around the use case here. A typical map is a large data structure and having it in a shared variable would require every operation (lookup, add, delete, etc.)  to copy that data structure to the caller and back. This seems like a gigantic overhead!

 

If you embed the map into an action engine as suggested, the map data stays isolated and only the item is transported. You could even implement it as a simple map server if operations are required across networked devices.

 

0 Kudos
Message 5 of 6
(272 Views)

Good point with the size. I came to this use case, since the creation of ordinary shared variables during runtime seemed not easy or impossible. I thought a map could have been a workaround for this. But I didn't consider the overhead here. I moved on to DataSocket dstp protocol, which allows creation on runtime.

0 Kudos
Message 6 of 6
(254 Views)