![]() |
Heart 1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
|
The iParser class This class provide functions for parsing income packages. For yousing just override the iParser::parsePackage method. More...
#include <iparser.h>


Public Member Functions | |
| iParser (AbstractNode *parentNode) | |
| virtual | ~iParser ()=default |
| template<class T> | |
| void | registerPackageType () |
| registerPackageType This method register package type T. This is need to prepare pacakge for parsing in the parsePackage method. | |
| virtual ParserResult | parsePackage (const QSharedPointer< PKG::AbstractData > &pkg, const Header &pkgHeader, AbstractNodeInfo *sender)=0 |
| parsePackage This is main method of all childs classes of an AbstractNode class. This method work on own thread. If you ovveride this method you need to create this than an example: | |
| virtual int | version () const =0 |
| version This method return version of parser object | |
| template<class PackageClass, class HandlerType, class HandlerMethod> | |
| ParserResult | commandHandler (HandlerType handlerObject, HandlerMethod method, const QSharedPointer< QH::PKG::AbstractData > &pkg, QH::AbstractNodeInfo *sender, const QH::Header &pkgHeader) |
| commandHandler This method it is simple wrapper for the handle pacakges in the AbstractNode::parsePackage method. Exmaple of use : | |
| const PacksMap & | registeredTypes () const |
| registeredTypes This method return list of registered command. | |
| QSharedPointer< PKG::AbstractData > | genPackage (unsigned short cmd) const |
| genPackage This is factory method that generate data pacakge objects by command. All object should be registered before using this method. | |
| bool | checkCommand (unsigned short cmd) const |
| checkCommand This method check command are if registered type or not. | |
| virtual QString | parserId () const =0 |
| parserId This is id of the parsers. All parser will be synced betwin nodes by ids. | |
| virtual void | initSupportedCommands () |
| initSupportedCommands This method will be invoked before add a parser into parser's storage. Use this method to register your command for this parser object. By default, this method does nothing, You still can register your command in the class constructor. But if you use inheritance between your APIs versions to you must use this method, because your constructors both all your commands, this broken API selector of your node. | |
| QString | toString () const override |
| const PackagesVersionData & | multiVersionPackages () const |
| multiVersionPackages return list of the supported multiversions packages. | |
Static Public Member Functions | |
| static QString | pareseResultToString (const ParserResult &parseResult) |
| pareseResultToString This method convert ParserResult value to string. | |
Protected Member Functions | |
| AbstractNode * | node () const |
| virtual unsigned int | sendData (const PKG::AbstractData *resp, const HostAddress &address, const Header *req=nullptr) const |
| sendData This method send data object another to node | |
| virtual unsigned int | sendData (const PKG::AbstractData *resp, const AbstractNodeInfo *node, const Header *req=nullptr) const |
| sendData This method send data object another to node | |
Friends | |
| class | BigDataParserOld |
| class | AbstractNodeParserOld |
| class | AbstractNode |
The iParser class This class provide functions for parsing income packages. For yousing just override the iParser::parsePackage method.
| QH::iParser::iParser | ( | AbstractNode * | parentNode | ) |
Definition at line 17 of file iparser.cpp.


|
virtualdefault |
| bool QH::iParser::checkCommand | ( | unsigned short | cmd | ) | const |
checkCommand This method check command are if registered type or not.
cmd This is command of a verifiable package.
Definition at line 42 of file iparser.cpp.
|
inline |
commandHandler This method it is simple wrapper for the handle pacakges in the AbstractNode::parsePackage method. Exmaple of use :
| PackageClass | This is class name that you want handle. All classes mist be inhert of the QH::PKG::AbstractData class. |
| HandlerType | This is type of the handler object that will invoke HandlerMethod method. |
| HandlerMethod | This is name of the handler method. The handler method should be support next signature: bool Method(const QSharedPointer<QH::PKG::PackageClass> &, const QH::Header &pkgHeader, const QH::AbstractNodeInfo *sender). |
| handlerObject | This is pointer to handler object. |
| method | This is handler method. |
| pkg | This is package data from the AbstractNode::parsePackage argumetns |
| pkgHeader | This is header of an incomming package. |
| sender | This is socket object of a sender that send this package. |
Definition at line 167 of file iparser.h.

| QSharedPointer< PKG::AbstractData > QH::iParser::genPackage | ( | unsigned short | cmd | ) | const |
genPackage This is factory method that generate data pacakge objects by command. All object should be registered before using this method.
| cmd | This is command of pacakge see Header::command. |
Definition at line 38 of file iparser.cpp.

|
virtual |
initSupportedCommands This method will be invoked before add a parser into parser's storage. Use this method to register your command for this parser object. By default, this method does nothing, You still can register your command in the class constructor. But if you use inheritance between your APIs versions to you must use this method, because your constructors both all your commands, this broken API selector of your node.
Definition at line 66 of file iparser.cpp.

| const PackagesVersionData & QH::iParser::multiVersionPackages | ( | ) | const |
multiVersionPackages return list of the supported multiversions packages.
Definition at line 62 of file iparser.cpp.

|
protected |
Definition at line 46 of file iparser.cpp.


|
static |
pareseResultToString This method convert ParserResult value to string.
Definition at line 22 of file iparser.cpp.

|
pure virtual |
parsePackage This is main method of all childs classes of an AbstractNode class. This method work on own thread. If you ovveride this method you need to create this than an example:
| pkg | This is package with incomming data. |
| sender | This is sender this pacakge. |
| pkgHeader | This is header of the incoming packet is used to create a response. |
Implemented in QH::AbstractNodeParser, QH::APIVersionParser, and QH::BigDataParser.

|
pure virtual |
parserId This is id of the parsers. All parser will be synced betwin nodes by ids.
Implemented in QH::AbstractNodeParser, QH::APIVersionParser, and QH::BigDataParser.


| const PacksMap & QH::iParser::registeredTypes | ( | ) | const |
registeredTypes This method return list of registered command.
Definition at line 34 of file iparser.cpp.
|
inline |
registerPackageType This method register package type T. This is need to prepare pacakge for parsing in the parsePackage method.
Definition at line 62 of file iparser.h.

|
protectedvirtual |
sendData This method send data object another to node
| resp | This is pointer to sendet object. |
| address | This is target addres for sending. |
| req | This is header of request. |
Definition at line 56 of file iparser.cpp.

|
protectedvirtual |
sendData This method send data object another to node
| resp | This is pointer to sendet object. |
| address | This is target addres for sending. |
| req | This is header of request. |
Definition at line 50 of file iparser.cpp.


|
override |
Definition at line 68 of file iparser.cpp.


|
pure virtual |
version This method return version of parser object
Implemented in QH::AbstractNodeParser, QH::APIVersionParser, and QH::BigDataParser.