Commit 63a0f977 authored by Andrea Bulgarelli's avatar Andrea Bulgarelli
Browse files

Packet::encode()

parent 7d6f604e
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -107,10 +107,6 @@ public:
	///Get the tail as a ByteStream
	ByteStreamPtr getBSTail();
	
	///Copy an array of bytes into the source data field. The size must be the same.
	///It is necessary to set the number of blocks of each rblocks before.
	void copyBSSourceDataField(byte* bytestream, dword size);

	///
	PacketHeader* getPacketHeader();
	
@@ -142,10 +138,13 @@ public:
    ByteStreamPtr getInputStream();

    
    /// Gets the encoded method. The output
    /// packet is generated during this call.
    ByteStreamPtr encode();
    /// Encode the packet before write. The output packet is generated during this call.
	/// \param sourceDataVariable Is a ByteStream that is copied in the source data field fixed part
	/// \return the encoded stream
    ByteStreamPtr encode(ByteStreamPtr sourceDataVariable = 0);

	/// Get the ByteStream of the encoded/compressed packet
    ByteStreamPtr getOutputStream();
	
    /// Gets the name of packet.
    virtual char* getName()
@@ -183,8 +182,6 @@ public:
		return iscompressed;
	}
	
	
	
    /// Prints to stdout the value of packet data field in a formatted mode.
    virtual void printPacketValue();
	
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#define DEBUGMODE 0
#define ERRORMODE 1
#define EXCEPTION_ENABLED 1
#define PACKETNOTRECOGNIZED 0
/// define NULL 0

#define ARCH_BIGENDIAN 0
+6 −2
Original line number Diff line number Diff line
@@ -119,12 +119,12 @@ public:
    /// determinated type is repeated) for each type of rblock present.
    /// \param number The number of blocks
    /// \param rBlockIndex The number of rblock
    virtual void setNumberOfRealDataBlock(word number, word rblockIndex = 0) throw (PacketException*);
    virtual void setNumberOfBlocks(word number, word rblockIndex = 0) throw (PacketException*);

    /// Get the number of blocks (the number of times that a block of a
    /// determinate type is repeated) for each type of rblock present.
    /// \param rBlockIndex The number of rblock
    virtual word getNumberOfRealDataBlock(word rblockIndex = 0);
    virtual word getNumberOfBlocks(word rblockIndex = 0);

    virtual void setRBlockType(word rb)
    {
@@ -164,6 +164,10 @@ public:
        return fixed.getFields(index);
    };
	
	virtual word getFieldIndex(string fieldname) {
		return fixed.getFieldIndex(fieldname);
	}

    /// Returns the value of a field in the list of fields of the fixed part.
	/// See ParfOfPacket doc for more details
    /// \param index Represent the index in the list.
+5 −3
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public:
    /// with the index rBlockIndex.
    /// \param nblock the number of the block
    /// \param rBlockIndex the number of the rblock
    virtual SDFBlock* getBlock(word nblock, word rBlockIndex);
    virtual SDFBlock* getBlock(word nblock, word rBlockIndex=0);
	
	///Get the fixed part of the source data field
	virtual ByteStreamPtr getFixedPart() { return block[0].fixed.getByteStream(); };
@@ -51,6 +51,8 @@ public:
    /// \param index Represent the index in the list.
    virtual Field* getFields(word index);
	
	virtual word getFieldIndex(string fieldname);

    /// Returns the value of a field in the fixed part of this source data field.
	/// See PartOfPacket for documentation
    /// \param index Represent the index in the list.
@@ -231,13 +233,13 @@ public:
    /// determinated type is repeated) for each type of rblock present.
    /// \param number The number of blocks
    /// \param rBlockIndex The number of rblock
    void setNumberOfRealDataBlock(word number, word rblockIndex = 0) throw (PacketException*);
    void setNumberOfBlocks(word number, word rblockIndex = 0) throw (PacketException*);

    
    /// Get the number of blocks (the number of times that a block of a
    /// determinated type is repeated) for each type of rblock present.
    /// \param rBlockIndex The number of rblock
    word getNumberOfRealDataBlock(word rblockIndex = 0);
    word getNumberOfBlocks(word rblockIndex = 0);

    
    /// Prints the value of each field of this part of packet
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ Field::Field(char* n, char* dim, char* prVal, int count) : progressiv(count)
        {
            type->thereIsPredefinedValue = true;
            type->predefinedValue = Utility::convertToInteger(prVal);
			value = type->predefinedValue; //AB
        }
        else
        {
Loading