public override byte[] Serialize(bool partofsomethingelse) { List <byte[]> pieces = new List <byte[]>(); if (Header == null) { Header = new Messages.std_msgs.Header(); } pieces.Add(Header.Serialize(true)); if (GoalId == null) { GoalId = new Messages.actionlib_msgs.GoalID(); } pieces.Add(GoalId.Serialize(true)); if (Goal == null) { Goal = new TGoal(); } pieces.Add(Goal.Serialize(true)); // combine every array in pieces into one array and return it int __a_b__f = pieces.Sum((__a_b__c) => __a_b__c.Length); int __a_b__e = 0; byte[] __a_b__d = new byte[__a_b__f]; foreach (var __p__ in pieces) { Array.Copy(__p__, 0, __a_b__d, __a_b__e, __p__.Length); __a_b__e += __p__.Length; } return(__a_b__d); }
public override void Deserialize(byte[] serializedMessage, ref int currentIndex) { Header = new Messages.std_msgs.Header(serializedMessage, ref currentIndex); GoalId = new Messages.actionlib_msgs.GoalID(serializedMessage, ref currentIndex); Goal = (TGoal)typeof(TGoal).GetInstance(); Goal.Deserialize(serializedMessage, ref currentIndex); }
public override void Deserialize(byte[] serializedMessage, ref int currentIndex) { Header = new Messages.std_msgs.Header(serializedMessage, ref currentIndex); GoalId = new Messages.actionlib_msgs.GoalID(serializedMessage, ref currentIndex); Goal = (TGoal)Activator.CreateInstance(typeof(TGoal), serializedMessage, currentIndex); }