def getMethod(self, method_name): ''' Overriden from baseclass. ''' #sanity check self._BaseRepresentation__checkCompRef() if BaseRepresentation.getMethod(self, method_name)!=None: return BaseRepresentation.getMethod(self, method_name) #list of return values return_list = [] #create the temporary dictionary that will be returned later ret_val = { 'Value':[ "None" ], 'Timeout': getStandardTimeout()} #Check the method's name to see if it's really a RW attribute #This will be true if the method name starts with "_set_". If this #happens to be the case, just return if method_name.rfind("_set_") == 0: self.__logger.logDebug("Write attribute:" + method_name) return ret_val #Check to see if the method's name begins with "_get_". If this is #true, this is a special case because we do not have to worry #about inout and out parameters. elif method_name.rfind("_get_") == 0: self.__handleReadAttribute(method_name, return_list) #Since we've gotten this far, we must now examine the IFR to determine #which return values (if any) and exceptions this method can #return/throw. else: self.__handleNormalMethod(method_name, return_list) #convert the list of typecodes to a list of real implementations of #those types #if the methodname was not found... if len(return_list) == 0: self.__logger.logWarning("Failed to dynamically generate '" + method_name + "' because the IFR" + " was missing information on the method!") raise CORBA.NO_RESOURCES() ret_val['Value'] = self.__typecodesToObjects(return_list) self.__logger.logDebug("retVal looks like:" + method_name + " " + str(ret_val)) return ret_val
def getMethod(self, method_name): mdict = BaseRepresentation.getMethod(self, method_name) if mdict != None: return mdict if self.simulator == None: return None try: mdict = {} method_info = self.simulator.getMethod(self.compname, method_name) mdict['Timeout'] = method_info.timeout mdict['Value'] = method_info.code return mdict except NoSuchMethodEx: pass try: mdict = {} method_info = self.simulator.getMethodIF(self.comp_type, method_name) mdict['Timeout'] = method_info.timeout mdict['Value'] = method_info.code return mdict except NoSuchMethodEx: return None
def getMethod(self, method_name): mdict = BaseRepresentation.getMethod(self, method_name) if mdict != None: return mdict if self.simulator == None: return None try: mdict = {} method_info = self.simulator.getMethod(self.compname, method_name) mdict['Timeout'] = method_info.timeout mdict['Value'] = method_info.code return mdict except NoSuchMethodEx: pass try: mdict = {} method_info = self.simulator.getMethodIF(self.comp_type, method_name) mdict['Timeout'] = method_info.timeout mdict['Value'] = method_info.code return mdict except NoSuchMethodEx: return None
def getMethod(self, method_name): ''' Overriden from baseclass. ''' #sanity check self._BaseRepresentation__checkCompRef() if BaseRepresentation.getMethod(self, method_name) != None: return BaseRepresentation.getMethod(self, method_name) #list of return values return_list = [] #create the temporary dictionary that will be returned later ret_val = {'Value': ["None"], 'Timeout': getStandardTimeout()} #Check the method's name to see if it's really a RW attribute #This will be true if the method name starts with "_set_". If this #happens to be the case, just return if method_name.rfind("_set_") == 0: self.__logger.logDebug("Write attribute:" + method_name) return ret_val #Check to see if the method's name begins with "_get_". If this is #true, this is a special case because we do not have to worry #about inout and out parameters. elif method_name.rfind("_get_") == 0: self.__handleReadAttribute(method_name, return_list) #Since we've gotten this far, we must now examine the IFR to determine #which return values (if any) and exceptions this method can #return/throw. else: self.__handleNormalMethod(method_name, return_list) #convert the list of typecodes to a list of real implementations of #those types #if the methodname was not found... if len(return_list) == 0: self.__logger.logWarning("Failed to dynamically generate '" + method_name + "' because the IFR" + " was missing information on the method!") raise CORBA.NO_RESOURCES() ret_val['Value'] = self.__typecodesToObjects(return_list) self.__logger.logDebug("retVal looks like:" + method_name + " " + str(ret_val)) return ret_val