SimObject.py (5037:f7af52292c45) | SimObject.py (5244:bf32c57328f5) |
---|---|
1# Copyright (c) 2004-2006 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 779 unchanged lines hidden (view full) --- 788 setattr(cc_params, port_name, port) 789 self._ccParams = cc_params 790 return self._ccParams 791 792 # Get C++ object corresponding to this object, calling C++ if 793 # necessary to construct it. Does *not* recursively create 794 # children. 795 def getCCObject(self): | 1# Copyright (c) 2004-2006 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 779 unchanged lines hidden (view full) --- 788 setattr(cc_params, port_name, port) 789 self._ccParams = cc_params 790 return self._ccParams 791 792 # Get C++ object corresponding to this object, calling C++ if 793 # necessary to construct it. Does *not* recursively create 794 # children. 795 def getCCObject(self): |
796 params = self.getCCParams() | |
797 if not self._ccObject: | 796 if not self._ccObject: |
798 self._ccObject = -1 # flag to catch cycles in recursion | 797 # Cycles in the configuration heirarchy are not supported. This 798 # will catch the resulting recursion and stop. 799 self._ccObject = -1 800 params = self.getCCParams() |
799 self._ccObject = params.create() 800 elif self._ccObject == -1: | 801 self._ccObject = params.create() 802 elif self._ccObject == -1: |
801 raise RuntimeError, "%s: recursive call to getCCObject()" \ | 803 raise RuntimeError, "%s: Cycle found in configuration heirarchy." \ |
802 % self.path() 803 return self._ccObject 804 805 # Call C++ to create C++ object corresponding to this object and 806 # (recursively) all its children 807 def createCCObject(self): 808 self.getCCParams() 809 self.getCCObject() # force creation --- 99 unchanged lines hidden --- | 804 % self.path() 805 return self._ccObject 806 807 # Call C++ to create C++ object corresponding to this object and 808 # (recursively) all its children 809 def createCCObject(self): 810 self.getCCParams() 811 self.getCCObject() # force creation --- 99 unchanged lines hidden --- |