Loading include/ByteStream.h +8 −4 Original line number Diff line number Diff line Loading @@ -19,10 +19,13 @@ #define _BYTESTREAM_H #include "PacketLibDefinition.h" #include "SharedPtr.h" namespace PacketLib { class ByteStream; typedef SharedPtr<ByteStream> ByteStreamPtr; /// \brief Represent a stream of byte. class ByteStream Loading @@ -45,7 +48,7 @@ public: /// passed as input. /// It's possibile to pass 0 as pointer. /// The mamory of byte* is allocated. ByteStream(ByteStream* b0, ByteStream* b1, ByteStream* b2); ByteStream(ByteStreamPtr b0, ByteStreamPtr b1, ByteStreamPtr b2); ~ByteStream(); Loading @@ -62,17 +65,17 @@ public: /// Returns a subset of the current stream. If there is problemas return NULL /// \remarks This method don't allocate a new stream structure in memory, /// but create only a new ByteStream object that points in the same memory area. ByteStream* getSubByteStream(dword first, dword last); ByteStreamPtr getSubByteStream(dword first, dword last); /// Returns a subset of the current stream. If there is problemas return NULL /// \remarks This method allocate a new stream structure in memory. ByteStream* getSubByteStreamCopy(dword first, dword last); ByteStreamPtr getSubByteStreamCopy(dword first, dword last); /// Sets the stream from arguments. bool setStream(byte* b, dword dim, bool bigendian, bool memory_sharing = true); /// Get the stream from another object of the same type. Don't allocate new memory bool setStream(ByteStream* b, dword first, dword last); bool setStream(ByteStreamPtr b, dword first, dword last); /// Copy the stream in argument of dimension dim. /// \remarks This method delete old stream and creates a new stream in memory Loading Loading @@ -157,6 +160,7 @@ private: bool mem_allocation_constructor; }; } Loading include/File.h +2 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ public: /// Reads a pair number of byte from opened file and manages the big or little endian /// format. If the format of machine is little endian, a pair of byte is swapped. /// \pre The file must be opened. virtual ByteStream* getNByte( dword N = 1 ); virtual ByteStreamPtr getNByte( dword N = 1 ); /// Get the current line. /// \pre The file must be opened. Loading Loading @@ -110,7 +110,7 @@ public: /// Writes a stream of byte into opend file. /// \pre The file must be opened in w mode bool writeByteStream(ByteStream* b) throw(PacketExceptionIO*); bool writeByteStream(ByteStreamPtr b) throw(PacketExceptionIO*); /// Count the number of string lines into a text file. long getNumberOfStringLines(); Loading include/FileStream.h +6 −6 Original line number Diff line number Diff line Loading @@ -30,11 +30,11 @@ public: FileStream(bool prefix, bool bigen, word dimprefix, long startposition = 0); ByteStream* readPrefix(); ByteStreamPtr readPrefix(); ByteStream* readHeader(unsigned int dimHeader); ByteStreamPtr readHeader(unsigned int dimHeader); ByteStream* readDataField(unsigned int dimDataField); ByteStreamPtr readDataField(unsigned int dimDataField); private: /// Indicates if it's present a prefix for each packet Loading @@ -42,11 +42,11 @@ private: /// \li false if it isn't present bool thereIsPrefix; ByteStream* header; ByteStreamPtr header; ByteStream* dataField; ByteStreamPtr dataField; ByteStream* prefix; ByteStreamPtr prefix; word dimPrefix; Loading include/Input.h +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ public: virtual bool open( char** parameters ) throw(PacketExceptionIO*) = 0; virtual ByteStream* readByteStream(dword n_byte) throw(PacketExceptionIO*) = 0; virtual ByteStreamPtr readByteStream(dword n_byte) throw(PacketExceptionIO*) = 0; virtual char* readString() throw(PacketExceptionIO*) = 0; Loading include/InputFile.h +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public: virtual void close() throw(PacketExceptionIO*); virtual ByteStream* readByteStream(dword n_byte) throw(PacketExceptionIO*); virtual ByteStreamPtr readByteStream(dword n_byte) throw(PacketExceptionIO*); virtual char* readString() throw(PacketExceptionIO*); Loading Loading
include/ByteStream.h +8 −4 Original line number Diff line number Diff line Loading @@ -19,10 +19,13 @@ #define _BYTESTREAM_H #include "PacketLibDefinition.h" #include "SharedPtr.h" namespace PacketLib { class ByteStream; typedef SharedPtr<ByteStream> ByteStreamPtr; /// \brief Represent a stream of byte. class ByteStream Loading @@ -45,7 +48,7 @@ public: /// passed as input. /// It's possibile to pass 0 as pointer. /// The mamory of byte* is allocated. ByteStream(ByteStream* b0, ByteStream* b1, ByteStream* b2); ByteStream(ByteStreamPtr b0, ByteStreamPtr b1, ByteStreamPtr b2); ~ByteStream(); Loading @@ -62,17 +65,17 @@ public: /// Returns a subset of the current stream. If there is problemas return NULL /// \remarks This method don't allocate a new stream structure in memory, /// but create only a new ByteStream object that points in the same memory area. ByteStream* getSubByteStream(dword first, dword last); ByteStreamPtr getSubByteStream(dword first, dword last); /// Returns a subset of the current stream. If there is problemas return NULL /// \remarks This method allocate a new stream structure in memory. ByteStream* getSubByteStreamCopy(dword first, dword last); ByteStreamPtr getSubByteStreamCopy(dword first, dword last); /// Sets the stream from arguments. bool setStream(byte* b, dword dim, bool bigendian, bool memory_sharing = true); /// Get the stream from another object of the same type. Don't allocate new memory bool setStream(ByteStream* b, dword first, dword last); bool setStream(ByteStreamPtr b, dword first, dword last); /// Copy the stream in argument of dimension dim. /// \remarks This method delete old stream and creates a new stream in memory Loading Loading @@ -157,6 +160,7 @@ private: bool mem_allocation_constructor; }; } Loading
include/File.h +2 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ public: /// Reads a pair number of byte from opened file and manages the big or little endian /// format. If the format of machine is little endian, a pair of byte is swapped. /// \pre The file must be opened. virtual ByteStream* getNByte( dword N = 1 ); virtual ByteStreamPtr getNByte( dword N = 1 ); /// Get the current line. /// \pre The file must be opened. Loading Loading @@ -110,7 +110,7 @@ public: /// Writes a stream of byte into opend file. /// \pre The file must be opened in w mode bool writeByteStream(ByteStream* b) throw(PacketExceptionIO*); bool writeByteStream(ByteStreamPtr b) throw(PacketExceptionIO*); /// Count the number of string lines into a text file. long getNumberOfStringLines(); Loading
include/FileStream.h +6 −6 Original line number Diff line number Diff line Loading @@ -30,11 +30,11 @@ public: FileStream(bool prefix, bool bigen, word dimprefix, long startposition = 0); ByteStream* readPrefix(); ByteStreamPtr readPrefix(); ByteStream* readHeader(unsigned int dimHeader); ByteStreamPtr readHeader(unsigned int dimHeader); ByteStream* readDataField(unsigned int dimDataField); ByteStreamPtr readDataField(unsigned int dimDataField); private: /// Indicates if it's present a prefix for each packet Loading @@ -42,11 +42,11 @@ private: /// \li false if it isn't present bool thereIsPrefix; ByteStream* header; ByteStreamPtr header; ByteStream* dataField; ByteStreamPtr dataField; ByteStream* prefix; ByteStreamPtr prefix; word dimPrefix; Loading
include/Input.h +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ public: virtual bool open( char** parameters ) throw(PacketExceptionIO*) = 0; virtual ByteStream* readByteStream(dword n_byte) throw(PacketExceptionIO*) = 0; virtual ByteStreamPtr readByteStream(dword n_byte) throw(PacketExceptionIO*) = 0; virtual char* readString() throw(PacketExceptionIO*) = 0; Loading
include/InputFile.h +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public: virtual void close() throw(PacketExceptionIO*); virtual ByteStream* readByteStream(dword n_byte) throw(PacketExceptionIO*); virtual ByteStreamPtr readByteStream(dword n_byte) throw(PacketExceptionIO*); virtual char* readString() throw(PacketExceptionIO*); Loading