The Package struct. This is base structure for transporting data by network between QH nodes. The Package contains a 32 bytes header and Package::data array. The size on the header should be equals size of Package::data array.
More...
#include <package.h>
|
| Package () |
|
virtual | ~Package ()=default |
|
virtual bool | isValid () const |
| isValid This method validation a current package. Default implementation is checked a header and compare a size of package in header and size of source data.
|
|
virtual void | reset () |
| reset This method reset all data and set for package invalid status.
|
|
QString | toString () const |
| toString This method convert a package information to a string label.
|
|
unsigned int | calcHash () const |
| calcHash This method recalc hash sum for this pacakge.
|
|
| StreamBase () |
|
virtual | ~StreamBase () |
|
bool | fromBytes (const QByteArray &data) |
| fromBytes This method provide initialization of object from byte array.
|
|
QByteArray | toBytes () const |
| toBytes This method convert a current object to bytes array.
|
|
bool | fromBase64 (const QString &data) |
| fromBase64 This method provide initialization of object from the base64 string.
|
|
bool | fromBase64 (const QByteArray &data) |
| fromBase64 This method provide initialization of object from the base64 string.
|
|
QByteArray | toBase64 () const |
| toBase64 This method convert a current object to the base64 string.
|
|
template<class T > |
T & | copy (const StreamBase &right) |
| copy This is base copy method for all StreamBase structures. Default implementation it is copy from byteArray.
|
|
template<class T > |
bool | compare (const T &right) |
| compare This method compare array signatures of this and right objects.
|
|
|
static unsigned int | maximumSize () |
| maximumSize This method return maximu size of pacakge. If pacakge large the maximum size then package will separate to BigDataPart in sending.
|
|
|
Header | hdr |
| hdr This is header of package. For more information see the Header struct.
|
|
QByteArray | data |
| data This is source data of package.
|
|
|
QDataStream & | fromStream (QDataStream &stream) override |
| fromStream This method should be read all bytes from the stream object and full the current object.
|
|
QDataStream & | toStream (QDataStream &stream) const override |
| fromStream This method should be write all members of the current object to the stream object.
|
|
virtual int | parsingVersion () const |
| parsingVersion this method return parsing version of Qt. By Default is 0 (last available parsing). see https://doc.qt.io/qt-6/qdatastream.html#Version-enum
|
|
virtual unsigned int | typeId () const |
| typeId This method return id of type.
|
|
The Package struct. This is base structure for transporting data by network between QH nodes. The Package contains a 32 bytes header and Package::data array. The size on the header should be equals size of Package::data array.
Definition at line 23 of file package.h.
◆ Package()
◆ ~Package()
virtual QH::Package::~Package |
( |
| ) |
|
|
virtualdefault |
◆ calcHash()
unsigned int QH::Package::calcHash |
( |
| ) |
const |
calcHash This method recalc hash sum for this pacakge.
- Returns
- int32 hash of pacakge.
Definition at line 44 of file package.cpp.
◆ fromStream()
QDataStream & QH::Package::fromStream |
( |
QDataStream & |
stream | ) |
|
|
overrideprotectedvirtual |
fromStream This method should be read all bytes from the stream object and full the current object.
- Note
- The implementation of this method should be invoke a method of base class.
- Parameters
-
stream | This is Qt stream object. |
- Returns
- Qt stream object.
Examle of base simple implementation:
QDataStream &ExampleClass::fromStream(QDataStream &stream) const {
stream >> exampleMember;
return stream;
}
virtual QDataStream & toStream(QDataStream &stream) const =0
fromStream This method should be write all members of the current object to the stream object.
Implements QH::StreamBase.
Definition at line 53 of file package.cpp.
◆ isValid()
bool QH::Package::isValid |
( |
| ) |
const |
|
virtual |
isValid This method validation a current package. Default implementation is checked a header and compare a size of package in header and size of source data.
- Returns
- true if package is valid.
Definition at line 18 of file package.cpp.
◆ maximumSize()
unsigned int QH::Package::maximumSize |
( |
| ) |
|
|
static |
maximumSize This method return maximu size of pacakge. If pacakge large the maximum size then package will separate to BigDataPart in sending.
- Returns
- size in bytes of pacakge.
Definition at line 49 of file package.cpp.
◆ reset()
void QH::Package::reset |
( |
| ) |
|
|
virtual |
reset This method reset all data and set for package invalid status.
Definition at line 33 of file package.cpp.
◆ toStream()
QDataStream & QH::Package::toStream |
( |
QDataStream & |
stream | ) |
const |
|
overrideprotectedvirtual |
fromStream This method should be write all members of the current object to the stream object.
- Note
- The implementation of this method should be invoke a method of base class.
- Parameters
-
stream | This is Qt stream object. |
- Returns
- Qt stream object.
Examle of base simple implementation:
QDataStream &ExampleClass::toStream(QDataStream &stream) const {
stream << exampleMember;
return stream;
}
Implements QH::StreamBase.
Definition at line 67 of file package.cpp.
◆ toString()
QString QH::Package::toString |
( |
| ) |
const |
toString This method convert a package information to a string label.
- Returns
- string value of the package.
Definition at line 38 of file package.cpp.
◆ data
QByteArray QH::Package::data |
data This is source data of package.
Definition at line 33 of file package.h.
◆ hdr
hdr This is header of package. For more information see the Header struct.
Definition at line 29 of file package.h.
The documentation for this class was generated from the following files: