forked from uml-robotics/ROS.NET
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathRosMessage.cs
91 lines (74 loc) · 2.45 KB
/
RosMessage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Uml.Robotics.Ros
{
public class RosMessage
{
public static RosMessage Generate(string rosMessageType)
{
var result = MessageTypeRegistry.Default.CreateMessage(rosMessageType);
if (result == null)
{
throw new ArgumentException($"Could not find a RosMessage for {rosMessageType}.", nameof(rosMessageType));
}
return result;
}
public IDictionary<string, string> connection_header;
private byte[] serialized;
public virtual string MD5Sum() { return string.Empty; }
public virtual bool HasHeader() { return false; }
public virtual bool IsMetaType() { return false; }
public virtual string MessageDefinition() { return string.Empty; }
public virtual bool IsServiceComponent() { return false; }
/// <summary>
/// ROS message type
/// </summary>
public virtual string MessageType { get { return "undefined/unknown"; } }
public byte[] Serialized { get => serialized; set => serialized = value; }
public RosMessage()
{
}
public RosMessage(byte[] serializedMessage)
{
Deserialize(serializedMessage);
}
public RosMessage(byte[] serializedMessage, ref int currentIndex)
{
Deserialize(serializedMessage, ref currentIndex);
}
public void Deserialize(byte[] serializedMessage)
{
int start = 0;
Deserialize(serializedMessage, ref start);
}
public virtual void Deserialize(byte[] serializedMessage, ref int currentIndex)
{
throw new NotImplementedException();
}
public byte[] Serialize()
{
return Serialize(false);
}
public virtual byte[] Serialize(bool isInnerMessage)
{
throw new NotImplementedException();
}
public virtual void Randomize()
{
throw new NotImplementedException();
}
public virtual bool Equals(RosMessage msg)
{
throw new NotImplementedException();
}
public override bool Equals(object obj)
{
return Equals(obj as RosMessage);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}