| 77 | == Topdl Class Features == |
| 78 | |
| 79 | All topdl classes implement the following methods: |
| 80 | |
| 81 | {{{set_attribute(self, key, value)}}}:: |
| 82 | Attach an user-defined attribute with the given key and value to this object; value and key are strings. The method includes a key/value pair (encoded as an [TopdlLibrary#Attribute attribute object]) into the {{{attribute}}} member of the object. If an attribute with the given key exists, it is overwritten. |
| 83 | This method accesses the attribute member of the given object, not any named members. Objects that do not have an {{{attribute}}} member silently discard the operation. |
| 84 | {{{get_attribute(self, key)}}}:: |
| 85 | Return the attribute of this object with the given key. The attribute - a string - is returned. If no such attribute exists, or the object has no {{{attribute}}} member, return None. |
| 86 | {{{remove_attribute(self, key)}}}:: |
| 87 | If an attribute with the given key exists, remove it. |
| 88 | {{{clone(self)}}}:: |
| 89 | Returns a deep copy of this object. |
| 90 | {{{to_dict(self)}}}:: |
| 91 | Return the object as a python dict. No copies are made, so make modifications with caution. |
| 92 | {{{to_xml(self)}}}:: |
| 93 | Return the XML encoding (from the topdl language) of this object (and nested objects) |