sbsv2/raptor/python/raptor_cache.py
branchwip
changeset 5 593a8820b912
parent 3 e1eecf4d390d
equal deleted inserted replaced
3:e1eecf4d390d 5:593a8820b912
   141 	def AddGroup(self, obj):
   141 	def AddGroup(self, obj):
   142 		if obj.name in self.groups:
   142 		if obj.name in self.groups:
   143 			self.WarnDuplicate("group", self.groups[obj.name], obj)
   143 			self.WarnDuplicate("group", self.groups[obj.name], obj)
   144 			return
   144 			return
   145 
   145 
   146 		obj.SetOwner(self.raptor)
       
   147 		self.groups[obj.name] = obj
   146 		self.groups[obj.name] = obj
   148 
   147 
   149 	def FindNamedAlias(self, name):
   148 	def FindNamedAlias(self, name):
   150 		return self.aliases[name]
   149 		return self.aliases[name]
   151 
   150 
   152 	def AddAlias(self, obj):
   151 	def AddAlias(self, obj):
   153 		if obj.name in self.aliases:
   152 		if obj.name in self.aliases:
   154 			self.WarnDuplicate("alias", self.aliases[obj.name], obj)
   153 			self.WarnDuplicate("alias", self.aliases[obj.name], obj)
   155 			return
   154 			return
   156 
   155 
   157 		obj.SetOwner(self.raptor)
       
   158 		self.aliases[obj.name] = obj
   156 		self.aliases[obj.name] = obj
   159 
   157 
   160 
   158 
   161 	def FindNamedInterface(self, name, cacheID = ""):
   159 	def FindNamedInterface(self, name, cacheID = ""):
   162 		try:
   160 		try:
   174 
   172 
   175 		if obj.name in self.interfaces[cacheID]:
   173 		if obj.name in self.interfaces[cacheID]:
   176 			self.WarnDuplicate("interface", self.interfaces[cacheID][obj.name], obj)
   174 			self.WarnDuplicate("interface", self.interfaces[cacheID][obj.name], obj)
   177 			return
   175 			return
   178 
   176 
   179 		obj.SetOwner(self.raptor)
       
   180 		obj.cacheID = cacheID
   177 		obj.cacheID = cacheID
   181 		self.interfaces[cacheID][obj.name] = obj
   178 		self.interfaces[cacheID][obj.name] = obj
   182 
   179 
   183 
   180 
   184 	def FindNamedVariant(self, name):
   181 	def FindNamedVariant(self, name):
   190 		if obj.name:
   187 		if obj.name:
   191 			if self.variants.has_key(obj.name):
   188 			if self.variants.has_key(obj.name):
   192 				self.WarnDuplicate("variant", self.variants[obj.name], obj)
   189 				self.WarnDuplicate("variant", self.variants[obj.name], obj)
   193 				return
   190 				return
   194 
   191 
   195 			obj.SetOwner(self.raptor)
       
   196 			self.variants[obj.name] = obj
   192 			self.variants[obj.name] = obj
   197 
   193 
   198 
   194 
   199 	def WarnDuplicate(self, type, objOld, objNew):
   195 	def WarnDuplicate(self, type, objOld, objNew):
   200 		"""tell us where duplicate objects came from."""
   196 		"""tell us where duplicate objects came from."""