Jump to content

Vinicius

Members
  • Posts

    1
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

LabVIEW Information

  • Version
    LabVIEW 2009
  • Since
    2004

Contact Methods

  • Twitter Name
    vfalseth

Vinicius's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I started using LabVIEW 2009 a few weeks ago. I developed most of my systems following the paradigm of object orientation. For this, I always used the GOOP Wizard tool available on the NI website. With the launch of the new version of LabVIEW, I decided to do some tests to evaluate the new feature of object orientation. In the GOOP framework each object is a reference, which simplifies parameter passing by reference. This is done transparently by the framework and the developer does not need to worry about the details. After analyzing the LabVIEW 2009 OO framework, I realized that passing parameters by reference is more laborious. However, after several searches on the NI website and Google, I found some tricks that can be used to work with OO by ref. I read some comments posted in LAVA forum. Then, I implemented a pattern suggested by Jim Kring: creating an attribute in the class to store a reference (DVR) for all other attributes. The first tests were successful. However, I started having problems to implement inheritance. The following example ilustrates the problem. The "Parent" class has the following structure: - active: boolean - priority: int32 - randomValue: double + run() The "Child" class inherits from "Parent" and has the structure shown below: - name: string + run() In LabVIEW, I created a type (DataMembers.ctl) with the attributes of each class. The type (DataMembers.ctl) of Child class references the type of the Parent class. In the private data of each class ("Class Private Data"), I created just one reference (DVR) for the attributes (type DataMembers.ctl). The private data structure of each class can be seen below: Parent.ctl: - mySelf: DVR (type DataMembers.ctl of Parent class) Child.ctl: -mySelf: DVR (type DataMembers.ctl of Child class) DataMembers.ctl (Parent class): - active: boolean - priority: int32 - randomValue: double DataMembers.ctl (Child class): - active: boolean - priority: int32 - randomValue: double - name: string The method run of Child class invokes the method run of the Parent class. In the method run of Parent class, the attribute "randomValue" is updated. In the method run of Child class, the attribute "name" is updated. However, there is a problem in this pattern that I implemented: the Child class stores two references (DVR) due to inheritance. When a Parent class method is invoked, the attributes are updated using the reference of Parent class (attribute "mySelf"). On the other side, when a Child class method is invoked, the attributes are updated using the reference of Child class. What can I do to solve this problem? Thanks in advice.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.