Jump to content

LabVIEW Interface: Difference between revisions

From LabVIEW Wiki
Add description, key features and best practice
Add recommendation for project libraries over interfaces for function libraries.
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[File:Interface Icon.png|thumb|The interface icon as it appears in the [[Project Explorer]]]]
[[File:Interface Icon.png|thumb|The interface icon as it appears in the [[Project Explorer]]]]
'''LabVIEW Interface''' is a kind of [[class library]] that implements the concept of [[Wikipedia:interface (object-oriented programming)|interface]]s in LabVIEW. An interface defines a contract between the caller and the callee. Any class that inherits from an interface declares that it will provide all methods defined by that interface. In LabVIEW a class may have only one class parent and as many interface parents as it wants to have.<ref name="lvi-decision"/>
'''LabVIEW Interface''' is a kind of [[class library]] that implements the concept of [[Wikipedia:interface (object-oriented programming)|interface]]s in LabVIEW. An interface defines a contract between the caller and the callee. Any class that inherits from an interface declares that it will provide all methods defined by that interface. In LabVIEW a class may have only one class parent and as many interface parents as it wants to have.<ref name="lvi-decision"/> An interface may also inherit from one or more other interfaces.
<br clear="all">
<br clear="all">
==Key features==
==Key features==
Line 12: Line 12:
==Best practice==
==Best practice==
* Do not use the leading "I" when naming interfaces.<ref name="lvi-decision"/>
* Do not use the leading "I" when naming interfaces.<ref name="lvi-decision"/>
* Use a [[Project Library]] instead of default implementations in an interface to build function libraries.
==History==
==History==
{| class="wikitable"
{| class="wikitable"

Latest revision as of 08:03, 30 April 2020

The interface icon as it appears in the Project Explorer

LabVIEW Interface is a kind of class library that implements the concept of interfaces in LabVIEW. An interface defines a contract between the caller and the callee. Any class that inherits from an interface declares that it will provide all methods defined by that interface. In LabVIEW a class may have only one class parent and as many interface parents as it wants to have.[1] An interface may also inherit from one or more other interfaces.

Key features

  • Interfaces use the same file extension as classes (*.lvclass).
  • Interfaces have their own unique icon () in the Project Explorer.
  • Interfaces use the same default ("chain") wire appearance as classes.
  • Interfaces are created and changed using the same dialogs as classes.
  • Interfaces can provide default implementations for their methods.
  • Classes do not inherit the interface library icon or wire appearance.
  • Call Parent Class Method cannot invoke interface parent methods.

Best practice

  • Do not use the leading "I" when naming interfaces.[1]
  • Use a Project Library instead of default implementations in an interface to build function libraries.

History

Version Change(s)
LabVIEW 2020 Interfaces were added to LabVIEW

See also

References