LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Access scope for polymorphic VI's- public for polymorph, private for selected VI?

I'm a bit new to LVOOP so please let me know if I'm doing something fundamentally wrong here.

 

I'm working on a test application that can have a number of different types of tests. To keep it simple, pretend it's a DC motor which needs to be tested for torque and speed. I have a generic "MotorTest.lvclass" that holds data common to all tests- for example, the serial number of the motor or the connection pin. I then have "TorqueTest.lvclass" and "SpeedTest.lvclass" that are child classes to MotorTest.lvclass, and contain test-specific data (such as desired torque level, external cooling, etc.)

 

Currently, to initialize a test, I use a polymorphic VI in the MotorTest.lvclass that lets you select between InitializeTorqueTest.vi and InitializeSpeedTest.vi. This works well, however, I'm having an issue determining how to scope things. I'd prefer it to be required that you use the polymorphic VI to initialize a test, rather than directly using the InitializeTorqueTest/SpeedTest subVI's from the child classes. However, I don't know how to scope the specific initialization subVI's such that they can be called from the parent class but not from anywhere else. The specific initialization VI's can't be Private or Protected, as then the polymorphic parent VI can't access them.

 

It seems that this would be done using the Community scope, but somehow having a Parent class be a Friend of a Child class seems to be "cheating the system". Surely there is a way around this somehow?

 

(As a side note, let me know if this architecture doesn't make sense. I tried to base it around the daqMX pattern of a single polymorphic VI selecting the type of task to initialize).

0 Kudos
Message 1 of 1
(2,173 Views)