LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Class

Solved!
Go to solution

HI,
Lets consider there are 3 classes as A,B,C. Class A is parent of Class B and C. I'll be read a class object from file using "Get LV class default value.vi" using Class B API.
I just need to check whether that read object is object of same class or its parent class i.e., It can be either class B or Class A.

How can I test it?

0 Kudos
Message 1 of 4
(2,126 Views)

Use To More Specific Class to try to cast the object to Class A and/or Class B.  You will get an error if it can't.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(2,116 Views)

Test Condition: Class Path specified in file should be

1) either Class A or B,
2)  It should not be Class C.

Let say, The input object is Class B and typecast to Class B, then there will not be any error. But if input path is class A, it will throw the error.

If I'm using to more generic property for casting input object to Class A, the condition (i) pass but condition two fails.

0 Kudos
Message 3 of 4
(2,109 Views)
Solution
Accepted by topic author PadmanabanJ

The only other solution I am coming up with is to use the Get LV Class Name VI to get a string of the object's class name and do a comparison to what you expect it to be (have an array of allowed classes and use Search 1D Array, the index will be negative if the name is not found).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(2,087 Views)