OpenCascade.js
API ReferenceApplicationFrameworkTKLCAF

TFunction

OCCT package TFunction: TFunction_Driver, TFunction_DriverTable, TFunction_ExecutionStatus, TFunction_Function, and 5 more bound classes.

TFunction_Driver

This driver class provide services around function execution. One instance of this class is built for the whole session. The driver is bound to the DriverGUID in the DriverTable class. It allows you to create classes which inherit from this abstract class. These subclasses identify the various algorithms which can be applied to the data contained in the attributes of sub-labels of a model. A single instance of this class and each of its subclasses is built for the whole session.

Static methods(2)

Instance methods(8)

  • Init(L: TDF_Label): void

    Initializes the label L for this function prior to its execution.

    Parameters (1)
    • L
  • Returns the label of the driver for this function.

  • Validates labels of a function in <log>. This function is the one initialized in this function driver. Warning In regeneration mode, the solver must call this method even if the function is not executed.
    execution of function

    Parameters (1)
    • log
  • Analyzes the labels in the logbook log. Returns true if attributes have been modified. If the function label itself has been modified, the function must be executed.

    Parameters (1)
    • log
  • Execute(): { returnValue: number; log: TFunction_Logbook; [Symbol.dispose](): void }

    Executes the function in this function driver and puts the impacted labels in the logbook log.
    arguments & results of functions

    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • log: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • The method fills-in the list by labels, where the arguments of the function are located.

    Parameters (1)
    • args
      Mutated in place; read the updated value from this argument after the call.
  • The method fills-in the list by labels, where the results of the function are located.

    Parameters (1)
    • res
      Mutated in place; read the updated value from this argument after the call.

TFunction_DriverTable

A container for instances of drivers. You create a new instance of TFunction_Driver and use the method AddDriver to load it into the driver table.

Constructors(1)

Static methods(3)

Instance methods(6)

  • AddDriver(guid: Standard_GUID, driver: TFunction_Driver, thread?: number): boolean

    Returns true if the driver has been added successfully to the driver table.

    Parameters (3)
    • guid
    • driver
    • thread
  • HasDriver(guid: Standard_GUID, thread?: number): boolean

    Returns true if the driver exists in the driver table.

    Parameters (2)
    • guid
    • thread
  • FindDriver(guid: Standard_GUID, thread: number): { returnValue: boolean; driver: TFunction_Driver; [Symbol.dispose](): void }

    Returns true if the driver was found.

    Parameters (2)
    • guid
    • thread
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • driver: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • RemoveDriver(guid: Standard_GUID, thread?: number): boolean

    Removes a driver with the given GUID. Returns true if the driver has been removed successfully.

    Parameters (2)
    • guid
    • thread
  • Clear(): void

    Removes all drivers. Returns true if the driver has been removed successfully.

TFunction_Function

Provides the following two services.

  • a link to an evaluation driver
  • the means of providing a link between a function and an evaluation driver.

Constructors(1)

Static methods(5)

Instance methods(11)

  • Returns the GUID for this function's driver.

  • Sets the driver for this function as that identified by the GUID guid.

    Parameters (1)
    • guid
  • Failed(): boolean

    Returns true if the execution failed.

  • SetFailure(mode?: number): void

    Sets the failed index.

    Parameters (1)
    • mode
  • GetFailure(): number

    Returns an index of failure if the execution of this function failed. If this integer value is 0, no failure has occurred.
    Implementation of Attribute methods:

  • Returns the ID of the attribute.

  • Restore(anAttribute: TDF_Attribute): void

    Restores the backuped contents from <anAttribute> into this one. It is used when aborting a transaction.

    Parameters (1)
    • anAttribute
  • Paste(intoAttribute: TDF_Attribute, aRelocationTable: TDF_RelocationTable): void

    This method is different from the "Copy" one, because it is used when copying an attribute from a source structure into a target structure. This method may paste the contents of <me> into <intoAttribute>.
    The given pasted attribute can be full or empty of its contents. But don't make a NEW! Just set the contents!
    It is possible to use <aRelocationTable> to get/set the relocation value of a source attribute.

    Parameters (2)
    • intoAttribute
    • aRelocationTable
  • Returns an new empty attribute from the good end type. It is used by the copy algorithm.

  • References(aDataSet: TDF_DataSet): void

    Adds the first level referenced attributes and labels to <aDataSet>.
    For this, use the AddLabel or AddAttribute of DataSet.
    If there is none, do not implement the method.

    Parameters (1)
    • aDataSet

TFunction_GraphNode

Provides links between functions.

Constructors(1)

Static methods(4)

Instance methods(20)

  • AddPrevious(funcID: number): boolean

    Defines a reference to the function as a previous one.

    Parameters (1)
    • funcID
  • AddPrevious(func: TDF_Label): boolean

    Defines a reference to the function as a previous one.

    Parameters (1)
    • func
  • RemovePrevious(funcID: number): boolean

    Removes a reference to the function as a previous one.

    Parameters (1)
    • funcID
  • RemovePrevious(func: TDF_Label): boolean

    Removes a reference to the function as a previous one.

    Parameters (1)
    • func
  • Returns a map of previous functions.

  • Clears a map of previous functions.

  • AddNext(funcID: number): boolean

    Defines a reference to the function as a next one.

    Parameters (1)
    • funcID
  • AddNext(func: TDF_Label): boolean

    Defines a reference to the function as a next one.

    Parameters (1)
    • func
  • RemoveNext(funcID: number): boolean

    Removes a reference to the function as a next one.

    Parameters (1)
    • funcID
  • RemoveNext(func: TDF_Label): boolean

    Removes a reference to the function as a next one.

    Parameters (1)
    • func
  • Returns a map of next functions.

  • Clears a map of next functions.

  • Returns the execution status of the function.

  • Defines an execution status for a function.
    Implementation of Attribute methods

    Parameters (1)
    • status
  • Returns the ID of the attribute.

  • Restore(anAttribute: TDF_Attribute): void

    Restores the backuped contents from <anAttribute> into this one. It is used when aborting a transaction.

    Parameters (1)
    • anAttribute
  • Paste(intoAttribute: TDF_Attribute, aRelocationTable: TDF_RelocationTable): void

    This method is different from the "Copy" one, because it is used when copying an attribute from a source structure into a target structure. This method may paste the contents of <me> into <intoAttribute>.
    The given pasted attribute can be full or empty of its contents. But don't make a NEW! Just set the contents!
    It is possible to use <aRelocationTable> to get/set the relocation value of a source attribute.

    Parameters (2)
    • intoAttribute
    • aRelocationTable
  • Returns an new empty attribute from the good end type. It is used by the copy algorithm.

  • References(aDataSet: TDF_DataSet): void

    Adds the first level referenced attributes and labels to <aDataSet>.
    For this, use the AddLabel or AddAttribute of DataSet.
    If there is none, do not implement the method.

    Parameters (1)
    • aDataSet

TFunction_IFunction

Interface class for usage of Function Mechanism.

Constructors(2)

Static methods(3)

  • Sets a new function attached to a label <L> with <ID>. It creates a new TFunction_Function attribute initialized by the <ID>, a new TFunction_GraphNode with an empty list of dependencies and the status equal to TFunction_ES_WrongDefinition. It registers the function in the scope of functions for this document.

    Parameters (2)
    • L
    • ID
  • Deletes a function attached to a label <L>. It deletes a TFunction_Function attribute and a TFunction_GraphNode. It deletes the functions from the scope of function of this document.

    Parameters (1)
    • L
  • UpdateDependencies(Access: TDF_Label): boolean

    Updates dependencies for all functions of the scope. It returns false in case of an error. An empty constructor.

    Parameters (1)
    • Access

Instance methods(13)

TFunction_Iterator

Iterator of the graph of functions.

Constructors(2)

Instance methods(9)

  • Init(Access: TDF_Label): void

    Initializes the Iterator.

    Parameters (1)
    • Access
  • SetUsageOfExecutionStatus(usage: boolean): void

    Defines the mode of iteration - usage or not of the execution status. If the iterator takes into account the execution status, the method ::Current() returns only "not executed" functions while their status is not changed. If the iterator ignores the execution status, the method ::Current() returns the functions following their dependencies and ignoring the execution status.

    Parameters (1)
    • usage
  • Returns usage of execution status by the iterator.

  • GetMaxNbThreads(): number

    Analyses the graph of dependencies and returns maximum number of threads may be used to calculate the model.

  • Returns the current list of functions. If the iterator uses the execution status, the returned list contains only the functions with "not executed" status.

  • More(): boolean

    Returns false if the graph of functions is fully iterated.

  • Next(): void

    Switches the iterator to the next list of current functions.

  • A help-function aimed to help the user to check the status of retrurned function. It calls TFunction_GraphNode::GetStatus() inside.

    Parameters (1)
    • func
  • A help-function aimed to help the user to change the execution status of a function. It calls TFunction_GraphNode::SetStatus() inside.

    Parameters (2)
    • func
    • status

TFunction_Logbook

This class contains information which is written and read during the solving process. Information is divided in three groups.

  • Touched Labels (modified by the end user),
  • Impacted Labels (modified during execution of the function),
  • Valid Labels (within the valid label scope).

Constructors(1)

Static methods(4)

Instance methods(18)

TFunction_Scope

Keeps a scope of functions.

Constructors(1)

Static methods(4)

Instance methods(18)