params.py (9014:e22ded364548) params.py (9017:a20f46ccb9ce)
1# Copyright (c) 2012 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

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

1358 # Return the number of connected ports, i.e. 0 is we have no
1359 # peer and 1 if we do.
1360 return int(self.peer != None)
1361
1362 # for config.ini, print peer's name (not ours)
1363 def ini_str(self):
1364 return str(self.peer)
1365
1# Copyright (c) 2012 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

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

1358 # Return the number of connected ports, i.e. 0 is we have no
1359 # peer and 1 if we do.
1360 return int(self.peer != None)
1361
1362 # for config.ini, print peer's name (not ours)
1363 def ini_str(self):
1364 return str(self.peer)
1365
1366 # for config.json
1367 def get_config_as_dict(self):
1368 return {'role' : self.role, 'peer' : str(self.peer)}
1369
1366 def __getattr__(self, attr):
1367 if attr == 'peerObj':
1368 # shorthand for proxies
1369 return self.peer.simobj
1370 raise AttributeError, "'%s' object has no attribute '%s'" % \
1371 (self.__class__.__name__, attr)
1372
1373 # Full connection is symmetric (both ways). Called via

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

1475 # Return the number of connected peers, corresponding the the
1476 # length of the elements.
1477 return len(self.elements)
1478
1479 # for config.ini, print peer's name (not ours)
1480 def ini_str(self):
1481 return ' '.join([el.ini_str() for el in self.elements])
1482
1370 def __getattr__(self, attr):
1371 if attr == 'peerObj':
1372 # shorthand for proxies
1373 return self.peer.simobj
1374 raise AttributeError, "'%s' object has no attribute '%s'" % \
1375 (self.__class__.__name__, attr)
1376
1377 # Full connection is symmetric (both ways). Called via

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

1479 # Return the number of connected peers, corresponding the the
1480 # length of the elements.
1481 return len(self.elements)
1482
1483 # for config.ini, print peer's name (not ours)
1484 def ini_str(self):
1485 return ' '.join([el.ini_str() for el in self.elements])
1486
1487 # for config.json
1488 def get_config_as_dict(self):
1489 return {'role' : self.role,
1490 'peer' : [el.ini_str() for el in self.elements]}
1491
1483 def __getitem__(self, key):
1484 if not isinstance(key, int):
1485 raise TypeError, "VectorPort index must be integer"
1486 if key >= len(self.elements):
1487 # need to extend list
1488 ext = [VectorPortElementRef(self.simobj, self.name, self.role, i)
1489 for i in range(len(self.elements), key+1)]
1490 self.elements.extend(ext)

--- 145 unchanged lines hidden ---
1492 def __getitem__(self, key):
1493 if not isinstance(key, int):
1494 raise TypeError, "VectorPort index must be integer"
1495 if key >= len(self.elements):
1496 # need to extend list
1497 ext = [VectorPortElementRef(self.simobj, self.name, self.role, i)
1498 for i in range(len(self.elements), key+1)]
1499 self.elements.extend(ext)

--- 145 unchanged lines hidden ---