diff --git a/ChangeLog b/ChangeLog index 4e346a883bbcbd03e2299d3a61df35b0c9c86773..1d099ca6992646e8c123df6b39a69dec83ad0682 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,21 +1,34 @@ -2013-08-29 -tag v2.0.5 +2013-09-12 Andrea Bulgarelli +TAG v2.0.6 + +Bug resolved (http://redmine.iasfbo.inaf.it/issues/983): the ByteStream::stream do not contain the correct point to the stream +* src/SDFRBBlock.cpp (SDFRBBlock::setByteStream): + this->stream->setStream(s, 0, s->getDimension() - 1); +* src/PartOfPacket.cpp (PartOfPacket::setByteStream): + //this->stream = s; <- OLD + this->stream->setStream(s, 0, s->getDimension() - 1); <- NEW +* include/PartOfPacket.h (PartOfPacket): + ** new method: virtual void deleteByteStream(); + ** new method: virtual void memByteStream(ByteStream* stream); + ** stream moved into protected section +* include/SDFRBBlock.h: added deleteByteStream() and memByteStrem() +* changes on Packet.cpp, PacketNotRecognized.cpp for new methods on PartOfPacket + +2013-08-29 Andrea Bulgarelli +TAG v2.0.5 + +* include/ByteStream.h (ByteStream): void swapWordIfStreamIsBigEndian(); +* include/ByteStream.h (ByteStream): renamed swap() in swapWord() +* include/ByteStream.h (ByteStream): void swapWordIfStreamIsLittleEndian(); +* include/ByteStream.h (ByteStream): void swapWordIfStreamIsBigEndian(); + +2013-07-25 Andrea Bulgarelli +TAG v2.0.3 + +* 32 bit packet length -2013-08-29 bulgarelli - - * include/ByteStream.h (ByteStream): void swapWordIfStreamIsBigEndian(); - -2013-08-28 bulgarelli - - * include/ByteStream.h (ByteStream): renamed swap() in swapWord() - * include/ByteStream.h (ByteStream): void swapWordIfStreamIsLittleEndian(); - * include/ByteStream.h (ByteStream): void swapWordIfStreamIsBigEndian(); - -25 July 2003 -v2.0.3 on git - -+ 32 bit packet length Example of .header format + -- name of header Header CTA -- number of field with dimension of packet (or first field if dim of packet is stored in a 32 bit field) @@ -58,8 +71,8 @@ none If the field '-- 16 or 32 bit size dimension of the packet lenght' is set to 16 or it is absent, the packet lenght is 16 bit. -+ Field::value management (set predefined value=0 and during output stream generation - +* Field::value management (set predefined value=0 and during output stream generation +* Migration to git repository 15 July 2013 TAG CVS: PACKETLIB_1_4_0 diff --git a/Doxyfile b/Doxyfile index 1faec7f5dd9a6576f592e451a44db17496ce323e..d3bc5585e3809d351ae27dfbf34dee3daa5f2446 100644 --- a/Doxyfile +++ b/Doxyfile @@ -166,7 +166,7 @@ HIDE_UNDOC_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES GRAPHICAL_HIERARCHY = YES -DOT_IMAGE_FORMAT = gif +DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 diff --git a/include/PartOfPacket.h b/include/PartOfPacket.h index 2a50732256295ea797b2c5c2a4bafd64ab5107db..74a6d1e3369808c6e6da9e179b1f4e05ecc36a8f 100644 --- a/include/PartOfPacket.h +++ b/include/PartOfPacket.h @@ -245,8 +245,16 @@ public: /// Sets the stream of byte. This method assigns the value of stream for each field of part of packet virtual bool setByteStream(ByteStream* s); - /// Represent current stream reads from input. - ByteStream* stream; + /// Get the current ByteStream + virtual ByteStream* getByteStream() + { + return stream; + } + + /// Delete the current ByteStream + virtual void deleteByteStream(); + + virtual void memByteStream(ByteStream* stream); /// Represent current stream writes to output. ByteStream* outputstream; @@ -264,6 +272,9 @@ public: protected: + /// Represent current stream reads from input. + ByteStream* stream; + /// List of field of part of packet. Field** fields; diff --git a/include/SDFRBBlock.h b/include/SDFRBBlock.h index 3da9122112e0e06e8c6824736b044813fd0a4a7c..4ad25415d17908f44a2d43c18ee264f5512a77a2 100644 --- a/include/SDFRBBlock.h +++ b/include/SDFRBBlock.h @@ -86,7 +86,7 @@ public: }; -///ModelId=405AD49C00E5 +///The core of the variable packet structure class SDFRBBlock : public PartOfPacket { public: @@ -147,6 +147,11 @@ public: virtual bool setByteStream(ByteStream* s); + virtual ByteStream* getByteStream() + { + return stream; + } + /// Returns a pointer of a field in the list of fields of the fixed part. /// \param index Represent the index in the list. virtual inline Field* getFields(word index) @@ -206,7 +211,7 @@ protected: bool reset_output_stream; - ByteStream* tempBlock; + ByteStream* tempBlock1; SDFRBBlockType* type; diff --git a/src/Packet.cpp b/src/Packet.cpp index 3531e179b5c0d7cf5b50d9acb0847a22e4cb0651..1fe9cd3de6ee4997babd4903468635ea2e396c07 100644 --- a/src/Packet.cpp +++ b/src/Packet.cpp @@ -313,7 +313,7 @@ void Packet::printIdentifiers() bool Packet::setPacketValue(ByteStream* prefix, ByteStream* packetHeader, ByteStream* packetDataField) { - cout << "@ " << packetDataField->getDimension() << endl; + //cout << "@ " << packetDataField->getDimension() << endl; memByteStream(prefix, packetHeader, packetDataField); ByteStream* packet = new ByteStream(packetHeader, packetDataField, 0); memByteStream(prefix, packet); @@ -705,17 +705,16 @@ void Packet::deleteExternalByteStream() delete packet; packet = 0; } - if(dataField->stream != 0) - if(dataField->stream->getMemAllocation()) + if(dataField->getByteStream() != 0) + if(dataField->getByteStream()->getMemAllocation()) { - delete dataField->stream; - dataField->stream = 0; + dataField->deleteByteStream(); + } - if(header->stream != 0) - if(header->stream->getMemAllocation()) + if(header->getByteStream() != 0) + if(header->getByteStream()->getMemAllocation()) { - delete header->stream; - header->stream = 0; + header->deleteByteStream(); } } @@ -733,8 +732,8 @@ void Packet::memByteStream(ByteStream* prefix, ByteStream* packetHeader, ByteStr { this->prefix = prefix; //this->packet = 0; - this->header->stream = packetHeader; - this->dataField->stream = packetDataField; + this->header->memByteStream(packetHeader); + this->dataField->memByteStream(packetDataField); } @@ -749,7 +748,7 @@ ByteStream* Packet::getOutputStream() ByteStream* Packet::getInputStream() { if(packet == 0) - packet = new ByteStream(header->stream, dataField->stream, 0); + packet = new ByteStream(header->getByteStream(), dataField->getByteStream(), 0); return packet; } @@ -787,7 +786,7 @@ char** Packet::printHeaderValue() char* Packet::printHeaderStream() { - return (char*)header->stream->printStreamInHexadecimal(); + return (char*)header->getByteStream()->printStreamInHexadecimal(); } char** Packet::printDataFieldHeaderValue() @@ -797,7 +796,7 @@ char** Packet::printDataFieldHeaderValue() char* Packet::printDataFieldHeaderStream() { - return (char*)dataField->dataFieldHeader->stream->printStreamInHexadecimal(); + return (char*)dataField->dataFieldHeader->getByteStream()->printStreamInHexadecimal(); } char** Packet::printSourceDataFieldValue() @@ -821,7 +820,7 @@ char** Packet::printTailValue() char* Packet::printTailStream() { if(dataField->tail->getDimension() != 0) - return dataField->tail->stream->printStreamInHexadecimal(); + return dataField->tail->getByteStream()->printStreamInHexadecimal(); else return 0; diff --git a/src/PacketNotRecognized.cpp b/src/PacketNotRecognized.cpp index 69edb79da5b3eb9cd713e4b55d2a75886386c016..f2b01ebae3de93a7ab95be34aba0ee9a96cc56d9 100644 --- a/src/PacketNotRecognized.cpp +++ b/src/PacketNotRecognized.cpp @@ -78,7 +78,7 @@ bool PacketNotRecognized::setPacketValue(ByteStream* prefix, ByteStream* packetH if(!header->setByteStream(packetHeader)) return false; - dataField->dataFieldHeader->stream = packetDataField; + dataField->dataFieldHeader->memByteStream(packetDataField); this->prefix = prefix; diff --git a/src/PartOfPacket.cpp b/src/PartOfPacket.cpp index 323bb695e911d043e08258c47548b02f2078ac0d..19bfe1f701bde9c1aba2a5f809a57a9390613245 100644 --- a/src/PartOfPacket.cpp +++ b/src/PartOfPacket.cpp @@ -217,8 +217,9 @@ bool PartOfPacket::setByteStream(ByteStream* s) if(!s->getMemAllocation()) stream->setStream(s->stream, s->getDimension(), s->isBigendian()); - /// The stream is assigned to the header - this->stream = s; + /// The stream is assigned + //this->stream = s; + this->stream->setStream(s, 0, s->getDimension() - 1); /// The pointer is converted from byte to void. The reading from file allows the correct data interpretation /// for big or little endian machines byte* stream = (byte*) s->stream; @@ -583,3 +584,11 @@ void PartOfPacket::setFieldValue_4_13(word index, signed long value) throw(Packe setFieldValue_3_14(index, value2); } +void PacketLib::PartOfPacket::deleteByteStream() { + delete stream; + stream = 0; +} + +void PacketLib::PartOfPacket::memByteStream(ByteStream* stream) { + this->stream = stream; +} diff --git a/src/SDFRBBlock.cpp b/src/SDFRBBlock.cpp index dcd2f343fa093d6738c9eb850b8745599537fa2d..e0a45caa3b6217b4a4e6456f5e7a4629ae4f5158 100644 --- a/src/SDFRBBlock.cpp +++ b/src/SDFRBBlock.cpp @@ -36,8 +36,6 @@ bool SDFRBBlockType::loadType(InputText& fp) throw(PacketException*) char* popName = fp.getInputTextName(); try { - - int dimline = strlen(popName); name = (char*) new char[dimline+1]; strcpy(name, popName); @@ -213,7 +211,7 @@ bool SDFRBBlockType::loadType(InputText& fp) throw(PacketException*) SDFRBBlock::SDFRBBlock() { - tempBlock = new ByteStream(); + tempBlock1 = new ByteStream(); counter++; //cout << counter << " " << sizeof(SDFRBBlock) << endl; @@ -504,16 +502,19 @@ ByteStream* SDFRBBlock::generateStream(bool bigendian) bool SDFRBBlock::setByteStream(ByteStream* s) { + //cout << "bool SDFRBBlock::setByteStream(ByteStream* s)" << " " << s << endl; //AB dword bytestart=0; dword bytestop=0; - stream = s; + this->stream->setStream(s, 0, s->getDimension() - 1); + + //ByteStream* tmpstream = new ByteStream(s->stream, s->getDimension(), s->isBigendian()); //ByteStream* s = new ByteStream(k->stream, k->getDimension(), k->isBigendian()); // It sets the output stream for the fixed part (if present) if(type->fixedPresent) { bytestop += fixed.getDimension() - 1; - if(tempBlock->setStream(s, bytestart, bytestop)) - if(!fixed.setByteStream(tempBlock)) + if(tempBlock1->setStream(s, bytestart, bytestop)) + if(!fixed.setByteStream(tempBlock1)) return false; bytestart = bytestop + 1; } @@ -531,15 +532,15 @@ bool SDFRBBlock::setByteStream(ByteStream* s) /// Only for valid blocks /// 1) first of all the fixed part of block[i] must be set /// before calling block[i].getDimension(), otherwise only random values are present - tempBlock->setStream(s, bytestart, s->getDimension() - 1); - block[i].setByteStream(tempBlock); - /// 2) Now the dimension correct computation can be started + tempBlock1->setStream(s, bytestart, s->getDimension() - 1); + block[i].setByteStream(tempBlock1); + /// 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(tempBlock->setStream(s, bytestart, bytestop)) - if(!block[i].setByteStream(tempBlock)) + if(tempBlock1->setStream(s, bytestart, bytestop)) + if(!block[i].setByteStream(tempBlock1)) return false; bytestart = bytestop + 1; }