15 #include "networktables/NetworkTableValue.h" 23 struct private_init {};
31 kServerHelloDone = 0x03,
33 kClientHelloDone = 0x05,
42 typedef std::function<NT_Type(unsigned int id)> GetEntryTypeFunc;
44 Message() : m_type(kUnknown), m_id(0), m_flags(0), m_seq_num_uid(0) {}
45 Message(MsgType type,
const private_init&)
46 : m_type(type), m_id(0), m_flags(0), m_seq_num_uid(0) {}
48 MsgType type()
const {
return m_type; }
49 bool Is(MsgType type)
const {
return type == m_type; }
54 std::shared_ptr<Value> value()
const {
return m_value; }
55 unsigned int id()
const {
return m_id; }
56 unsigned int flags()
const {
return m_flags; }
57 unsigned int seq_num_uid()
const {
return m_seq_num_uid; }
61 static std::shared_ptr<Message> Read(
WireDecoder& decoder,
62 GetEntryTypeFunc get_entry_type);
65 static std::shared_ptr<Message> KeepAlive() {
66 return std::make_shared<Message>(kKeepAlive, private_init());
68 static std::shared_ptr<Message> ProtoUnsup() {
69 return std::make_shared<Message>(kProtoUnsup, private_init());
71 static std::shared_ptr<Message> ServerHelloDone() {
72 return std::make_shared<Message>(kServerHelloDone, private_init());
74 static std::shared_ptr<Message> ClientHelloDone() {
75 return std::make_shared<Message>(kClientHelloDone, private_init());
77 static std::shared_ptr<Message> ClearEntries() {
78 return std::make_shared<Message>(kClearEntries, private_init());
83 static std::shared_ptr<Message> ServerHello(
unsigned int flags,
88 std::shared_ptr<Value> value,
90 static std::shared_ptr<Message> EntryUpdate(
unsigned int id,
92 std::shared_ptr<Value> value);
93 static std::shared_ptr<Message> FlagsUpdate(
unsigned int id,
95 static std::shared_ptr<Message> EntryDelete(
unsigned int id);
96 static std::shared_ptr<Message> ExecuteRpc(
unsigned int id,
unsigned int uid,
98 static std::shared_ptr<Message> RpcResponse(
unsigned int id,
unsigned int uid,
109 std::shared_ptr<Value> m_value;
111 unsigned int m_flags;
112 unsigned int m_seq_num_uid;
117 #endif // NT_MESSAGE_H_
Definition: WireEncoder.h:25
Definition: IEntryNotifier.h:15
Definition: WireDecoder.h:27
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:42