SimObject.py (10267:ed97f6f2ed7a) | SimObject.py (10380:ec1af95a2958) |
---|---|
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 --- 941 unchanged lines hidden (view full) --- 950 ppath = self._parent.path() 951 if ppath == 'root': 952 return self._name 953 return ppath + "." + self._name 954 955 def __str__(self): 956 return self.path() 957 | 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 --- 941 unchanged lines hidden (view full) --- 950 ppath = self._parent.path() 951 if ppath == 'root': 952 return self._name 953 return ppath + "." + self._name 954 955 def __str__(self): 956 return self.path() 957 |
958 def config_value(self): 959 return self.path() 960 |
|
958 def ini_str(self): 959 return self.path() 960 961 def find_any(self, ptype): 962 if isinstance(self, ptype): 963 return self, True 964 965 found_obj = None --- 106 unchanged lines hidden (view full) --- 1072 # Add the name and path of this object to be able to link to 1073 # the stats 1074 d.name = self.get_name() 1075 d.path = self.path() 1076 1077 for param in sorted(self._params.keys()): 1078 value = self._values.get(param) 1079 if value != None: | 961 def ini_str(self): 962 return self.path() 963 964 def find_any(self, ptype): 965 if isinstance(self, ptype): 966 return self, True 967 968 found_obj = None --- 106 unchanged lines hidden (view full) --- 1075 # Add the name and path of this object to be able to link to 1076 # the stats 1077 d.name = self.get_name() 1078 d.path = self.path() 1079 1080 for param in sorted(self._params.keys()): 1081 value = self._values.get(param) 1082 if value != None: |
1080 try: 1081 # Use native type for those supported by JSON and 1082 # strings for everything else. skipkeys=True seems 1083 # to not work as well as one would hope 1084 if type(self._values[param].value) in \ 1085 [str, unicode, int, long, float, bool, None]: 1086 d[param] = self._values[param].value 1087 else: 1088 d[param] = str(self._values[param]) | 1083 d[param] = value.config_value() |
1089 | 1084 |
1090 except AttributeError: 1091 pass 1092 | |
1093 for n in sorted(self._children.keys()): 1094 child = self._children[n] 1095 # Use the name of the attribute (and not get_name()) as 1096 # the key in the JSON dictionary to capture the hierarchy 1097 # in the Python code that assembled this system 1098 d[n] = child.get_config_as_dict() 1099 1100 for port_name in sorted(self._ports.keys()): --- 148 unchanged lines hidden --- | 1085 for n in sorted(self._children.keys()): 1086 child = self._children[n] 1087 # Use the name of the attribute (and not get_name()) as 1088 # the key in the JSON dictionary to capture the hierarchy 1089 # in the Python code that assembled this system 1090 d[n] = child.get_config_as_dict() 1091 1092 for port_name in sorted(self._ports.keys()): --- 148 unchanged lines hidden --- |