ooPIC Logo

Link Method

Main Index
Language Idx
Back to top of pageDescription:
 
A method that sets a pointer so that it is pointing to another object. 
Back to top of pageSyntax:
 
The following shows the format of the Link Method syntax.
baseobject.pointerproperty.Link(linkobject.propertytolink)
Back to top of pageOperation:
 
When a Link method is encountered during the program's execution, the Object's Property, which is given as the argument, is assigned to the Base Object's Pointer that is specified in the Link. After the Link method is executed, the Base Object will use the value of the linked Property for its operation.

When a pointer is created, it is defined to be a pointer to a specific kind of object.  The Link Method will only allow that kind of object to be used as an argument.

The predefined objects that come with the ooPIC Compiler always use one of two objects when creating their pointers that they use. The first is the oValue Object and the second is the oLogic Object.

A oLogic Object pointer expects to be pointed to an oLogic Object or an object that has a default property which is an oLogic Object. An oLogic Object is a Boolean value. Note: not all Boolean values are configured to be oLogic Objects. When a oLogic Object pointer makes a link to a oLogic Object, the Boolean value of the oLogic Object type property is used in the Base Objects operation.

An oValue Object pointer expects to be pointed to an oValue Object or an object that has a default property which is an oValue Object. An oValue Object manages a regular value.  Note: not all regular values are configured to be oValue Objects. When an oValue Object pointer makes a link to an oValue Object, the regular value of the oValue Object is used in the Base Object's operation.

Back to top of pageExample:
In the following example, a servo is positioned based on the value of an oA2DX Object
Visual BasicC & Java
Dim A As New oA2DX 
Dim S As New oServoX
Dim B As New oBus

Sub Main()
  A.IOLine = 1
  A.Operate = cvTrue
  B.Input.Link(A)
  B.Output.Link(S)
  B.Operate = cvTrue
  S.IOLine = 31
  S.Operate = cvTrue
End Sub
oA2DX A = New oA2DX;
oServoX S = New oServoX;
oBus B = New oBus;

Void Main(Void){
  A.IOLine = 1;
  A.Operate = cvTrue;
  B.Input.Link(A);
  B.Output.Link(S);
  B.Operate = cvTrue;
  S.IOLine = 31;
  S.Operate = cvTrue;
}
BASIC 
A As oA2DX(1,,cvTrue)
S As oServoX(31,,,,,,,cvTrue)
B As oBus

B.Input.Link(A)
B.Output.Link(S)
B.Operate = cvTrue
 

Back to top of pageRelated Items:

 Pointers. (Chapter 8) ooPIC Programming Guide.
Back to top of pageVersion History and Bug List:
 Firmware Ver A1: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.