SimObject.py (9410:f329e7ec9786) SimObject.py (9528:d05714c2ab9c)
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

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

208 if 'cxx_class' not in cls._value_dict:
209 cls._value_dict['cxx_class'] = cls._value_dict['type']
210
211 cls._value_dict['cxx_type'] = '%s *' % cls._value_dict['cxx_class']
212
213 if 'cxx_header' not in cls._value_dict:
214 global noCxxHeader
215 noCxxHeader = True
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

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

208 if 'cxx_class' not in cls._value_dict:
209 cls._value_dict['cxx_class'] = cls._value_dict['type']
210
211 cls._value_dict['cxx_type'] = '%s *' % cls._value_dict['cxx_class']
212
213 if 'cxx_header' not in cls._value_dict:
214 global noCxxHeader
215 noCxxHeader = True
216 print >> sys.stderr, \
217 "warning: No header file specified for SimObject: %s" % name
216 warn("No header file specified for SimObject: %s", name)
218
219 # Export methods are automatically inherited via C++, so we
220 # don't want the method declarations to get inherited on the
221 # python side (and thus end up getting repeated in the wrapped
222 # versions of derived classes). The code below basicallly
223 # suppresses inheritance by substituting in the base (null)
224 # versions of these methods unless a different version is
225 # explicitly supplied.

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

799 child = self._children[name]
800 child.clear_parent(self)
801 del self._children[name]
802
803 # Add a new child to this object.
804 def add_child(self, name, child):
805 child = coerceSimObjectOrVector(child)
806 if child.has_parent():
217
218 # Export methods are automatically inherited via C++, so we
219 # don't want the method declarations to get inherited on the
220 # python side (and thus end up getting repeated in the wrapped
221 # versions of derived classes). The code below basicallly
222 # suppresses inheritance by substituting in the base (null)
223 # versions of these methods unless a different version is
224 # explicitly supplied.

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

798 child = self._children[name]
799 child.clear_parent(self)
800 del self._children[name]
801
802 # Add a new child to this object.
803 def add_child(self, name, child):
804 child = coerceSimObjectOrVector(child)
805 if child.has_parent():
807 print "warning: add_child('%s'): child '%s' already has parent" % \
808 (name, child.get_name())
806 warn("add_child('%s'): child '%s' already has parent", name,
807 child.get_name())
809 if self._children.has_key(name):
810 # This code path had an undiscovered bug that would make it fail
811 # at runtime. It had been here for a long time and was only
812 # exposed by a buggy script. Changes here will probably not be
813 # exercised without specialized testing.
814 self.clear_child(name)
815 child.set_parent(self, name)
816 self._children[name] = child

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

823 def adoptOrphanParams(self):
824 for key,val in self._values.iteritems():
825 if not isSimObjectVector(val) and isSimObjectSequence(val):
826 # need to convert raw SimObject sequences to
827 # SimObjectVector class so we can call has_parent()
828 val = SimObjectVector(val)
829 self._values[key] = val
830 if isSimObjectOrVector(val) and not val.has_parent():
808 if self._children.has_key(name):
809 # This code path had an undiscovered bug that would make it fail
810 # at runtime. It had been here for a long time and was only
811 # exposed by a buggy script. Changes here will probably not be
812 # exercised without specialized testing.
813 self.clear_child(name)
814 child.set_parent(self, name)
815 self._children[name] = child

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

822 def adoptOrphanParams(self):
823 for key,val in self._values.iteritems():
824 if not isSimObjectVector(val) and isSimObjectSequence(val):
825 # need to convert raw SimObject sequences to
826 # SimObjectVector class so we can call has_parent()
827 val = SimObjectVector(val)
828 self._values[key] = val
829 if isSimObjectOrVector(val) and not val.has_parent():
831 print "warning: %s adopting orphan SimObject param '%s'" \
832 % (self, key)
830 warn("%s adopting orphan SimObject param '%s'", self, key)
833 self.add_child(key, val)
834
835 def path(self):
836 if not self._parent:
837 return '<orphan %s>' % self.__class__
838 ppath = self._parent.path()
839 if ppath == 'root':
840 return self._name

--- 291 unchanged lines hidden ---
831 self.add_child(key, val)
832
833 def path(self):
834 if not self._parent:
835 return '<orphan %s>' % self.__class__
836 ppath = self._parent.path()
837 if ppath == 'root':
838 return self._name

--- 291 unchanged lines hidden ---