params.py (9941:d979dddf26a5) params.py (9953:9caba3b84a9b)
1# Copyright (c) 2012-2013 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 233 unchanged lines hidden (view full) ---

242 yield obj
243
244 def get_config_as_dict(self):
245 a = []
246 for v in self:
247 a.append(v.get_config_as_dict())
248 return a
249
1# Copyright (c) 2012-2013 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 233 unchanged lines hidden (view full) ---

242 yield obj
243
244 def get_config_as_dict(self):
245 a = []
246 for v in self:
247 a.append(v.get_config_as_dict())
248 return a
249
250 # If we are replacing an item in the vector, make sure to set the
251 # parent reference of the new SimObject to be the same as the parent
252 # of the SimObject being replaced. Useful to have if we created
253 # a SimObjectVector of temporary objects that will be modified later in
254 # configuration scripts.
255 def __setitem__(self, key, value):
256 val = self[key]
257 if value.has_parent():
258 warn("SimObject %s already has a parent" % value.get_name() +\
259 " that is being overwritten by a SimObjectVector")
260 value.set_parent(val.get_parent(), val._name)
261 super(SimObjectVector, self).__setitem__(key, value)
262
250class VectorParamDesc(ParamDesc):
251 # Convert assigned value to appropriate type. If the RHS is not a
252 # list or tuple, it generates a single-element list.
253 def convert(self, value):
254 if isinstance(value, (list, tuple)):
255 # list: coerce each element into new list
256 tmp_list = [ ParamDesc.convert(self, v) for v in value ]
257 else:

--- 1409 unchanged lines hidden ---
263class VectorParamDesc(ParamDesc):
264 # Convert assigned value to appropriate type. If the RHS is not a
265 # list or tuple, it generates a single-element list.
266 def convert(self, value):
267 if isinstance(value, (list, tuple)):
268 # list: coerce each element into new list
269 tmp_list = [ ParamDesc.convert(self, v) for v in value ]
270 else:

--- 1409 unchanged lines hidden ---