14#include <QSharedPointer>
19class AbstractNodeInfo;
63 _registeredTypes[T::command()] = [](){
67 if constexpr(std::is_base_of_v<PKG::MultiversionData, T>) {
69 if (
const DistVersion &distVersion = tmp.packageVersion()) {
70 _multiVersionPackages[tmp.cmd()] = distVersion;
131 static QString pareseResultToString(
const ParserResult& parseResult);
165 template<
class PackageClass,
class HandlerType,
class HandlerMethod>
168 const QSharedPointer<QH::PKG::AbstractData> &pkg,
172 if (PackageClass::command() == pkg->cmd()) {
173 auto data = pkg.staticCast<PackageClass>();
175 if (!data->isValid()) {
179 if(!(handlerObject->*method)(data, sender, pkgHeader)) {
194 const PacksMap ®isteredTypes()
const;
204 QSharedPointer<PKG::AbstractData> genPackage(
unsigned short cmd)
const;
211 bool checkCommand(
unsigned short cmd)
const;
223 virtual void initSupportedCommands();
225 QString toString()
const override;
244 const Header *req =
nullptr)
const;
255 const Header *req =
nullptr)
const;
264 friend class BigDataParserOld;
265 friend class AbstractNodeParserOld;
The AbstractNodeInfo class contains information about client or server connection and tcp socket of n...
The AbstractNode class - Abstract implementation of node. this implementation have a methods for send...
The DistVersion class This is information of supported versions of the destinations api.
The Host Address class this is wrapper of QHostAddress. Contains the NetworkAddress and network port.
The AbstractData class is provide base functions for transport data by network For create you own pac...
The iParser class This class provide functions for parsing income packages. For yousing just override...
virtual ~iParser()=default
virtual QString parserId() const =0
parserId This is id of the parsers. All parser will be synced betwin nodes by ids.
void registerPackageType()
registerPackageType This method register package type T. This is need to prepare pacakge for parsing ...
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 ...
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::parsePac...
virtual int version() const =0
version This method return version of parser object
#define HEARTSHARED_EXPORT
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
ParserResult
The ParserResult enum. Error - parser detect a errorob package. NotProcessed - the parser does not kn...
@ NotProcessed
the parser does not know what to do with the package or has not finished processing it.
@ Error
parser detect a errorob package.
@ Processed
the parser finished processing correctly.
QHash< unsigned short, std::function< PKG::AbstractData *()> > PacksMap
PacksMap This is hash map where id is command of package and value is factory function.
QHash< unsigned short, DistVersion > PackagesVersionData
PackagesVersionData This is some as VersionData but for int commands.