def get_AbstractType_list(self): num_ints = self.get_int() num_doubles = self.get_int() num_chars = self.get_int() return_struct = AbstractType() if num_ints > 0: s = self.recv_buffer.read(num_ints * kIntSize) return_struct.intArray = list(struct.unpack("!%di" % num_ints, s)) if num_doubles > 0: s = self.recv_buffer.read(num_doubles * kDoubleSize) return_struct.doubleArray = list(struct.unpack("!%dd" % num_doubles, s)) if num_chars > 0: s = self.recv_buffer.read(num_chars * kCharSize) return_struct.charArray = list(struct.unpack("!%dc" % num_chars, s)) return return_struct
def get_AbstractType_numpy(self): num_ints = self.get_int() num_doubles = self.get_int() num_chars = self.get_int() return_struct = AbstractType() if num_ints > 0: s = self.recv_buffer.read(num_ints * kIntSize) assert kIntSize == 4 return_struct.intArray = numpy.frombuffer(s, dtype=numpy_int_type, count=num_ints) if num_doubles > 0: s = self.recv_buffer.read(num_doubles * kDoubleSize) return_struct.doubleArray = numpy.frombuffer(s, count=num_doubles, dtype=numpy_float_type) if num_chars > 0: s = self.recv_buffer.read(num_chars * kCharSize) return_struct.charArray = numpy.frombuffer(s, count=num_chars, dtype=numpy_char_type) return return_struct