public MessageElementStructure PackStructure(object s1) { using (vectorptr_messageelement m = new vectorptr_messageelement()) { if (s1 == null) { return(null); } FTData s = (FTData)s1; MessageElementUtil.AddMessageElementDispose(m, MessageElementUtil.NewMessageElementDispose("time", new long[] { s.time })); MessageElementUtil.AddMessageElementDispose(m, MessageElementUtil.NewMessageElementDispose("ft_data", s.ft_data)); return(new MessageElementStructure("sensors.ati.mini45.FTData", m)); } }
public T UnpackStructure <T>(MessageElementStructure m) { if (m == null) { return(default(T)); } FTData s = new FTData(); using (vectorptr_messageelement mm = m.Elements) { s.time = (MessageElementUtil.CastDataAndDispose <long[]>(MessageElement.FindElement(mm, "time")))[0]; s.ft_data = MessageElementUtil.CastDataAndDispose <double[]>(MessageElement.FindElement(mm, "ft_data")); T st; try { st = (T)((object)s); } catch (InvalidCastException) { throw new DataTypeMismatchException("Wrong structuretype"); } return(st); } }