Skip to content
Snippets Groups Projects
Commit 65eb5f20 authored by Andrea Bulgarelli's avatar Andrea Bulgarelli
Browse files

changed signature of void Packet::decode(...) throw(PacketException*)

parent b3e2c109
Branches
Tags
No related merge requests found
...@@ -60,20 +60,20 @@ public: ...@@ -60,20 +60,20 @@ public:
/// Decode the packet /// Decode the packet
/// \param stream A pointer to the stream of byte, with prefix and 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 /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght
virtual bool decode(ByteStreamPtr stream, bool checkPacketLenght = false); virtual void decode(ByteStreamPtr stream, bool checkPacketLenght = false) throw(PacketException*);
/// Decode the packet /// Decode the packet
/// \param prefix A pointer to the stream of byte, with the prefix /// \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 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 /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght
virtual bool decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLenght = false); virtual void decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLenght = false) throw(PacketException*);
/// Decode the packet /// Decode the packet
/// \param prefix A pointer to the stream of byte, with the prefix /// \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 header
/// \param packetHeader A pointer to the stream of byte, with the packet data field /// \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 /// \param checkPacketLenght if true check the packet lenght and set the packet stream, if false do not check the packet lenght
virtual bool decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght = false); virtual void decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght = false) throw(PacketException*);
/// Verify the content of the packet (after the decode) /// Verify the content of the packet (after the decode)
///\return true is the packet contained into the stream is recognized using identifiers. ///\return true is the packet contained into the stream is recognized using identifiers.
......
...@@ -740,7 +740,7 @@ char* Packet::printPacketOutputStream() ...@@ -740,7 +740,7 @@ char* Packet::printPacketOutputStream()
bool Packet::decode(ByteStreamPtr stream, bool checkPacketLength) { void Packet::decode(ByteStreamPtr stream, bool checkPacketLength) throw(PacketException*) {
//save a pointer to the current stream to avoid shareptr deallocation //save a pointer to the current stream to avoid shareptr deallocation
this->stream = stream; this->stream = stream;
...@@ -783,11 +783,11 @@ bool Packet::decode(ByteStreamPtr stream, bool checkPacketLength) { ...@@ -783,11 +783,11 @@ bool Packet::decode(ByteStreamPtr stream, bool checkPacketLength) {
} }
//TODO OPTIMIZATION: set the followin method only when is needed //TODO OPTIMIZATION: set the followin method only when is needed
setByteStreamSections(); //10 per cent of time loss but safer setByteStreamSections(); //10 per cent of time loss but safer
return true; //return true;
} }
bool Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLength) { void Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacketLength) throw(PacketException*) {
this->stream = 0; this->stream = 0;
decodedPacketHeader = false; decodedPacketHeader = false;
...@@ -814,16 +814,16 @@ bool Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacket ...@@ -814,16 +814,16 @@ bool Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packet, bool checkPacket
} }
//TODO OPTIMIZATION: set the following method only when is needed //TODO OPTIMIZATION: set the following method only when is needed
setByteStreamSections(); //10 per cent of time loss but safer setByteStreamSections(); //10 per cent of time loss but safer
return true; //return true;
} }
bool Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght) { void Packet::decode(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool checkPacketLenght) throw(PacketException*) {
//merge packetHeader and packetDataField //merge packetHeader and packetDataField
ByteStreamPtr tmpPacket = ByteStreamPtr(new ByteStream(packetHeader, packetDataField, 0)); ByteStreamPtr tmpPacket = ByteStreamPtr(new ByteStream(packetHeader, packetDataField, 0));
return decode(prefix, tmpPacket, checkPacketLenght); decode(prefix, tmpPacket, checkPacketLenght);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment