diff --git a/ChangeLog b/ChangeLog index f12599cd088901b0e49b076d3132fc283d3cadf3..08c6f289ff872df81c2b6ebf570d01bb7ab4663e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ + ++ moved InputPacketStream::getPacket() to PacketStream ++ changed "onlySections" into decodeType: + 0) do not decode anything + 1) decode only sections (prefix, header, data field header, source data field fixed part, source data field variable part) + 3) decode blocks (all sections + all blocks of the source data field variable part + 2014-03-06 Andrea Bulgarelli, Andrea Zoli TAG v3.4.0 + Packet* InputPacketStream::readPacket(int decodeType) and Packet* getPacket(ByteStreamPtr packet, int decodeType = 2) diff --git a/include/InputPacketStream.h b/include/InputPacketStream.h index 0e7cbb998917aaf1a0495a5e0816f769bd3c86ee..bbdb711144bda2c9e481bed437e60d9bd448d288 100644 --- a/include/InputPacketStream.h +++ b/include/InputPacketStream.h @@ -36,26 +36,6 @@ public: ~InputPacketStream(); - /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. - /// \param prefix A ByteStream that contains the prefix of packet (if present). - /// \param packetHeader A ByteStream that contains the packet header. - /// \param packetDataField A ByteStream that contains the packet data field. - int detPacketType(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField); - - /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. - /// \param prefix A ByteStream that contains the prefix of packet (if present). - /// \param packet A ByteStream that contains the packet. - int detPacketType(ByteStreamPtr prefix, ByteStreamPtr packet); - - ///It returns the index of the packet type contained in the stream. The stream* contains also the prefix (if present) - /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. - /// \param packet A ByteStream pointer that contains the packet. - int detPacketType(ByteStreamPtr packet); - - ///It returns the total dimension of the packet contained in the stream (without prefix). The stream* contains also the prefix (if present) - ///\param The stream with the prefix (if present) - dword getPacketDimension(ByteStreamPtr stream); - /// This method sets the generic input of the stream /// \param in An input. void setInput(Input* in); @@ -66,11 +46,7 @@ public: /// \return A pointer telemetry packet. Make attention: the object returned is one of the TM packet object of the array of this object. Don't delete it! Packet* readPacket(int decodeType = 2) throw(PacketExceptionIO*); - /// get a Packet* from a ByteStream - /// \pre the prefix has been removed - /// \param packet the stream that contains the source packet without the prefix - /// \param decodeType (0) do not decode anything (1) decode only sections (prefix, header, data field header, source data field fixed part, source data field variable part) (2) decode blocks (all sections + all blocks of the ‘source data field variable part’) - Packet* getPacket(ByteStreamPtr packet, int decodeType = 2) throw(PacketException*); + protected: diff --git a/include/Packet.h b/include/Packet.h index 8a07ecacd8518b8e9640cbe38ca5a98779978048..e547d899872509c4578c66b712e0626fe49fb44e 100644 --- a/include/Packet.h +++ b/include/Packet.h @@ -64,42 +64,39 @@ public: /// correct value virtual bool setAndVerifyPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet); - /// Set the internal prefix and packet. - virtual void setByteStreamPointers(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField); - - /// Set the internal prefix and packet. - virtual void setByteStreamPointers(ByteStreamPtr prefix, ByteStreamPtr packet); - /// Sets all the fields of the packet with correct value contained into the input ByteStream. /// \pre The structure of the stream must be loaded. /// \param prefix This is the prefix of the packet /// \param packetHeader This is the header of the packet /// \param packetDataField This is the data field of the packet + /// \param decodeType (0) do not decode anything (1) decode only sections (prefix, header, data field header, source data field fixed part, source data field variable part) (2) decode blocks (all sections + all blocks of the ‘source data field variable part’) /// \post If return is true all the fields are set with the correct value. - virtual bool setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool onlySections = false); + virtual bool setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, int decodeType); /// Sets all the fields of the packet with correct value contained into the input ByteStream. /// \pre The structure of the stream must be loaded. /// \param prefix This is the prefix of the packet /// \param packet This is the packet + /// \param decodeType (0) do not decode anything (1) decode only sections (prefix, header, data field header, source data field fixed part, source data field variable part) (2) decode blocks (all sections + all blocks of the ‘source data field variable part’) /// \post If return is true all the fields are set with the correct value. - virtual bool setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet, bool onlySections = false); + virtual bool setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet, int decodeType); /// Verifies if within the ByteStream passed with arguments it's present a correct packet. /// \pre The structure of the stream must be loaded. /// \param prefix This is the prefix of the packet /// \param packet This is the packet /// \return True if the ByteStream contains a packet - bool verifyPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet); + virtual bool verifyPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet); /// Verifies if within the byte* stream passed with arguments it's present a correct packet. The stream* contains also the prefix (if present) /// \param stream A pointer to the stream of byte, with prefix and packet - bool verifyPacketValue(byte* stream); + virtual bool verifyPacketValue(byte* stream); /// Sets all the fields of the packet with correct value contained into the input ByteStream. /// \param stream A pointer to the stream of byte, with prefix and packet /// \param decode only the sections - bool setPacketValue(byte* stream, bool onlySections = false); + /// \param decodeType (0) do not decode anything (1) decode only sections (prefix, header, data field header, source data field fixed part, source data field variable part) (2) decode blocks (all sections + all blocks of the ‘source data field variable part’) + virtual bool setPacketValue(ByteStreamPtr stream, int decodeType); /// Verifies if within the ByteStream passed with arguments it's present a correct packet. /// \pre The structure of the stream must be loaded. @@ -107,7 +104,7 @@ public: /// \param packetHeader This is the header of the packet. /// \param packetDataField This is the data field of the packet. /// \return True if the ByteStream contains a packet. - bool verifyPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField); + virtual bool verifyPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField); /// Prints to stdout the value of packet data field in a formatted mode. virtual void printPacketValue(); @@ -126,20 +123,16 @@ public: /// Prints the hexadecimal dump of the data field header. virtual char* printDataFieldHeaderStream(); - /// Prints the source data field values. virtual char** printSourceDataFieldValue(); - /// Prints the hexadecimal dump of the source data field. virtual char* printSourceDataFieldStream(); - /// Prints the tail values virtual char** printTailValue(); - /// Print he hexadecimal dump of the tail. virtual char* printTailStream(); @@ -217,31 +210,30 @@ public: protected: - + + /// Set the internal prefix and packet. + virtual void setByteStreamPointers(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField); + + /// Set the internal prefix and packet. + virtual void setByteStreamPointers(ByteStreamPtr prefix, ByteStreamPtr packet); /// Generates the stream for output. /// \pre the number of block and the number of element for each block /// must be set (if appliable) virtual void generateStream(); - - - + /// Loads the configuration of identifiers from file .packet. virtual bool loadIdentifiers(ConfigurationFile& file); - /// This is the number that identifies the packet in the .stream file byte packetID; - /// The name of the packet char* name; - /// List of identifiers. This identifiers permits to identify if the stream contains /// a particular type of packet PacketIdentifier** identifiers; - /// List of bool that indicates which part of packet are presents into one or more /// identifiers. 0 is the header, 1 is the data field header, 2 is the source data field @@ -255,7 +247,8 @@ protected: bool setPacketValueDataFieldHeader(ByteStreamPtr packetDataField); - bool setPacketValueSourceDataField(ByteStreamPtr packetDataField, bool onlySections = false); + /// \param decodeType (0) do not decode anything (1) decode only sections (prefix, header, data field header, source data field fixed part, source data field variable part) (2) decode blocks (all sections + all blocks of the ‘source data field variable part’) + bool setPacketValueSourceDataField(ByteStreamPtr packetDataField, int decodeType); bool setPacketValueHeader(ByteStreamPtr header); @@ -271,7 +264,6 @@ protected: word dimPrefix; - /// The name of the file .packet that contains the structure of the packet char* filename; diff --git a/include/PacketStream.h b/include/PacketStream.h index e21b38d878a3e3730b1abee21cf2302713222fae..ede3294e3e4401060c77792aab24155878d0642e 100644 --- a/include/PacketStream.h +++ b/include/PacketStream.h @@ -36,6 +36,32 @@ public: PacketStream(); ~PacketStream(); + + /// get a Packet* from a ByteStream + /// \pre the prefix has been removed + /// \param packet the stream that contains the source packet without the prefix + /// \param decodeType (0) do not decode anything (1) decode only sections (prefix, header, data field header, source data field fixed part, source data field variable part) (2) decode blocks (all sections + all blocks of the ‘source data field variable part’) + Packet* getPacket(ByteStreamPtr packet, int decodeType = 2) throw(PacketException*); + + /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. + /// \param prefix A ByteStream that contains the prefix of packet (if present). + /// \param packetHeader A ByteStream that contains the packet header. + /// \param packetDataField A ByteStream that contains the packet data field. + int detPacketType(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField); + + /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. + /// \param prefix A ByteStream that contains the prefix of packet (if present). + /// \param packet A ByteStream that contains the packet. + int detPacketType(ByteStreamPtr prefix, ByteStreamPtr packet); + + ///It returns the index of the packet type contained in the stream. The stream* contains also the prefix (if present) + /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. + /// \param packet A ByteStream pointer that contains the packet. + int detPacketType(ByteStreamPtr packet); + + ///It returns the total dimension of the packet contained in the stream (without prefix). The stream* contains also the prefix (if present) + ///\param The stream with the prefix (if present) + dword getPacketDimension(ByteStreamPtr stream); void setFileNameConfig(const char* f); @@ -49,7 +75,7 @@ public: static char* packetLibVersion() { - return (char*) "PacketLib version: 1.3.9 - June 2012"; + return (char*) "PacketLib version: 3.4.0 - June 2012"; }; bool isBigEndian(); diff --git a/include/PlVersion.h b/include/PlVersion.h index 6459aa79d6b812a4eca7b9c1471aca292f0d3f63..2a061a307a957987225cc7fc66d97c016633dd55 100644 --- a/include/PlVersion.h +++ b/include/PlVersion.h @@ -1 +1 @@ -#define VERSION 3.0.0 +#define VERSION 3.4.0 diff --git a/include/SDFRBBlock.h b/include/SDFRBBlock.h index 181c2fc6d29fdbb1e36b998ce7416e9df44023a8..cc0690b29fc04f2b73be2afa5bc53da1f908d757 100644 --- a/include/SDFRBBlock.h +++ b/include/SDFRBBlock.h @@ -150,7 +150,7 @@ public: virtual ByteStreamPtr generateStream(bool bigendian); - virtual bool setByteStream(ByteStreamPtr s, bool onlySections = false); + virtual bool setByteStream(ByteStreamPtr s, int decodeType); virtual ByteStreamPtr getByteStream() { diff --git a/include/SDFRBlock.h b/include/SDFRBlock.h index 347b8fdc123e80b1cd8d67431663e0d0864682af..1dc9ab003030c57282fb8b6653f6fe6444e72565 100644 --- a/include/SDFRBlock.h +++ b/include/SDFRBlock.h @@ -75,7 +75,8 @@ public: virtual dword getDimensionFixedPart(); - virtual bool setByteStream(ByteStreamPtr s, bool onlySections = false); + //onlySections = false + virtual bool setByteStream(ByteStreamPtr s, int decodeType); virtual bool setOutputStream(ByteStreamPtr os, dword first); diff --git a/include/SourceDataField.h b/include/SourceDataField.h index 1d224ba091680ee021eb6109f387fb497d7c602c..6858114d3ff881933fc691220319b24e91d1d674 100644 --- a/include/SourceDataField.h +++ b/include/SourceDataField.h @@ -34,7 +34,7 @@ public: virtual ~SourceDataField(); /// Sets the stream of byte. This method assigns the value of stream for each field of part of packet - virtual bool setByteStream(ByteStreamPtr s, bool onlySections = false) { PartOfPacket::setByteStream(s); return true; }; + virtual bool setByteStream(ByteStreamPtr s, int decodeType) { PartOfPacket::setByteStream(s); return true; }; /// Gets the total max dimension in bytes of source data field virtual dword getMaxDimension() = 0; diff --git a/src/InputPacketStream.cpp b/src/InputPacketStream.cpp index 935a6a8f027e7d6baca3253542e20ad24da69847..f2dc51946f1813fe9c998cf200e0660c4793937e 100644 --- a/src/InputPacketStream.cpp +++ b/src/InputPacketStream.cpp @@ -40,47 +40,6 @@ InputPacketStream::~InputPacketStream() } -int InputPacketStream::detPacketType(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField) -{ - /// Iterate through list and output each element. - /// The packetType 0 is the packet not recognized - for (int i = 1; iverifyPacketValue(prefix, packetHeader, packetDataField)) - return i; - } - return 0; -} - - - -int InputPacketStream::detPacketType(ByteStreamPtr prefix, ByteStreamPtr packet) -{ - /// Iterate through list and output each element. - /// The packetType 0 is the packet not recognized - for (dword i = 1; iverifyPacketValue(prefix, packet)) - return i; - } - return 0; -} - - -int InputPacketStream::detPacketType(ByteStreamPtr packet) -{ - /// Iterate through list and output each element. - /// The packetType 0 is the packet not recognized - for (dword i = 1; iverifyPacketValue(packet->stream)) - return i; - } - return 0; -} void InputPacketStream::setInput(Input* in) { @@ -148,16 +107,10 @@ Packet* InputPacketStream::readPacket(int decodeType) throw(PacketExceptionIO*) Packet* p = packetType[pindex]; - if(decodeType > 0) - { - bool onlySection = decodeType==1?true:false; - if(!p->setPacketValue(b0, b1, b2, onlySection)) //gli stream diventano del packet - throw new PacketExceptionIO("it is impossible to resolve the packet."); - } - else - { - p->setByteStreamPointers(b0, b1, b2); - } + + if(!p->setPacketValue(b0, b1, b2, decodeType)) //gli stream diventano del packet + throw new PacketExceptionIO("it is impossible to resolve the packet."); + return p; } @@ -169,42 +122,6 @@ Packet* InputPacketStream::readPacket(int decodeType) throw(PacketExceptionIO*) } } -dword InputPacketStream::getPacketDimension(ByteStreamPtr stream) { - dword dimPre = 0; - if(prefix) - dimPre += dimPrefix; - //ByteStreamPtr prefix = new ByteStream(stream, dimPre, bigendian); - - dword dim = 0; - dword dimHeader = headerReference->getDimension(); - dim += dimHeader; - ByteStreamPtr tempHeader = ByteStreamPtr(new ByteStream()); - tempHeader->setStream(stream->stream+dimPre, dimHeader, bigendian); - headerReference->setByteStream(tempHeader); - dim += headerReference->getPacketLength(); - return dim; -} -Packet* PacketLib::InputPacketStream::getPacket(ByteStreamPtr stream, int decodeType) throw(PacketException*){ - - int index = detPacketType(stream); - if(index > 0) { - Packet* p = getPacketType(index); - - if(decodeType > 0) - { - bool onlySection = decodeType==1?true:false; - if(!p->setPacketValue(stream->stream, onlySection)) //gli stream diventano del packet - throw new PacketExceptionIO("it is impossible to resolve the packet."); - } - else - { - p->setByteStreamPointers(0, stream); - } - return p; - - } - else - return 0; -} + diff --git a/src/InputPacketStreamFile.cpp b/src/InputPacketStreamFile.cpp index da260b06247f63e3f08ddef70dff76b15bd1fbe6..996b754324ee93728ee572a1eb20cd7fb749fce8 100644 --- a/src/InputPacketStreamFile.cpp +++ b/src/InputPacketStreamFile.cpp @@ -211,7 +211,7 @@ Packet* InputPacketStreamFile::getPacketFromFileStreamPointer(int index, bool ne pnew->createPacketType((char*)sf.c_str(), prefix, dimPrefix); p = pnew; } - if(p->setPacketValue(b0, b1, b2)) + if(p->setPacketValue(b0, b1, b2, 2)) return p; else return NULL; diff --git a/src/Packet.cpp b/src/Packet.cpp index cbbc2cafaa046ede9e4cbc521779b329377deeb5..4f376b3d512f67e003bc96fe5638be3ffc308a7e 100644 --- a/src/Packet.cpp +++ b/src/Packet.cpp @@ -304,10 +304,14 @@ void Packet::setByteStreamPointers(ByteStreamPtr prefix, ByteStreamPtr packet) memByteStream(prefix, packet); } -bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool onlySections) +bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, int decodeType) { + setByteStreamPointers(prefix, packetHeader, packetDataField); + if(decodeType == 0) + return true; + //cout << "@ " << packetDataField->getDimension() << endl; /// 1) if(!setPacketValueVerify(prefix, packetHeader, packetDataField)) @@ -334,7 +338,7 @@ bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, By return false; } /// 5) - if(!setPacketValueSourceDataField(packetDataField, onlySections)) + if(!setPacketValueSourceDataField(packetDataField, decodeType)) { PRINTERROR("Error in set packet value source data field"); return false; @@ -351,13 +355,13 @@ bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, By -bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet, bool onlySections) +bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet, int decodeType) { dword dimHeader = header->getDimension(); memByteStream(prefix, packet); tempHeader->setStream(packet, 0, dimHeader-1); tempDataField->setStream(packet, dimHeader, packet->getDimension()); - return setPacketValue(prefix, tempHeader, tempDataField, onlySections); + return setPacketValue(prefix, tempHeader, tempDataField, decodeType); } @@ -379,7 +383,7 @@ bool Packet::verifyPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, memByteStream(prefix, packetHeader, packetDataField); if(type_of_identifier[2] == true) { - if(!setPacketValue(prefix, packetHeader, packetDataField)) + if(!setPacketValue(prefix, packetHeader, packetDataField, 2)) { return false; } @@ -478,7 +482,7 @@ bool Packet::setAndVerifyPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetH } } - if(!setPacketValueSourceDataField(packetDataField)) + if(!setPacketValueSourceDataField(packetDataField, 2)) { PRINTERROR("Error in set packet value source data field"); return false; @@ -606,7 +610,7 @@ bool Packet::setPacketValueDataFieldHeader(ByteStreamPtr packetDataField) } -bool Packet::setPacketValueSourceDataField(ByteStreamPtr packetDataField, bool onlySections) +bool Packet::setPacketValueSourceDataField(ByteStreamPtr packetDataField, int decodeType) { bool b; dword packetLength; @@ -634,7 +638,7 @@ bool Packet::setPacketValueSourceDataField(ByteStreamPtr packetDataField, bool o b = tempPacketDataField->setStream(packetDataField, packetLength, packetLength+packetLength2-1); if(b) { - bool ret = dataField->sourceDataField->setByteStream(tempPacketDataField, onlySections); + bool ret = dataField->sourceDataField->setByteStream(tempPacketDataField, decodeType); //word nrd = dataField->sourceDataField->getNumberOfRealDataBlock(); return ret; } @@ -816,20 +820,27 @@ bool Packet::verifyPacketValue(byte* stream) { return verifyPacketValue(prefix, packet); } -bool Packet::setPacketValue(byte* stream, bool onlySections) { +bool Packet::setPacketValue(ByteStreamPtr stream, int decodeType) { + + if(decodeType == 0 && !thereisprefix) { + setByteStreamPointers(0, stream); + return true; + } + dword dimPre = 0; if(thereisprefix) - dimPre = dimPrefix; - ByteStreamPtr prefix = ByteStreamPtr(new ByteStream(stream, dimPre, bigendian)); + dimPre = dimPrefix; + + ByteStreamPtr prefix = ByteStreamPtr(new ByteStream(stream->stream, dimPre, bigendian)); dword dim = 0; dword dimHeader = header->getDimension(); dim += dimHeader; - tempHeader->setStream(stream+dimPre, dimHeader, bigendian); + tempHeader->setStream(stream->stream+dimPre, dimHeader, bigendian); header->setByteStream(tempHeader); dim += header->getPacketLength() + 1; - ByteStreamPtr packet = ByteStreamPtr(new ByteStream(stream+dimPre, dim, bigendian)); + ByteStreamPtr packet = ByteStreamPtr(new ByteStream(stream->stream+dimPre, dim, bigendian)); - return setPacketValue(prefix, packet, onlySections); + return setPacketValue(prefix, packet, decodeType); } diff --git a/src/PacketStream.cpp b/src/PacketStream.cpp index 0f2e2e7ece778e0986ce7ff16e03eaf56d590a47..800698b98cd74a12546fd41cd8ad7eebcb0d84aa 100644 --- a/src/PacketStream.cpp +++ b/src/PacketStream.cpp @@ -67,6 +67,82 @@ PacketStream::~PacketStream() free(pathFileNameConfig); } +dword PacketStream::getPacketDimension(ByteStreamPtr stream) { + dword dimPre = 0; + if(prefix) + dimPre += dimPrefix; + //ByteStreamPtr prefix = new ByteStream(stream, dimPre, bigendian); + + dword dim = 0; + dword dimHeader = headerReference->getDimension(); + dim += dimHeader; + ByteStreamPtr tempHeader = ByteStreamPtr(new ByteStream()); + tempHeader->setStream(stream->stream+dimPre, dimHeader, bigendian); + headerReference->setByteStream(tempHeader); + dim += headerReference->getPacketLength(); + return dim; +} + + +int PacketStream::detPacketType(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField) +{ + /// Iterate through list and output each element. + /// The packetType 0 is the packet not recognized + for (int i = 1; iverifyPacketValue(prefix, packetHeader, packetDataField)) + return i; + } + return 0; +} + +int PacketStream::detPacketType(ByteStreamPtr prefix, ByteStreamPtr packet) +{ + /// Iterate through list and output each element. + /// The packetType 0 is the packet not recognized + for (dword i = 1; iverifyPacketValue(prefix, packet)) + return i; + } + return 0; +} + + +int PacketStream::detPacketType(ByteStreamPtr packet) +{ + /// Iterate through list and output each element. + /// The packetType 0 is the packet not recognized + for (dword i = 1; iverifyPacketValue(packet->stream)) + return i; + } + return 0; +} + + + +Packet* PacketStream::getPacket(ByteStreamPtr stream, int decodeType) throw(PacketException*){ + + int index = detPacketType(stream); + if(index > 0) { + Packet* p = getPacketType(index); + + if(!p->setPacketValue(stream, decodeType)) //gli stream diventano del packet + throw new PacketExceptionIO("it is impossible to resolve the packet."); + + return p; + + } + else + return 0; + +} + bool PacketStream::createStreamStructure() throw(PacketException*) diff --git a/src/SDFRBBlock.cpp b/src/SDFRBBlock.cpp index 6d565e6fe51b2f7f726ffd1be9e705de5e0d8627..89a8137fb7befbcf09001ffb62711adeac42167e 100644 --- a/src/SDFRBBlock.cpp +++ b/src/SDFRBBlock.cpp @@ -512,12 +512,15 @@ ByteStreamPtr SDFRBBlock::generateStream(bool bigendian) return outputstream; } -bool SDFRBBlock::setByteStream(ByteStreamPtr s, bool onlySections) +bool SDFRBBlock::setByteStream(ByteStreamPtr s, int decodeType) { //cout << "bool SDFRBBlock::setByteStream(ByteStreamPtr s)" << " " << s << endl; //AB dword bytestart=0; dword bytestop=0; this->stream->setStream(s, 0, s->getDimension() - 1); + + if(decodeType == 0) + return true; //ByteStreamPtr tmpstream = new ByteStream(s->stream, s->getDimension(), s->isBigendian()); //ByteStreamPtr s = new ByteStream(k->stream, k->getDimension(), k->isBigendian()); @@ -530,7 +533,7 @@ bool SDFRBBlock::setByteStream(ByteStreamPtr s, bool onlySections) return false; bytestart = bytestop + 1; } - if(onlySections) + if(decodeType == 1) return true; if(type->variablePresent) { @@ -547,14 +550,14 @@ bool SDFRBBlock::setByteStream(ByteStreamPtr s, bool onlySections) /// 1) first of all the fixed part of block[i] must be set /// before calling block[i].getDimension(), otherwise only random values are present tempBlock1->setStream(s, bytestart, s->getDimension() - 1); - block[i].setByteStream(tempBlock1); + block[i].setByteStream(tempBlock1, decodeType); /// 2) Now the correct computation of the dimension can be started if(bytestop != 0) bytestop += block[i].getDimension(); else bytestop += block[i].getDimension() - 1; if(tempBlock1->setStream(s, bytestart, bytestop)) - if(!block[i].setByteStream(tempBlock1)) + if(!block[i].setByteStream(tempBlock1, decodeType)) return false; bytestart = bytestop + 1; } diff --git a/src/SDFRBlock.cpp b/src/SDFRBlock.cpp index 285a1d997f2ad932db004d197cc846661a093044..4f1a35ef772937e7b18774b6a9233422f259b63d 100644 --- a/src/SDFRBlock.cpp +++ b/src/SDFRBlock.cpp @@ -122,10 +122,10 @@ ByteStreamPtr SDFRBlock::generateStream(bool bigendian) return block[0].generateStream(bigendian); } -bool SDFRBlock::setByteStream(ByteStreamPtr s, bool onlySections) +bool SDFRBlock::setByteStream(ByteStreamPtr s, int decodeType) { stream = s; - return block[0].setByteStream(s, onlySections); + return block[0].setByteStream(s, decodeType); } Field* SDFRBlock::getFields(word index)