eis/py/glitch/ctypeDefine.py

14 lines
392 B
Python

from ctypes import Structure, c_double, c_int, sizeof
class GlithData(Structure):
_fields_ = [
('data', c_double * 2000), # 定义长度为2000的double数组
('data_size', c_int)
]
def Transf(data,type_name="GlithData"):
try:
if type_name=="GlithData":
return GlithData.from_buffer_copy(data)
except:
return None
return None