Overte C++ Documentation
NLPacketList.h
1 //
2 // NLPacketList.h
3 // libraries/networking/src
4 //
5 // Created by Stephen Birarda on 07/06/15.
6 // Copyright 2015 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_NLPacketList_h
13 #define hifi_NLPacketList_h
14 
15 #include <QtCore/QSharedPointer>
16 #include "udt/PacketList.h"
17 
18 #include "NLPacket.h"
19 
20 class NLPacketList : public udt::PacketList {
21 public:
22  static std::unique_ptr<NLPacketList> create(PacketType packetType, QByteArray extendedHeader = QByteArray(),
23  bool isReliable = false, bool isOrdered = false);
24 
25  PacketVersion getVersion() const { return _packetVersion; }
26  NLPacket::LocalID getSourceID() const { return _sourceID; }
27 
28  qint64 getMaxSegmentSize() const override { return NLPacket::maxPayloadSize(_packetType, _isOrdered); }
29 
30 private:
31  Q_DISABLE_COPY(NLPacketList)
32  NLPacketList(PacketType packetType, QByteArray extendedHeader = QByteArray(), bool isReliable = false,
33  bool isOrdered = false);
34  NLPacketList(udt::PacketList&& packetList);
35 
36  virtual std::unique_ptr<udt::Packet> createPacket() override;
37 
38  PacketVersion _packetVersion;
39  NLPacket::LocalID _sourceID;
40 };
41 
42 Q_DECLARE_METATYPE(QSharedPointer<NLPacketList>)
43 
44 #endif // hifi_PacketList_h