Loading PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate −580 B (41.5 KiB) File changed.No diff preview for this file type. View original file View changed file include/Packet.h +3 −3 Original line number Diff line number Diff line Loading @@ -60,20 +60,20 @@ public: /// Decode the packet /// \param stream A pointer to the stream of byte, with prefix and packet /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght virtual void decode(ByteStreamPtr stream, bool checkPacketLenght = false) throw(PacketException*); virtual bool decode(ByteStreamPtr stream, bool checkPacketLenght = false); /// Decode the packet /// \param prefix A pointer to the stream of byte, with the prefix /// \param packet A pointer to the stream of byte, with the packet /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght virtual void decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLenght = false) throw(PacketException*); virtual bool decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLenght = false); /// Decode the packet /// \param prefix A pointer to the stream of byte, with the prefix /// \param packetHeader A pointer to the stream of byte, with the packet header /// \param packetHeader A pointer to the stream of byte, with the packet data field /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght virtual void decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght = false) throw(PacketException*); virtual bool decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght = false); /// Verify the content of the packet (after the decode) ///\return true is the packet contained into the stream is recognized using identifiers. Loading src/Packet.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -740,7 +740,7 @@ char* Packet::printPacketOutputStream() void Packet::decode(ByteStreamPtr stream, bool checkPacketLength) throw(PacketException*) { bool Packet::decode(ByteStreamPtr stream, bool checkPacketLength) { //save a pointer to the current stream to avoid shareptr deallocation this->stream = stream; Loading Loading @@ -783,11 +783,11 @@ void Packet::decode(ByteStreamPtr stream, bool checkPacketLength) throw(PacketEx } //TODO OPTIMIZATION: set the followin method only when is needed setByteStreamSections(); //10 per cent of time loss but safer //return true; return true; } void Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLength) throw(PacketException*) { bool Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLength) { this->stream = 0; decodedPacketHeader = false; Loading @@ -814,16 +814,16 @@ void Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacket } //TODO OPTIMIZATION: set the following method only when is needed setByteStreamSections(); //10 per cent of time loss but safer //return true; return true; } void Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght) throw(PacketException*) { bool Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght) { //merge packetHeader and packetDataField ByteStreamPtr tmpPacket = ByteStreamPtr(new ByteStream(packetHeader, packetDataField, 0)); decode(prefix, tmpPacket, checkPacketLenght); return decode(prefix, tmpPacket, checkPacketLenght); } Loading Loading
PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate −580 B (41.5 KiB) File changed.No diff preview for this file type. View original file View changed file
include/Packet.h +3 −3 Original line number Diff line number Diff line Loading @@ -60,20 +60,20 @@ public: /// Decode the packet /// \param stream A pointer to the stream of byte, with prefix and packet /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght virtual void decode(ByteStreamPtr stream, bool checkPacketLenght = false) throw(PacketException*); virtual bool decode(ByteStreamPtr stream, bool checkPacketLenght = false); /// Decode the packet /// \param prefix A pointer to the stream of byte, with the prefix /// \param packet A pointer to the stream of byte, with the packet /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght virtual void decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLenght = false) throw(PacketException*); virtual bool decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLenght = false); /// Decode the packet /// \param prefix A pointer to the stream of byte, with the prefix /// \param packetHeader A pointer to the stream of byte, with the packet header /// \param packetHeader A pointer to the stream of byte, with the packet data field /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght virtual void decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght = false) throw(PacketException*); virtual bool decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght = false); /// Verify the content of the packet (after the decode) ///\return true is the packet contained into the stream is recognized using identifiers. Loading
src/Packet.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -740,7 +740,7 @@ char* Packet::printPacketOutputStream() void Packet::decode(ByteStreamPtr stream, bool checkPacketLength) throw(PacketException*) { bool Packet::decode(ByteStreamPtr stream, bool checkPacketLength) { //save a pointer to the current stream to avoid shareptr deallocation this->stream = stream; Loading Loading @@ -783,11 +783,11 @@ void Packet::decode(ByteStreamPtr stream, bool checkPacketLength) throw(PacketEx } //TODO OPTIMIZATION: set the followin method only when is needed setByteStreamSections(); //10 per cent of time loss but safer //return true; return true; } void Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLength) throw(PacketException*) { bool Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLength) { this->stream = 0; decodedPacketHeader = false; Loading @@ -814,16 +814,16 @@ void Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacket } //TODO OPTIMIZATION: set the following method only when is needed setByteStreamSections(); //10 per cent of time loss but safer //return true; return true; } void Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght) throw(PacketException*) { bool Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght) { //merge packetHeader and packetDataField ByteStreamPtr tmpPacket = ByteStreamPtr(new ByteStream(packetHeader, packetDataField, 0)); decode(prefix, tmpPacket, checkPacketLenght); return decode(prefix, tmpPacket, checkPacketLenght); } Loading