PLBOBJECT Methods


 PLBCMP GUI Only, 10.6

 

The PLBOBJECT object methods are contained in the CLASSMODULE load module that is specified for the PLBOBJECT object declaration. Therefore, any label for a FUNCTION in a CLASSMODULE load module that does not have a prefix of 'Get_' or 'Set_' is identified as a method. This means that all PLBOBJECT methods are user defined as coded into a CLASSMODULE load module. The methods use the following format:

 

 

 

[label]

{object}.method

[GIVING {return}]:

 

 

 

[USING {paramvalue1}[:

 

 

 

{paramvalue2}][:

 

 

 

...]

Where:

 

label
Optional. A Program Execution Label
object
 Required. A PLBOBJECT object that has been previously created.
property
Required. A method name that must be the same as a PL/B label for a FUNCTION method coded into the PLBOBJECT CLASSMODULE load module program.
return
Optional. A Numeric Variable or Character String Variable as coded for the CLASSMODULE method.
paramvalueX
Optional. Depending on a method's logic coded for a CLASSMODULE FUNCTION, the parameters are positional and typed based on the input parameters to the FUNCTION.

Flags Affected: Depends on method FUNCTION

Note the following:

  1. The PLBOBJECT method input parameters do not support keyword naming syntax.

  2. The compiler can verify that the method name exists in the CLASSMODULE load module '.plc' program file. If the CLASSMODULE '.plc' program file cannot be accessed, the compiler gives appropriate warning messages.

  3. Example:

    'MyClass.plc' program compiled as CLASSMODULE load module.

     

              CLASSMODULE

    .

    MyDiv FUNCTION //Method entry!

    nValue FORM 5

              ENTRY

    .

    RetRes FORM 5

    .

    . MyDiv logic to process nValue and calculate RetRes

    .

              DIV "2", nValue, RetRes

    .

             FUNCTIONEND USING RetRes

     

    'TestProg.plc' program using PLBOBJECT object

     

    TestClass PLBOBJECT CLASS="MyClass.plc"

    Result FORM 5

    inValue FORM "10"

    .

                 ...

    .

                CREATE TestClass

    .

                TestClass.MyDiv GIVING Result USING inValue

    .

 

 

See Also: Object I/O Instructions

 



PL/B Language Reference