LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LOOP passing data between classes

Solved!
Go to solution

Hello guys,

 

I am working on a LV program that will have different classes for different parts of a program.

But some of the data from the classes should be available to other classes. I know this could be done with "read VI" (class A) and connect to "write VI" (class B). This is functional, but in my opinion it is not so neat.

 

I hope you can point me to a better solution. In my opinion the best solution would be to connect two classes into one VI, and then share data with boundle/unboundle function, but LabView doesn't allow boundle/unboundle two classes in one VI.

 

What are your solution guys?

Do I have to learn parent/child classes first?

 

Thanks in advance.

0 Kudos
Message 1 of 3
(2,481 Views)
Solution
Accepted by topic author Jakob_Pin

Hi Jakob,

 

Yes - data in a class is inherently private. Even if you are a child of another class, you can't read their data directly. You must use an accessor (Read VI, etc).

 

It might be possible to design your classes in a way that reduces the need for accessor use - if you are finding that you're always using Read and Write accessors to do anything, you might be able to find a better design. This kind of "problem" might suggest that you're storing the wrong data, or that your classes are very closely "coupled".

 

If you tell us more about your design, it might be I or someone else could suggest possible changes to reduce this coupling or dependence on another class' private data.


GCentral
Message 2 of 3
(2,468 Views)

Hello ,

 

Yes, data flow and storage must be thoughtfully designed within classes. I agree with that.

 

I don't really have a problem with that, but I just wanted to know for a better solution.

 

Thank you for your answer.

BR, Jakob

0 Kudos
Message 3 of 3
(2,454 Views)