text: /**
  	* \file CrdWznmCmp.cpp
  	* API code for job CrdWznmCmp (implementation)
  	* \copyright (C) 2016-2020 MPSI Technologies GmbH
  	* \author Alexander Wirthmueller (auto-generation)
  	* \date created: 5 Dec 2020
  	*/
  // IP header --- ABOVE
  
  #include "CrdWznmCmp.h"
  
  using namespace std;
  using namespace Sbecore;
  using namespace Xmlio;
  
  /******************************************************************************
   class CrdWznmCmp::VecVDo
   ******************************************************************************/
  
  uint CrdWznmCmp::VecVDo::getIx(
  			const string& sref
  		) {
  	string s = StrMod::lc(sref);
  
  	if (s == "close") return CLOSE;
  	if (s == "mitappabtclick") return MITAPPABTCLICK;
  
  	return(0);
  };
  
  string CrdWznmCmp::VecVDo::getSref(
  			const uint ix
  		) {
  	if (ix == CLOSE) return("close");
  	if (ix == MITAPPABTCLICK) return("MitAppAbtClick");
  
  	return("");
  };
  
  /******************************************************************************
   class CrdWznmCmp::VecVSge
   ******************************************************************************/
  
  uint CrdWznmCmp::VecVSge::getIx(
  			const string& sref
  		) {
  	string s = StrMod::lc(sref);
  
  	if (s == "idle") return IDLE;
  	if (s == "alrwznmabt") return ALRWZNMABT;
  
  	return(0);
  };
  
  string CrdWznmCmp::VecVSge::getSref(
  			const uint ix
  		) {
  	if (ix == IDLE) return("idle");
  	if (ix == ALRWZNMABT) return("alrwznmabt");
  
  	return("");
  };
  
  /******************************************************************************
   class CrdWznmCmp::ContInf
   ******************************************************************************/
  
  CrdWznmCmp::ContInf::ContInf(
  			const uint numFSge
  			, const string& MrlAppHlp
  			, const string& MtxCrdCmp
  		) :
  			Block()
  		{
  	this->numFSge = numFSge;
  	this->MrlAppHlp = MrlAppHlp;
  	this->MtxCrdCmp = MtxCrdCmp;
  
  	mask = {NUMFSGE, MRLAPPHLP, MTXCRDCMP};
  };
  
  bool CrdWznmCmp::ContInf::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "ContInfWznmCmp");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	string itemtag = "ContitemInfWznmCmp";
  
  	if (basefound) {
  		if (extractUintAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "numFSge", numFSge)) add(NUMFSGE);
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "MrlAppHlp", MrlAppHlp)) add(MRLAPPHLP);
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "MtxCrdCmp", MtxCrdCmp)) add(MTXCRDCMP);
  	};
  
  	return basefound;
  };
  
  set<uint> CrdWznmCmp::ContInf::comm(
  			const ContInf* comp
  		) {
  	set<uint> items;
  
  	if (numFSge == comp->numFSge) insert(items, NUMFSGE);
  	if (MrlAppHlp == comp->MrlAppHlp) insert(items, MRLAPPHLP);
  	if (MtxCrdCmp == comp->MtxCrdCmp) insert(items, MTXCRDCMP);
  
  	return(items);
  };
  
  set<uint> CrdWznmCmp::ContInf::diff(
  			const ContInf* comp
  		) {
  	set<uint> commitems;
  	set<uint> diffitems;
  
  	commitems = comm(comp);
  
  	diffitems = {NUMFSGE, MRLAPPHLP, MTXCRDCMP};
  	for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
  
  	return(diffitems);
  };
  
  /******************************************************************************
   class CrdWznmCmp::StatApp
   ******************************************************************************/
  
  CrdWznmCmp::StatApp::StatApp(
  			const uint ixWznmVReqitmode
  			, const usmallint latency
  			, const string& shortMenu
  			, const uint widthMenu
  			, const bool initdoneHeadbar
  			, const bool initdoneList
  			, const bool initdoneRec
  		) :
  			Block()
  		{
  	this->ixWznmVReqitmode = ixWznmVReqitmode;
  	this->latency = latency;
  	this->shortMenu = shortMenu;
  	this->widthMenu = widthMenu;
  	this->initdoneHeadbar = initdoneHeadbar;
  	this->initdoneList = initdoneList;
  	this->initdoneRec = initdoneRec;
  
  	mask = {IXWZNMVREQITMODE, LATENCY, SHORTMENU, WIDTHMENU, INITDONEHEADBAR, INITDONELIST, INITDONEREC};
  };
  
  bool CrdWznmCmp::StatApp::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	string srefIxWznmVReqitmode;
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "StatAppWznmCmp");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	string itemtag = "StatitemAppWznmCmp";
  
  	if (basefound) {
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "srefIxWznmVReqitmode", srefIxWznmVReqitmode)) {
  			ixWznmVReqitmode = VecWznmVReqitmode::getIx(srefIxWznmVReqitmode);
  			add(IXWZNMVREQITMODE);
  		};
  		if (extractUsmallintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "latency", latency)) add(LATENCY);
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "shortMenu", shortMenu)) add(SHORTMENU);
  		if (extractUintAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "widthMenu", widthMenu)) add(WIDTHMENU);
  		if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "initdoneHeadbar", initdoneHeadbar)) add(INITDONEHEADBAR);
  		if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "initdoneList", initdoneList)) add(INITDONELIST);
  		if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "initdoneRec", initdoneRec)) add(INITDONEREC);
  	};
  
  	return basefound;
  };
  
  set<uint> CrdWznmCmp::StatApp::comm(
  			const StatApp* comp
  		) {
  	set<uint> items;
  
  	if (ixWznmVReqitmode == comp->ixWznmVReqitmode) insert(items, IXWZNMVREQITMODE);
  	if (latency == comp->latency) insert(items, LATENCY);
  	if (shortMenu == comp->shortMenu) insert(items, SHORTMENU);
  	if (widthMenu == comp->widthMenu) insert(items, WIDTHMENU);
  	if (initdoneHeadbar == comp->initdoneHeadbar) insert(items, INITDONEHEADBAR);
  	if (initdoneList == comp->initdoneList) insert(items, INITDONELIST);
  	if (initdoneRec == comp->initdoneRec) insert(items, INITDONEREC);
  
  	return(items);
  };
  
  set<uint> CrdWznmCmp::StatApp::diff(
  			const StatApp* comp
  		) {
  	set<uint> commitems;
  	set<uint> diffitems;
  
  	commitems = comm(comp);
  
  	diffitems = {IXWZNMVREQITMODE, LATENCY, SHORTMENU, WIDTHMENU, INITDONEHEADBAR, INITDONELIST, INITDONEREC};
  	for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
  
  	return(diffitems);
  };
  
  /******************************************************************************
   class CrdWznmCmp::StatShr
   ******************************************************************************/
  
  CrdWznmCmp::StatShr::StatShr(
  			const string& scrJrefHeadbar
  			, const string& scrJrefList
  			, const string& scrJrefRec
  		) :
  			Block()
  		{
  	this->scrJrefHeadbar = scrJrefHeadbar;
  	this->scrJrefList = scrJrefList;
  	this->scrJrefRec = scrJrefRec;
  
  	mask = {SCRJREFHEADBAR, SCRJREFLIST, SCRJREFREC};
  };
  
  bool CrdWznmCmp::StatShr::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "StatShrWznmCmp");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	string itemtag = "StatitemShrWznmCmp";
  
  	if (basefound) {
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "scrJrefHeadbar", scrJrefHeadbar)) add(SCRJREFHEADBAR);
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "scrJrefList", scrJrefList)) add(SCRJREFLIST);
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "scrJrefRec", scrJrefRec)) add(SCRJREFREC);
  	};
  
  	return basefound;
  };
  
  set<uint> CrdWznmCmp::StatShr::comm(
  			const StatShr* comp
  		) {
  	set<uint> items;
  
  	if (scrJrefHeadbar == comp->scrJrefHeadbar) insert(items, SCRJREFHEADBAR);
  	if (scrJrefList == comp->scrJrefList) insert(items, SCRJREFLIST);
  	if (scrJrefRec == comp->scrJrefRec) insert(items, SCRJREFREC);
  
  	return(items);
  };
  
  set<uint> CrdWznmCmp::StatShr::diff(
  			const StatShr* comp
  		) {
  	set<uint> commitems;
  	set<uint> diffitems;
  
  	commitems = comm(comp);
  
  	diffitems = {SCRJREFHEADBAR, SCRJREFLIST, SCRJREFREC};
  	for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
  
  	return(diffitems);
  };
  
  /******************************************************************************
   class CrdWznmCmp::Tag
   ******************************************************************************/
  
  CrdWznmCmp::Tag::Tag(
  			const string& MitAppAbt
  			, const string& MrlAppHlp
  		) :
  			Block()
  		{
  	this->MitAppAbt = MitAppAbt;
  	this->MrlAppHlp = MrlAppHlp;
  
  	mask = {MITAPPABT, MRLAPPHLP};
  };
  
  bool CrdWznmCmp::Tag::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "TagWznmCmp");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	string itemtag = "TagitemWznmCmp";
  
  	if (basefound) {
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "MitAppAbt", MitAppAbt)) add(MITAPPABT);
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "MrlAppHlp", MrlAppHlp)) add(MRLAPPHLP);
  	};
  
  	return basefound;
  };
  
  /******************************************************************************
   class CrdWznmCmp::DpchAppDo
   ******************************************************************************/
  
  CrdWznmCmp::DpchAppDo::DpchAppDo(
  			const string& scrJref
  			, const uint ixVDo
  			, const set<uint>& mask
  		) :
  			DpchAppWznm(VecWznmVDpch::DPCHAPPWZNMCMPDO, scrJref)
  		{
  	if (find(mask, ALL)) this->mask = {SCRJREF, IXVDO};
  	else this->mask = mask;
  
  	this->ixVDo = ixVDo;
  };
  
  string CrdWznmCmp::DpchAppDo::getSrefsMask() {
  	vector<string> ss;
  	string srefs;
  
  	if (has(SCRJREF)) ss.push_back("scrJref");
  	if (has(IXVDO)) ss.push_back("ixVDo");
  
  	StrMod::vectorToString(ss, srefs);
  
  	return(srefs);
  };
  
  void CrdWznmCmp::DpchAppDo::writeXML(
  			xmlTextWriter* wr
  		) {
  	xmlTextWriterStartElement(wr, BAD_CAST "DpchAppWznmCmpDo");
  	xmlTextWriterWriteAttribute(wr, BAD_CAST "xmlns", BAD_CAST "http://www.mpsitech.com/wznm");
  		if (has(SCRJREF)) writeString(wr, "scrJref", scrJref);
  		if (has(IXVDO)) writeString(wr, "srefIxVDo", VecVDo::getSref(ixVDo));
  	xmlTextWriterEndElement(wr);
  };
  
  /******************************************************************************
   class CrdWznmCmp::DpchEngData
   ******************************************************************************/
  
  CrdWznmCmp::DpchEngData::DpchEngData() :
  			DpchEngWznm(VecWznmVDpch::DPCHENGWZNMCMPDATA)
  		{
  	feedFSge.tag = "FeedFSge";
  };
  
  string CrdWznmCmp::DpchEngData::getSrefsMask() {
  	vector<string> ss;
  	string srefs;
  
  	if (has(SCRJREF)) ss.push_back("scrJref");
  	if (has(CONTINF)) ss.push_back("continf");
  	if (has(FEEDFSGE)) ss.push_back("feedFSge");
  	if (has(STATAPP)) ss.push_back("statapp");
  	if (has(STATSHR)) ss.push_back("statshr");
  	if (has(TAG)) ss.push_back("tag");
  
  	StrMod::vectorToString(ss, srefs);
  
  	return(srefs);
  };
  
  void CrdWznmCmp::DpchEngData::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "DpchEngWznmCmpData");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	if (basefound) {
  		if (extractStringUclc(docctx, basexpath, "scrJref", "", scrJref)) add(SCRJREF);
  		if (continf.readXML(docctx, basexpath, true)) add(CONTINF);
  		if (feedFSge.readXML(docctx, basexpath, true)) add(FEEDFSGE);
  		if (statapp.readXML(docctx, basexpath, true)) add(STATAPP);
  		if (statshr.readXML(docctx, basexpath, true)) add(STATSHR);
  		if (tag.readXML(docctx, basexpath, true)) add(TAG);
  	} else {
  		continf = ContInf();
  		feedFSge.clear();
  		statapp = StatApp();
  		statshr = StatShr();
  		tag = Tag();
  	};
  };
  