API Tags - Krystian-L-Lis/Stage GitHub Wiki

#API #Tags

IArgToITag

Type: Function
Description:
Casts an I_Arg to an I_Tag interface.
Results:

  • Ok – Successful cast.
  • Err.Itf0 – Null interface.
  • Err.NoMatch – No matching interface.

Signature:

FUNCTION IArgToITag : Result
VAR_INPUT
    iIn: I_Arg;
    iOut: REFERENCE TO I_Tag;
END_VAR

ICompToITag

Type: Function
Description:
Casts an I_Component to an I_Tag interface.
Results:

  • Ok – Successful cast.
  • Err.Itf0 – Null interface.
  • Err.NoMatch – No matching interface.

Signature:

FUNCTION ICompToITag : Result
VAR_INPUT
    iIn: I_Component;
    iOut: REFERENCE TO I_Tag;
END_VAR

GetTag

Type: Function
Description:
Searches an I_Entity for an I_Tag component matching the provided ID pattern.
Results:

  • OkI_Tag found.
  • Err.NotFound – No match found.
  • Err.InvRef – Invalid reference.
  • Err.Itf0 – Null interface.

Signature:

FUNCTION GetTag : Result
VAR_INPUT
    iEntity: I_Entity;
    sIdPattern: Str;
    iOut: REFERENCE TO I_Tag;
END_VAR

GetTagOpt

Type: Function
Description:
Searches an I_Entity for an I_Tag component with the specified Option value.
Results:

  • OkI_Tag found.
  • Err.NotFound – No match found.
  • Err.InvRef – Invalid reference.
  • Err.Itf0 – Null interface.

Signature:

FUNCTION GetTagOpt : Result
VAR_INPUT
    iEntity: I_Entity;
    sOption: Str;
    iOut: REFERENCE TO I_Tag;
END_VAR

HasTag

Type: Function
Description:
Checks if an I_Entity has a I_Tag component matching the provided ID pattern.
Results:

  • OkI_Tag found.
  • Err.NotFound – No match found.
  • Err.Itf0 – Null interface.

Signature:

FUNCTION HasTag : Result
VAR_INPUT
    iEntity: I_Entity;
    sIdPattern: Str;
    iOut: REFERENCE TO I_Tag;
END_VAR

HasTagOpt

Type: Function
Description:
Checks if an I_Entity has a I_Tag component with the specified Option value.
Results:

  • OkI_Tag found.
  • Err.NotFound – No match found.
  • Err.Itf0 – Null interface.

Signature:

FUNCTION HasTagOpt : Result
VAR_INPUT
    iEntity: I_Entity;
    sOption: Str;
    iOut: REFERENCE TO I_Tag;
END_VAR

I_Tag

Type: Interface
Extends: I_RawComponent, I_Arg
Description:
Represents a symbolic identifier with reflection-based path generation. It simplifies the path by removing project, PLC, and tag segments. Can be cast to I_Arg and I_RawComponent.

Members

Id

Type: Property
Accessors: Get
Description:
Returns the path excluding the optional segment.
Signature: PROPERTY Id : Str


Option

Type: Property
Accessors: Get
Description:
Gets or sets the optional segment of the path.
Signature: PROPERTY Option : Str


Tag

Type: Function Block
Implements: I_Tag
Description:
Implements a symbolic identifier using reflection. Simplifies the path by stripping out project, PLC, and tag metadata. The Tag type is a component; BaseTag is not.

Example:

  • Reflection path: proj.plc.MAIN.functionBlock[5]._tag
  • Resulting path: MAIN.functionBlock.5

Members:

Id

Type: Property
Accessors: Get
From: I_Tag
Description:
Returns the path excluding the optional segment.
Signature: PROPERTY Id : Str


Option

Type: Property
Accessors: Get
From: I_Tag
Description:
Gets or sets the optional segment of the path.
Signature: PROPERTY Option : Str


Self

Type: Property
Accessors: Get
Description:
Returns a reference to this instance as I_Tag.
Signature:

PROPERTY Self : I_Tag

Proxy

Type: Property
Accessors: Get, Set
Description:
Allows assigning a reference to this tag instance in declaration space.
Signature: PROPERTY Proxy : REFERENCE TO I_Tag
Example:

iTag: I_Tag;
tag: Tag := (Proxy := iTag);
// Result: iTag <> 0

TagCmp

Type: Function Block
Description:
A tool for evaluating I_Tag objects using sequential logic, similar to CASE OF constructs.

Members

Set

Type: Method
Description:
Sets a new base tag for comparison and resets state. Fails if iBaseTag is 0.
Signature:

METHOD Set : I_TagCmp
VAR_INPUT
    iBaseTag: I_Tag;
END_VAR

Match

Type: Method
Description:
Compares the base tag to another tag.
Signature:

METHOD Match : I_TagCmp
VAR_INPUT
    iOther: I_Tag;
END_VAR

MatchId

Type: Method
Description:
Matches the tag's ID with the provided string from right to left.
Signature:

METHOD MatchId : I_TagCmp
VAR_INPUT
    sIdToMatch: Str;
END_VAR

MatchWcdId

Type: Method
Description:
Matches the tag ID with a wildcard pattern.
Signature:

METHOD MatchWcdId : I_TagCmp
VAR_INPUT
    sPattern: Str;
END_VAR

HasOption

Type: Method
Description:
Checks if the tag has the specified option value.
Signature:

METHOD HasOption : I_TagCmp
VAR_INPUT
    sOption: Str;
END_VAR

AndHasOption

Type: Method
Description:
Conditionally continues evaluation if the tag has the specified option.
Signature:

METHOD AndHasOption : I_TagCmp
VAR_INPUT
    sOption: Str;
END_VAR

AndIf

Type: Method
Description:
Continues evaluation if the condition is TRUE.
Signature:

METHOD AndIf : I_TagCmp
VAR_INPUT
    bCondition: BOOL;
END_VAR

OrIf

Type: Method
Description:
Updates result state if current state or condition is TRUE.
Signature:

METHOD OrIf : I_TagCmp
VAR_INPUT
    bCondition: BOOL;
END_VAR

XorIf

Type: Method
Description:
Updates result state using XOR between state and condition.
Signature:

METHOD XorIf : I_TagCmp
VAR_INPUT
    bCondition: BOOL;
END_VAR

IsTrue

Type: Method
Description:
Returns TRUE if any evaluation yielded TRUE, and locks state.
Signature:

METHOD IsTrue : BOOL

IsFalse

Type: Method
Description:
Returns TRUE if all evaluations yielded FALSE, and locks state.
Signature:

METHOD IsFalse : BOOL

IsErr

Type: Method
Description:
Returns TRUE if any evaluation produced an error, and locks state.
Signature:

METHOD IsErr : BOOL

TagPath

Type: Function Block
Description:
Manages symbolic path segments for navigation and modification. Supports wildcards and segment-wise operations.
Example:
Path: MAIN.functionBlock.5.bBool

Members

AddNext

Type: Method
Description:
Adds a new segment after the current segment.
Results:

  • Ok – Segment added.
  • None – Invalid segment.

Signature:

METHOD AddNext : Result
VAR_INPUT
    sToAdd: Str;
END_VAR

AddPrev

Type: Method
Description:
Adds a new segment before the current segment.
Results:

  • Ok – Segment added.
  • None – Invalid segment.

Signature:

METHOD AddPrev : Result
VAR_INPUT
    sToAdd: Str;
END_VAR

Get

Type: Method
Description:
Returns the current segment.
Results:

  • Ok – Segment retrieved.
  • None – No segment.

Signature:

METHOD Get : Result
VAR_OUTPUT
    sSeg: Str;
END_VAR

Next

Type: Method
Description:
Moves to the next segment and returns it.
Results:

  • Ok – Segment retrieved.
  • None – No next segment.

Signature:

METHOD Next : Result
VAR_OUTPUT
    sSeg: Str;
END_VAR

Peek

Type: Method
Description:
Peeks at the next segment without moving pointer.
Results:

  • Ok – Segment retrieved.
  • None – No next segment.

Signature:

METHOD Peek : Result
VAR_OUTPUT
    sSeg: Str;
END_VAR

PeekBack

Type: Method
Description:
Peeks at the previous segment without moving pointer.
Results:

  • Ok – Segment retrieved.
  • None – No previous segment.

Signature:

METHOD PeekBack : Result
VAR_OUTPUT
    sSeg: Str;
END_VAR

Prev

Type: Method
Description:
Moves to the previous segment and returns it.
Results:

  • Ok – Segment retrieved.
  • None – No previous segment.

Signature:

METHOD Prev : Result
VAR_OUTPUT
    sSeg: Str;
END_VAR

Read

Type: Method
Description:
Returns the full symbolic path as a string.
Signature: METHOD Read : Str


RemoveAndNext

Type: Method
Description:
Removes current segment and moves to next.
Results:

  • Ok – Segment removed.
  • None – No segment to remove.

Signature: METHOD RemoveAndNext : Result


RemoveAndPrev

Type: Method
Description:
Removes current segment and moves to previous.
Results:

  • Ok – Segment removed.
  • None – No segment to remove.

Signature: METHOD RemoveAndPrev : Result


Set

Type: Method
Description:
Sets the entire symbolic path.
Results:

  • Ok – Path set.
  • None – Invalid path.

Signature:

METHOD Set : Result
VAR_INPUT
    sNewPath: Str;
END_VAR

Swap

Type: Method
Description:
Replaces the current segment with a new one.
Results:

  • Ok – Segment replaced.
  • None – Invalid segment.

Signature:

METHOD Swap : Result
VAR_INPUT
    sToSwap: Str;
END_VAR

MatchPath

Type: Function
Description:
Checks if a symbolic address matches the provided pattern. Supports * wildcards across segments.
Example:
Pattern: *.functionBlock.*.bBool Results:

  • Ok – Match found.
  • Err.NoMatch – No match.

Signature:

FUNCTION MatchPath : Result
VAR_INPUT
    sAddress: Str;
    sPattern: Str;
END_VAR

⚠️ **GitHub.com Fallback** ⚠️