> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MacroManager Class Reference

Part of [Script](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__script)

stores a set of macro definitions [MacroManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_manager.md) is a common::Sender. Listeners can register themselves at Senders. [MacroManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_manager.md) calls its senders when Macros are changed/added/removed.

## Public Types

| Type | Name |
| - | - |
|  typedef std::set\< [MacroFunction](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_function.md) > | [TMacroSet](#a2754edf9f8c68b54ab1d0ac5d4dc27b8) a type for storing macros in a sorted set |

## Public Member Functions

| Type | Name |
| - | - |
| | [add](#af041e23d748102508adc50e03e7bda1e) ([MacroFunction](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_function.md) macro) adds a new function to the container |
| | [add](#a22b30d30fe29ad3ae825bfad0ce53db4) ([MacroManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_manager.md) other, bool overwrite\_existing) adds the contents of other to this object |
| | [assign](#aa38fdf58269a29519ce3184f3ffd34c6) ([MacroManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_manager.md) other) is the equivalent to the = operator, assigns the contents of other to this |
| TMacroSet::const\_iterator | [begin](#a1c775b1fd28d66bae42c106b95b4675f) () |
| | [clear](#aa821bec12eaa7e0f649397c9675ff505) () clears the data |
| bool | [empty](#a644718bb2fb240de962dc3c9a1fdf0dc) () const |
| TMacroSet::const\_iterator | [end](#af5af8620c25d4ea19471050477c4e3a7) () |
| | [erase](#a85e467501638e35b47f5c62bd0269e63) (string identifier) deletes the macro with given identifier |
| bool | [exists](#a544a57d56da3c8e5148ab81842ac207b) (string identifier) |
| [MacroFunction](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_function.md) | [get](#a976a92de6a50d5e163bf3dc4ce895423) (string identifier) |
| | [MacroManager](#a8824df8057f38102b62ff835f2fa3f1c) () default constructor |
| bool | [operator==](#a8dd6a30df2574c542f68e83a888be7de) ([MacroManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_manager.md) arg) comparison operator |
| string | [scriptChangeToFunction](#a94b738f30f6d3e1331d68df2c5dda0e6) (string var\_manager\_ident, string var\_chunk\_ident, string old\_func\_ident, [MacroFunction](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_function.md) other) identifies a script code that changes a single function |
| | [set](#a0b3688a1cc2055df2c8d896a0efd7808) ([MacroFunction](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_function.md) macro) replaces an existing function by the specified one |
| size\_t | [size](#a259cb5a711406a8c3e5d937eb9350cca) () const |

## Detailed Description

stores a set of macro definitions [MacroManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_manager.md) is a common::Sender. Listeners can register themselves at Senders. [MacroManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_macro_manager.md) calls its senders when Macros are changed/added/removed.

## Member Function Documentation

### add() \[1/2]

```cpp theme={null}
add(MacroFunction macro)
```

adds a new function to the container

**Parameters**

| Name | Description |
| - | - |
| macro | macro to be added. |

**Exceptions**

| Name | Description |
| - | - |
| if | a function with the identical ident already exists |

### add() \[2/2]

```cpp theme={null}
add(
    MacroManager other,
    bool overwrite_existing
)
```

adds the contents of other to this object

**Parameters**

| Name | Description |
| - | - |
| other | the source to be copied to this |
| overwrite\_existing | if true, then all objects are copied. If false, only those macro are copied for which no equally named macro exists. |

### assign()

```cpp theme={null}
assign(MacroManager other)
```

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

**Parameters**

| Name | Description |
| - | - |
| other | the source to be copied to this |

### begin()

```cpp theme={null}
TMacroSet::const_iterator begin()
```

**Returns**

the begin iterator to the underlying data container

### empty()

```cpp theme={null}
bool empty() const
```

**Returns**

true if empty

### end()

```cpp theme={null}
TMacroSet::const_iterator end()
```

**Returns**

the end iterator to the underlying data container

### erase()

```cpp theme={null}
erase(string identifier)
```

deletes the macro with given identifier

**Parameters**

| Name | Description |
| - | - |
| identifier | the identifier of the macro to be erased |

### exists()

```cpp theme={null}
bool exists(string identifier)
```

**Returns**

true if the given macro identifier exists

**Parameters**

| Name | Description |
| - | - |
| identifier | the identifier of the macro to be tested |

### get()

```cpp theme={null}
MacroFunction get(string identifier)
```

**Returns**

a reference to the macro with specified identifier

**Parameters**

| Name | Description |
| - | - |
| identifier | the script ident of the function |

### operator==()

```cpp theme={null}
bool operator==(MacroManager arg)
```

comparison operator

**Parameters**

| Name | Description |
| - | - |
| arg | the variable to be tested |

**Returns**

true if both are equal

### scriptChangeToFunction()

```cpp theme={null}
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**

| Name | Description |
| - | - |
| other | the other function which is be added or changed |
| var\_manager\_ident | the variable identifier of this macro manager in script |
| var\_chunk\_ident | the variable ident of a temporary macro object |
| old\_func\_ident | The 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()

```cpp theme={null}
set(MacroFunction macro)
```

replaces an existing function by the specified one

**Parameters**

| Name | Description |
| - | - |
| macro | the macro to replace the existing one with. |

### size()

```cpp theme={null}
size_t size() const
```

**Returns**

the number of defined macros
