diff --git a/include/ByteStream.h b/include/ByteStream.h
index 9920f83ba9fb6d5140a04e404f2759842bccafd8..02330e17d948486e5a5ddde3c6f86a65a40996a8 100644
--- a/include/ByteStream.h
+++ b/include/ByteStream.h
@@ -49,6 +49,10 @@ public:
     /// It's possibile to pass 0 as pointer.
     /// The mamory of byte* is allocated.
     ByteStream(ByteStreamPtr b0, ByteStreamPtr b1, ByteStreamPtr b2);
+	
+	/// Creates a new ByteStream from start to end
+	/// If end=-1 use the end of the b0
+    ByteStream(ByteStreamPtr b0, dword start, dword end=-1, bool memory_sharing=true);
 
     ~ByteStream();
 
diff --git a/include/Packet.h b/include/Packet.h
index 0e31e5503e3366a2c7d2fe2dea5ae1dc810cc144..10808fbdf575e4d0c5591230e90c2c9c3a2b95aa 100644
--- a/include/Packet.h
+++ b/include/Packet.h
@@ -70,14 +70,14 @@ public:
     /// \param packetHeader This is the header of the packet
     /// \param packetDataField This is the data field of the packet
     /// \post If return is true all the fields are set with the correct value.
-    virtual bool setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField);
+    virtual bool setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool onlySections = false);
 
     /// 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
     /// \post If return is true all the fields are set with the correct value.
-    virtual bool setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet);
+    virtual bool setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet, bool onlySections = false);
 
     /// Verifies if within the ByteStream passed with arguments it's present a correct packet.
     ///	\pre The structure of the stream must be loaded.
@@ -92,7 +92,7 @@ public:
 
     /// 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
-    bool setPacketValue(byte* stream);
+    bool setPacketValue(byte* stream, bool onlySections = false);
 
     /// Verifies if within the ByteStream passed with arguments it's present a correct packet.
     ///	\pre The structure of the stream must be loaded.
@@ -248,7 +248,7 @@ protected:
 
     bool setPacketValueDataFieldHeader(ByteStreamPtr packetDataField);
 
-    bool setPacketValueSourceDataField(ByteStreamPtr packetDataField);
+    bool setPacketValueSourceDataField(ByteStreamPtr packetDataField, bool onlySections = false);
 
     bool setPacketValueHeader(ByteStreamPtr header);
 
diff --git a/include/PartOfPacket.h b/include/PartOfPacket.h
index 4504664ca1e8c43cd8aa4683732938b7c89a5b3d..fcd7616e7204beb7dfc70aa4286c7c18570c702e 100644
--- a/include/PartOfPacket.h
+++ b/include/PartOfPacket.h
@@ -74,6 +74,7 @@ public:
     /// \param index Represent the index in the list.
     virtual  inline  Field* getFields(word index)
     {
+		decode();
         if(index < numberOfFields)
             return fields[index];
         else
@@ -84,6 +85,7 @@ public:
     /// \param index Represent the index in the list.
     virtual  inline word getFieldValue(word index)
     {
+		decode();
         if(index < numberOfFields)
             return fields[index]->value;
         else
@@ -305,6 +307,10 @@ public:
 
 protected:
 
+	bool decode();
+	
+	bool decoded;
+	
     /// Represent current stream reads from input.
     ByteStreamPtr stream;
 
diff --git a/include/SDFRBBlock.h b/include/SDFRBBlock.h
index 1de619e654ca1359b795dfbfef91944770e6e4f8..181c2fc6d29fdbb1e36b998ce7416e9df44023a8 100644
--- a/include/SDFRBBlock.h
+++ b/include/SDFRBBlock.h
@@ -150,7 +150,7 @@ public:
 
     virtual ByteStreamPtr generateStream(bool bigendian);
 
-    virtual bool setByteStream(ByteStreamPtr s);
+    virtual bool setByteStream(ByteStreamPtr s, bool onlySections = false);
 
     virtual ByteStreamPtr getByteStream()
     {
diff --git a/include/SDFRBlock.h b/include/SDFRBlock.h
index 994fff332ac504fcfe0a91ea280f0526eefa85ea..347b8fdc123e80b1cd8d67431663e0d0864682af 100644
--- a/include/SDFRBlock.h
+++ b/include/SDFRBlock.h
@@ -33,6 +33,8 @@ public:
     SDFRBlock(PartOfPacket* pop = 0);
 
     virtual ~SDFRBlock();
+	
+
 
     virtual bool loadFields(InputText& fp) throw(PacketException*);
 
@@ -41,7 +43,12 @@ public:
     /// \param nblock the number of the block
     /// \param rBlockIndex the number of the rblock
     virtual SDFRBBlock* getBlock(word nblock, word rBlockIndex);
-
+	
+	///Get the fixed part of the source data field
+	virtual ByteStreamPtr getFixedPart() { return block[0].fixed.getByteStream(); };
+	
+	///Get the variable part of the source data field
+	//virtual ByteStreamPtr getVariablePart();
     
     /// Returns a pointer of a field in the fixed part of this source data field.
     /// \param index Represent the index in the list.
@@ -65,8 +72,10 @@ public:
     virtual dword getMaxDimension();
 
     virtual dword getDimension();
+	
+	virtual dword getDimensionFixedPart();
 
-    virtual bool setByteStream(ByteStreamPtr s);
+    virtual bool setByteStream(ByteStreamPtr s, bool onlySections = false);
 
     virtual bool setOutputStream(ByteStreamPtr os, dword first);
 
diff --git a/include/SourceDataField.h b/include/SourceDataField.h
index 6897d37669d900d6a9225026f17fa72a478b43ab..932350215bd84d800647474ee5192dd7c581ba1d 100644
--- a/include/SourceDataField.h
+++ b/include/SourceDataField.h
@@ -32,6 +32,9 @@ public:
     SourceDataField(const char* sdfName = 0);
 
     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); };
 
     /// Gets the total max dimension in bytes of source data field
     virtual dword getMaxDimension() = 0;
diff --git a/src/ByteStream.cpp b/src/ByteStream.cpp
index 672a20852f695b8647737dae0248e0238fa034f8..f91cb332035ce0c429741e164678908e00422ec3 100644
--- a/src/ByteStream.cpp
+++ b/src/ByteStream.cpp
@@ -75,6 +75,22 @@ PacketLib::ByteStream::ByteStream(byte* stream, dword dim, bool bigendian, bool
     mem_allocation_constructor = false;
 }
 
+PacketLib::ByteStream::ByteStream(ByteStreamPtr b0, dword start, dword end, bool memory_sharing) {
+	mem_allocation_constructor = true;
+	
+	if(end == -1)
+		end = b0->getDimension();
+	
+	byteInTheStream = end-start;
+    this->stream = b0->stream+start;
+    this->bigendian = b0->isBigendian();
+    if(!memory_sharing)
+        swapWordIfStreamIsLittleEndian();
+	
+	setMemoryAllocated(!memory_sharing);
+	mem_allocation_constructor = false;
+}
+
 
 PacketLib::ByteStream::ByteStream(ByteStreamPtr b0, ByteStreamPtr b1, ByteStreamPtr b2)
 {
diff --git a/src/Packet.cpp b/src/Packet.cpp
index 53c9307237ec948b0f9253242e65f4f4ccb7c748..bff385a010f5ccb6ce5a47501ee05612900cb932 100644
--- a/src/Packet.cpp
+++ b/src/Packet.cpp
@@ -293,7 +293,7 @@ void Packet::printIdentifiers()
 }
 
 
-bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField)
+bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, bool onlySections)
 {
     //cout << "@ " << packetDataField->getDimension() << endl;
     memByteStream(prefix, packetHeader, packetDataField);
@@ -324,7 +324,7 @@ bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, By
         return false;
     }
     /// 5)
-    if(!setPacketValueSourceDataField(packetDataField))
+    if(!setPacketValueSourceDataField(packetDataField, onlySections))
     {
         PRINTERROR("Error in set packet value source data field");
         return false;
@@ -341,13 +341,13 @@ bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, By
 
 
 
-bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet)
+bool Packet::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packet, bool onlySections)
 {
     dword dimHeader = header->getDimension();
     memByteStream(prefix, packet);
     tempHeader->setStream(packet, 0, dimHeader-1);
     tempDataField->setStream(packet, dimHeader, packet->getDimension());
-    return setPacketValue(prefix, tempHeader, tempDataField);
+    return setPacketValue(prefix, tempHeader, tempDataField, onlySections);
 }
 
 
@@ -596,7 +596,7 @@ bool Packet::setPacketValueDataFieldHeader(ByteStreamPtr packetDataField)
 }
 
 
-bool Packet::setPacketValueSourceDataField(ByteStreamPtr packetDataField)
+bool Packet::setPacketValueSourceDataField(ByteStreamPtr packetDataField, bool onlySections)
 {
     bool b;
     dword packetLength;
@@ -624,7 +624,7 @@ bool Packet::setPacketValueSourceDataField(ByteStreamPtr packetDataField)
     b = tempPacketDataField->setStream(packetDataField, packetLength, packetLength+packetLength2-1);
     if(b)
     {
-        bool ret = dataField->sourceDataField->setByteStream(tempPacketDataField);
+        bool ret = dataField->sourceDataField->setByteStream(tempPacketDataField, onlySections);
         //word nrd = dataField->sourceDataField->getNumberOfRealDataBlock();
         return ret;
     }
@@ -806,10 +806,10 @@ bool Packet::verifyPacketValue(byte* stream) {
 	return verifyPacketValue(prefix, packet);
 }
 
-bool Packet::setPacketValue(byte* stream) {
+bool Packet::setPacketValue(byte* stream, bool onlySections) {
 	dword dimPre = 0;
 	if(thereisprefix)
-			dimPre += dimPrefix;
+			dimPre = dimPrefix;
 	ByteStreamPtr prefix = ByteStreamPtr(new ByteStream(stream, dimPre, bigendian));
 
 	dword dim = 0;
@@ -820,6 +820,6 @@ bool Packet::setPacketValue(byte* stream) {
 	dim += header->getPacketLength() + 1;
 	ByteStreamPtr packet = ByteStreamPtr(new ByteStream(stream+dimPre, dim, bigendian));
 
-	return setPacketValue(prefix, packet);
+	return setPacketValue(prefix, packet, onlySections);
 
 }
diff --git a/src/PartOfPacket.cpp b/src/PartOfPacket.cpp
index a2476ed7ffd2e9d208969c8702c64d92e2f546b5..e97d4a67a9eb17f9cb1f9eb081f866f79f611d25 100644
--- a/src/PartOfPacket.cpp
+++ b/src/PartOfPacket.cpp
@@ -29,6 +29,7 @@ PartOfPacket::PartOfPacket(const char* popName)
     numberOfFields = 0;
     fields = 0;
     outputstream = 0;
+	decoded = false;
     this->popName = (char*) popName;
 }
 
@@ -203,8 +204,8 @@ MemoryBuffer* PartOfPacket::loadFieldsInBuffer(InputText & fp)
 
 bool PartOfPacket::setByteStream(ByteStreamPtr s)
 {
-    Field* ftemp;
-
+    
+	decoded = false;
     /// If NULL is passed it exits
     if(s == NULL) return true;
 
@@ -217,10 +218,21 @@ bool PartOfPacket::setByteStream(ByteStreamPtr s)
 
     /// The stream is assigned
     this->stream = s;
+	
+	//decode();
+	return true;
+}
+
+bool PartOfPacket::decode() {
+	if(decoded)
+		return true;
+	Field* ftemp;
     //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;
+    byte* stream = (byte*) this->stream->stream;
+	if(stream == NULL)
+		return false;
     /// It indicates the position inside the word:
     byte posbit = 0;
     /// It indicates the word to be analyzed inside the stream
@@ -242,7 +254,7 @@ bool PartOfPacket::setByteStream(ByteStreamPtr s)
         byte bl = *(stream + posword + 1);
         //word wordtemp = *(stream + posword);
         word wordtemp;
-        if (s->isBigendian())
+        if (this->stream->isBigendian())
             wordtemp = bh * 256 + bl;
         else
             wordtemp = bl * 256 + bh;
@@ -258,7 +270,7 @@ bool PartOfPacket::setByteStream(ByteStreamPtr s)
             posword += 2;
             bh = *(stream + posword);
             bl = *(stream + posword + 1);
-            if (s->isBigendian())
+            if (this->stream->isBigendian())
                 wordtemp = bh * 256 + bl;
             else
                 wordtemp = bl * 256 + bh;
@@ -286,6 +298,7 @@ bool PartOfPacket::setByteStream(ByteStreamPtr s)
             posbit =0;
         }
     }
+	decoded = true;
     return true;
 }
 
@@ -293,6 +306,7 @@ bool PartOfPacket::setByteStream(ByteStreamPtr s)
 
 char** PartOfPacket::printValue(const char* addString)
 {
+	decode();
     //bool first = true;
     string s1, s2, s3;
     char *s = new char[1];       //importante, altrimenti non funziona
@@ -345,6 +359,7 @@ char** PartOfPacket::printValue(const char* addString)
 
 void PartOfPacket::printValueStdout()
 {
+	decode();
     //bool first = true;
     string s1, s2, s3;
     char *s = new char[1];       //importante, altrimenti non funziona
diff --git a/src/SDFRBBlock.cpp b/src/SDFRBBlock.cpp
index 64734c4ad03cf5a05ccbc1bfd5d30fc82d40ce3d..6d565e6fe51b2f7f726ffd1be9e705de5e0d8627 100644
--- a/src/SDFRBBlock.cpp
+++ b/src/SDFRBBlock.cpp
@@ -512,7 +512,7 @@ ByteStreamPtr SDFRBBlock::generateStream(bool bigendian)
     return outputstream;
 }
 
-bool SDFRBBlock::setByteStream(ByteStreamPtr s)
+bool SDFRBBlock::setByteStream(ByteStreamPtr s, bool onlySections)
 {
 	//cout << "bool SDFRBBlock::setByteStream(ByteStreamPtr s)" << " " << s << endl; //AB
     dword bytestart=0;
@@ -530,6 +530,8 @@ bool SDFRBBlock::setByteStream(ByteStreamPtr s)
                 return false;
         bytestart = bytestop + 1;
     }
+	if(onlySections)
+		return true;
     if(type->variablePresent)
     {
         word bi = 0;
diff --git a/src/SDFRBlock.cpp b/src/SDFRBlock.cpp
index f92b40d78527751cc282db66ddc94f22b9a3c331..42945884bbdc03b99c5b7a325a23675f8bf06de2 100644
--- a/src/SDFRBlock.cpp
+++ b/src/SDFRBlock.cpp
@@ -72,6 +72,17 @@ SDFRBBlock* SDFRBlock::getBlock(word nblock,word rBlockIndex)
     return block[0].getBlock(nblock, rBlockIndex);
 }
 
+/*
+ByteStreamPtr SDFRBlock::getVariablePart() {
+	ByteStreamPtr fixed = getFixedPart();
+	int fixedpartdim = fixed->getDimension();
+	int sdfdim = getDimension();
+    ByteStreamPtr sdfbs = getByteStream();
+	ByteStreamPtr camera = ByteStreamPtr(new ByteStream(sdfbs->stream+fixedpartdim, sdfdim-fixedpartdim, sdfbs->isBigendian()));
+	return camera;
+}
+*/
+
 dword SDFRBlock::getMaxDimension()
 {
     return block[0].getMaxDimension();
@@ -82,6 +93,11 @@ dword SDFRBlock::getDimension()
     return block[0].getDimension();
 }
 
+dword SDFRBlock::getDimensionFixedPart()
+{
+    return block[0].fixed.getDimension();
+}
+
 void SDFRBlock::setNumberOfRealDataBlock(word number, word rblockIndex)  throw (PacketException*)
 {
     /// The block[0] is the only block present
@@ -107,10 +123,10 @@ ByteStreamPtr SDFRBlock::generateStream(bool bigendian)
     return block[0].generateStream(bigendian);
 }
 
-bool SDFRBlock::setByteStream(ByteStreamPtr s)
+bool SDFRBlock::setByteStream(ByteStreamPtr s, bool onlySections)
 {
     stream = s;
-    return block[0].setByteStream(s);
+    return block[0].setByteStream(s, onlySections);
 }
 
 Field* SDFRBlock::getFields(word index)