diff --git a/PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate b/PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate index a8af2bb2537465058e10dab38452dd5647a23d0b..1e3e6102629ef05b3b5d41b0f80b0cef00d24949 100644 Binary files a/PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate and b/PacketLib.xcodeproj/project.xcworkspace/xcuserdata/bulgarelli.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/include/ByteStream.h b/include/ByteStream.h index 5d4b43615f8ca63c1cd5e83d1df68e6bb87c2b60..af2597398e32449a31c320e0504512acf1ac9ad5 100644 --- a/include/ByteStream.h +++ b/include/ByteStream.h @@ -35,20 +35,20 @@ class ByteStream public: - /// The memory of byte* is not allocated + /// The memory of byte* is not allocated. /// \param bigendian The byte alignment ByteStream(bool bigendian = false); - /// The memory of byte* is allocated + /// The memory of byte* is allocated. ByteStream(dword size, bool bigendian); - /// The memory of byte* is not allocated + /// The memory of byte* is not allocated. ByteStream(byte* stream, dword dim, bool bigendian, bool memory_sharing = true); /// Creates a new ByteStream that it is the sum of one or two or three ByteStream /// passed as input. /// It's possibile to pass 0 as pointer. - /// The mamory of byte* is allocated. + /// The memory of byte* is allocated. ByteStream(ByteStreamPtr b0, ByteStreamPtr b1, ByteStreamPtr b2); /// Creates a new ByteStream from start to end @@ -57,10 +57,25 @@ public: ~ByteStream(); + /// Get the stream of bytes byte* getStream(); + /// Gets the dimension of the stream + dword size(); + + /// Swap the stream if it is little endian (for big endian architectures, e.g. Motorola) + void swapWordIfStreamIsLittleEndian(); + + /// Swap the stream if it is big endian (for little endian architectures, e.g. Intel) + void swapWordIfStreamIsBigEndian(); + + /// Swap the stream Intel architectures + void swapWordForIntel(); + + /// Compress the stream. ByteStreamPtr compress(enum CompressionAlgorithms algorithmType, byte compressionLevel); + /// Decompress the stream. ByteStreamPtr decompress(enum CompressionAlgorithms algorithmType, byte compressionLevel, dword dmax); /// Returns a pointer of the stream for output purpose. If there is problems return NULL @@ -104,9 +119,6 @@ public: /// \param dim number of byte (1 or 2) long getValue(dword start, word dim); - /// Gets the dimension of the stream - dword size(); - char* printStreamInHexadecimal(); /// Get type of allocations. @@ -117,17 +129,6 @@ public: bool isBigendian() const; - - /// Swap the stream if it is little endian (for big endian architectures, e.g. Motorola) - void swapWordIfStreamIsLittleEndian(); - - /// Swap the stream if it is big endian (for little endian architectures, e.g. Intel) - void swapWordIfStreamIsBigEndian(); - - /// Swap the stream Intel architectures - void swapWordForIntel(); - - /// Swap the stream of words void swapWord(); diff --git a/src/PacketStream.cpp b/src/PacketStream.cpp index c45ffc01cc0d2395f95644cea142a16a4076931f..9c31980b3e9c74fca542fb9ccbe6f13e8a16aebd 100644 --- a/src/PacketStream.cpp +++ b/src/PacketStream.cpp @@ -39,6 +39,7 @@ PacketStream::PacketStream(const char* fileNameConfig) memset(packetType, 0, sizeof(Packet*)*255); pathFileNameConfig = 0; dimHeader = 0; + createStreamStructure(); }