Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

MacroManager Class Reference

Last update: 16.07.2025

stores a set of macro definitions MacroManager is a common::Sender. Listeners can register themselves at Senders. MacroManager calls its senders when Macros are changed/added/removed. More...

Public Types

typedef std::set< MacroFunctionTMacroSet
 a type for storing macros in a sorted set
 

Public Member Functions

 add (MacroFunction macro)
 adds a new function to the container More...
 
 add (MacroManager other, bool overwrite_existing)
 adds the contents of other to this object More...
 
 assign (MacroManager other)
 is the equivalent to the = operator, assigns the contents of other to this More...
 
TMacroSet::const_iterator begin ()
 
 clear ()
 clears the data
 
bool empty () const
 
TMacroSet::const_iterator end ()
 
 erase (string identifier)
 deletes the macro with given identifier More...
 
bool exists (string identifier)
 
MacroFunction get (string identifier)
 
 MacroManager ()
 default constructor
 
bool operator== (MacroManager arg)
 comparison operator More...
 
string scriptChangeToFunction (string var_manager_ident, string var_chunk_ident, string old_func_ident, MacroFunction other)
 identifies a script code that changes a single function More...
 
 set (MacroFunction macro)
 replaces an existing function by the specified one More...
 
size_t size () const
 

Detailed Description

stores a set of macro definitions MacroManager is a common::Sender. Listeners can register themselves at Senders. MacroManager calls its senders when Macros are changed/added/removed.

Member Function Documentation

◆ add() [1/2]

add ( MacroFunction  macro)

adds a new function to the container

Parameters
macromacro to be added.
Exceptions
ifa function with the identical ident already exists

◆ add() [2/2]

add ( MacroManager  other,
bool  overwrite_existing 
)

adds the contents of other to this object

Parameters
otherthe source to be copied to this
overwrite_existingif true, then all objects are copied. If false, only those macro are copied for which no equally named macro exists.

◆ assign()

assign ( MacroManager  other)

is the equivalent to the = operator, assigns the contents of other to this

Parameters
otherthe source to be copied to this

◆ begin()

TMacroSet::const_iterator begin ( )
Returns
the begin iterator to the underlying data container

◆ empty()

bool empty ( ) const
Returns
true if empty

◆ end()

TMacroSet::const_iterator end ( )
Returns
the end iterator to the underlying data container

◆ erase()

erase ( string  identifier)

deletes the macro with given identifier

Parameters
identifierthe identifier of the macro to be erased

◆ exists()

bool exists ( string  identifier)
Returns
true if the given macro identifier exists
Parameters
identifierthe identifier of the macro to be tested

◆ get()

MacroFunction get ( string  identifier)
Returns
a reference to the macro with specified identifier
Parameters
identifierthe script ident of the function

◆ operator==()

bool operator== ( MacroManager  arg)

comparison operator

Parameters
argthe variable to be tested
Returns
true if both are equal

◆ scriptChangeToFunction()

string scriptChangeToFunction ( string  var_manager_ident,
string  var_chunk_ident,
string  old_func_ident,
MacroFunction  other 
)

identifies a script code that changes a single function

Parameters
otherthe other function which is be added or changed
var_manager_identthe variable identifier of this macro manager in script
var_chunk_identthe variable ident of a temporary macro object
old_func_identThe old function ident to be changed. Empty if a new function is created.
Returns
the script code to change this function to match the other on

◆ set()

set ( MacroFunction  macro)

replaces an existing function by the specified one

Parameters
macrothe macro to replace the existing one with.

◆ size()

size_t size ( ) const
Returns
the number of defined macros

Connect with Ansys