MacroFunction Class Reference
Last update: 16.07.2025Definition of a single macro. More...
Public Types | |
| enum | eMeshType { ALL = 0, FEM, GRID1D, GRID2D, GRID3D } |
| the enum data type for defining teh data type of the argument in script context More... | |
Public Member Functions | |
| addArg (MacroArg arg) | |
| adds a new argument to the end of the list More... | |
| addRet (MacroArg arg) | |
| adds a new return value to the end of the list More... | |
| bool | builderCompatible () |
| delArg (number i) | |
| erases the given argument from the list More... | |
| delArgs () | |
| erases all arguments from the list | |
| delRet (number i) | |
| erases the given return value from the list More... | |
| delRets () | |
| erases all return values from the list | |
| string | generateAutoTestMacro () |
| tries to generate a simplified test call of the defined function This may work, if all argument types are known. All values will be assigned to simplified defaults, like More... | |
| MacroArg | getArg (number i) |
| string | getHelp () |
| gets m_help | |
| string | getIdent () |
| gets m_func_ident | |
| string | getLongName () |
| gets m_func_name_long | |
| string | getMacro () |
| gets the macro's code More... | |
| MacroArg | getRet (number i) |
| std::vector< MacroArg > | getRets () |
| string | getShortName () |
| gets m_func_name_short | |
| string | getTestMacro () |
| Get cdoe to be executed to test this macro. | |
| string | htmlHelp () |
| Get a html-Format help text. Includes a complete set of information of this MacroFunction, including arguments. | |
| bool | isHidden () const |
| MacroFunction () | |
| default constructor | |
| eMeshType | meshType () const |
| bool | needsMesh () |
| number | numArg () |
| number | numRet () |
| bool | operator< (MacroFunction other) |
| a comparison operator used for std::set usage More... | |
| string | scriptChangeToFunction (string var_ident, MacroFunction other) |
| identifies a script code that changes the function More... | |
| setArg (number i, MacroArg arg) | |
| sets a new argument inside the vector More... | |
| setHelp (string s) | |
| sets m_help | |
| setHidden () | |
| hide macro Obscure the macro string. (Notice: ANSYS does not guarantee a strong encryption.) More... | |
| setIdent (string s) | |
| sets m_func_ident | |
| setLongName (string s) | |
| sets m_func_name_long | |
| setMacro (string s) | |
| set the macro's code | |
| setMeshType (eMeshType mesh_type) | |
| sets the mesh type(s) being compatible with this macro More... | |
| setNeedsMesh (bool needs_mesh) | |
| setRet (number i, MacroArg arg) | |
| sets a new return value inside the vector More... | |
| setShortName (string s) | |
| sets m_func_name_short | |
| setTestMacro (string s) | |
| Set code to be executed to test this macro. | |
Static Public Member Functions | |
| static bool | validIdent (string s) |
Detailed Description
Definition of a single macro.
Member Enumeration Documentation
◆ eMeshType
| enum eMeshType |
Member Function Documentation
◆ addArg()
| addArg | ( | MacroArg | arg | ) |
adds a new argument to the end of the list
- Parameters
-
arg the argument to be added
◆ addRet()
| addRet | ( | MacroArg | arg | ) |
adds a new return value to the end of the list
- Parameters
-
arg the return value to be added
◆ builderCompatible()
| bool builderCompatible | ( | ) |
- Returns
- true if this funtion can be used in the MacroBuilder
◆ delArg()
| delArg | ( | number | i | ) |
erases the given argument from the list
- Parameters
-
i the existing index to be deleted, starting with 0
◆ delRet()
| delRet | ( | number | i | ) |
erases the given return value from the list
- Parameters
-
i the existing index to be deleted, starting with 0
◆ generateAutoTestMacro()
| string generateAutoTestMacro | ( | ) |
tries to generate a simplified test call of the defined function This may work, if all argument types are known. All values will be assigned to simplified defaults, like
- strings: empty
- numbers: 0
- matrices: 1x1, zero
- Returns
- the genrated test code or empty string (if not able to generate one)
◆ getArg()
| MacroArg getArg | ( | number | i | ) |
- Returns
- a reference to the specified argument
- Parameters
-
i the index of the argument, starting with 0
◆ getMacro()
| string getMacro | ( | ) |
gets the macro's code
- Exceptions
-
execption if the macro is hidden
◆ getRet()
| MacroArg getRet | ( | number | i | ) |
- Returns
- a reference to the specified return value
- Parameters
-
i the index of the return value, starting with 0
◆ getRets()
| std::vector<MacroArg> getRets | ( | ) |
- Returns
- a reference to the vector of MacroArgs
◆ isHidden()
| bool isHidden | ( | ) | const |
- Returns
- true if the macro is hidden
◆ meshType()
| eMeshType meshType | ( | ) | const |
- Returns
- the mesh type(s) being compatible with this macro
◆ needsMesh()
| bool needsMesh | ( | ) |
- Returns
- true if this function needs a mesh
◆ numArg()
| number numArg | ( | ) |
- Returns
- the number of defined arguments
◆ numRet()
| number numRet | ( | ) |
- Returns
- the number of defined return values
◆ operator<()
| bool operator< | ( | MacroFunction | other | ) |
a comparison operator used for std::set usage
- Parameters
-
other the other function to be compared
- Returns
- true if the ident of this function is "smaller" than the ident of the other function.
- Note
- The "smaller" operator also checks if "numbers" are at the end of the ident, we try to resolve this according to "human ordering", e.g. "chunk_9" < "chunk_10"
◆ scriptChangeToFunction()
| string scriptChangeToFunction | ( | string | var_ident, |
| MacroFunction | other | ||
| ) |
identifies a script code that changes the function
- Parameters
-
other the other function wotr which the differences are checked. var_ident the variable ident in script to be changed.
- Returns
- the script code to change this function to match the other on
◆ setArg()
| setArg | ( | number | i, |
| MacroArg | arg | ||
| ) |
sets a new argument inside the vector
- Parameters
-
i an existing index in the list, starting with 0 arg the new argument to be set
◆ setHidden()
| setHidden | ( | ) |
hide macro Obscure the macro string. (Notice: ANSYS does not guarantee a strong encryption.)
- Warning
- cannot be undone
◆ setMeshType()
| setMeshType | ( | eMeshType | mesh_type | ) |
sets the mesh type(s) being compatible with this macro
- Parameters
-
mesh_type the new value
◆ setNeedsMesh()
| setNeedsMesh | ( | bool | needs_mesh | ) |
- Parameters
-
sets the property if the function needs mesh needs_mesh true if this function needs a mesh
◆ setRet()
| setRet | ( | number | i, |
| MacroArg | arg | ||
| ) |
sets a new return value inside the vector
- Parameters
-
i an existing index in the list, starting with 0 arg the new return value to be set
◆ validIdent()
|
static |
- Returns
- true if the ident s can be used in Lua
- Parameters
-
s the ident to be checked