The SicStructure class
Keywords: gildas-python

Next: Array elements types Up: How SIC variables are Previous: The SicVar class Contents Index

### The `SicStructure` class

The only purpose of the `SicStructure` instances is to be objects that accept user-defined attributes (as for SIC structures actually). The definition of the `SicStructure` class is rather simple. It is instantiated by the `SicStructure()` creator with the SIC structure name and level as only arguments, which are stored in its `__sicname__` and `__siclevel__` attributes.

This empty instance in then filled by the `get()` function: it loops through all SIC variable dictionary and searches for all names which begin with the structure name. For each valid variable it `get()`'s it as a `SicVar` attribute of the `SicStructure` instance. `SicStructure`s support nested structures, as user or program can define any kind of attributes (`SicVar`, `SicStructure`, or even standard Python objects).

For user convenience, the `__str__()` method (called by `print myinstance` or `str(myinstance)`) of the `SicStructure` class is redefined to print all (and only) `SicVar` and `SicStructure` attributes, with some details on them.