示例#1
0
    def store(self, ibase):
        """Takes a InitBase instance and stores a minimal representation of it.

        Args:
           ibase: An input base object.
        """

        if ibase.mode == "manual":
            if hasattr(value, __len__):
                value = io_xml.write_list(ibase.value)
            else:  # if it's a single value then just write the value
                value = io_xml.write_type(self._storageclass, ibase.value)
        else:  # just store the value as a string
            value = ibase.value

        super(InputInitBase, self).store(value, units=ibase.units)

        for k in self.attribs:  # store additional attributes from the input class
            self.__dict__[k].store(ibase.__dict__[k])
示例#2
0
    def store(self, ibase):
        """Takes a InitBase instance and stores a minimal representation of it.

        Args:
           ibase: An input base object.
        """

        if ibase.mode == "manual":
            if hasattr(value, __len__):
                value = io_xml.write_list(ibase.value)
            else:  # if it's a single value then just write the value
                value = io_xml.write_type(self._storageclass, ibase.value)
        else:  # just store the value as a string
            value = ibase.value

        super(InputInitBase, self).store(value, units=ibase.units)

        for k in self.attribs:  # store additional attributes from the input class
            self.__dict__[k].store(ibase.__dict__[k])