#include "lfsaappl.h"
extern LArc TBL_Synch[];
class FSynch : public LFsaAppl
{
public:
double dGetData() { return pVarX->GetDataSrc(); };
LFsaAppl* Create(CVarFSA *pCVF) { Q_UNUSED(pCVF)return new FSynch(nameFsa, pCVarFsaLibrary); }
bool FCreationOfLinksForVariables();
FSynch(string strNam, CVarFsaLibrary *pCVFL): LFsaAppl(TBL_Synch, strNam, nullptr, pCVFL) { }
CVar *pVarX;
CVar *pVarStrNameX;
CVar *pVarStrNameObject;
LFsaAppl *pL {nullptr};
protected:
int x1() { return pVarX->GetDataSrc() != dSaveX; }
int x2() { return pL->FGetState() == "s1"; }
int x12() { return pL != nullptr; };
void y1() { dSaveX = pVarX->GetDataSrc(); }
void y12() { FInit(); };
double dSaveX{0};
};
#include "stdafx.h"
#include "fsynch.h"
LArc TBL_Synch[] = {
LArc("st", "st","^x12","y12"),
LArc("st", "s0","x12", "y1"),
LArc("s0", "s1","x1", "y1"),
LArc("s1", "s0","x2", "--"),
LArc()
};
bool FSynch::FCreationOfLinksForVariables() {
pVarX = CreateLocVar("x", CLocVar::vtDouble, " ");
pVarStrNameX = CreateLocVar("strNameX1", CLocVar::vtString, "name of external input variable(x1)");
pVarStrNameObject = CreateLocVar("strNameObject", CLocVar::vtString, "name of function");
string str;
if (pVarStrNameX) {
str = pVarStrNameX->strGetDataSrc();
if (str != "") { pVarX = pTAppCore->GetAddressVar(str.c_str(), this); }
}
str = pVarStrNameObject->strGetDataSrc();
if (str != "") { pL = FGetPtrFsaAppl(str); }
return true;
}
#include "lfsaappl.h"
#include "fsynch.h"
extern LArc TBL_X1X2X3[];
class FX1X2X3 : public LFsaAppl
{
public:
double dGetData() { return pVarX3->GetDataSrc(); };
LFsaAppl* Create(CVarFSA *pCVF) { Q_UNUSED(pCVF)return new FX1X2X3(nameFsa, pCVarFsaLibrary); }
bool FCreationOfLinksForVariables();
FX1X2X3(string strNam, CVarFsaLibrary *pCVFL): LFsaAppl(TBL_X1X2X3, strNam, nullptr, pCVFL) { }
CVar *pVarX1{nullptr};
CVar *pVarX2{nullptr};
CVar *pVarX3{nullptr};
CVar *pVarStrNameFX1;
CVar *pVarStrNameFX2;
CVar *pVarStrNameFPr;
CVar *pVarStrNameX3;
FSynch *pLX1 {nullptr};
FSynch *pLX2 {nullptr};
LFsaAppl *pLPr {nullptr};
protected:
int x1() { return pLX1->FGetState() == "s1"; }
int x2() { return pLX2->FGetState() == "s1"; }
int x3() { return pLPr->FGetState() == "p1"; }
int x12() { return pLPr != nullptr && pLX1 && pLX2 && pVarX3; };
void y1() { pVarX3->SetDataSrc(this, pLX1->dGetData() + pLX2->dGetData()); }
void y12() { FInit(); };
};
#include "stdafx.h"
#include "fx1x2x3.h"
LArc TBL_X1X2X3[] = {
LArc("st", "st","^x12","y12"),
LArc("st", "s0","x12", "--"),
LArc("s0", "s1","x1", "y1"),
LArc("s0", "s1","x2", "y1"),
LArc("s1", "s0","x3", "--"),
LArc()
};
bool FX1X2X3::FCreationOfLinksForVariables() {
pVarX3 = CreateLocVar("x", CLocVar::vtDouble, " ");
pVarStrNameFX1 = CreateLocVar("strNameFX1", CLocVar::vtString, "");
pVarStrNameFX2 = CreateLocVar("strNameFX2", CLocVar::vtString, "");
pVarStrNameFPr = CreateLocVar("strNameFPr", CLocVar::vtString, "");
pVarStrNameX3 = CreateLocVar("strNameX3", CLocVar::vtString, "");
string str; str = pVarStrNameFX1->strGetDataSrc();
if (str != "") { pLX1 = (FSynch*)FGetPtrFsaAppl(str); }
str = pVarStrNameFX2->strGetDataSrc();
if (str != "") { pLX2 = (FSynch*)FGetPtrFsaAppl(str); }
str = pVarStrNameFPr->strGetDataSrc();
if (str != "") { pLPr = FGetPtrFsaAppl(str); }
return true;
}
#include "lfsaappl.h"
#include "fsynch.h"
extern LArc TBL_Print[];
class FX1X2X3;
class FPrint : public LFsaAppl
{
public:
LFsaAppl* Create(CVarFSA *pCVF) { Q_UNUSED(pCVF)return new FPrint(nameFsa, pCVarFsaLibrary); }
bool FCreationOfLinksForVariables();
FPrint(string strNam, CVarFsaLibrary *pCVFL): LFsaAppl(TBL_Print, strNam, nullptr, pCVFL) { }
CVar *pVarY;
CVar *pVarStrNameFX1;
CVar *pVarStrNameFX2;
CVar *pVarStrNameFX3;
FSynch *pLX1 {nullptr};
FSynch *pLX2 {nullptr};
FX1X2X3 *pLX3 {nullptr};
protected:
int x1();
int x12() { return pLX3 != nullptr && pLX1 && pLX2 && pLX3; };
void y1();
void y12() { FInit(); };
};
#include "stdafx.h"
#include "fprint.h"
#include "fx1x2x3.h"
LArc TBL_Print[] = {
LArc("st", "st","^x12","y12"),
LArc("st", "p0","x12", "--"),
LArc("p0", "p1","x1", "y1"),
LArc("p1", "p0","--", "--"),
LArc()
};
bool FPrint::FCreationOfLinksForVariables() {
pVarY = CreateLocVar("strY", CLocVar::vtString, "print of output string");
pVarStrNameFX1 = CreateLocVar("strNameFX1", CLocVar::vtString, "name of external input object(x1)");
pVarStrNameFX2 = CreateLocVar("strNameFX2", CLocVar::vtString, "name of external input object(x2)");
pVarStrNameFX3 = CreateLocVar("strNameFX3", CLocVar::vtString, "name of external input object(pr)");
string str;
str = pVarStrNameFX1->strGetDataSrc();
if (str != "") { pLX1 = (FSynch*)FGetPtrFsaAppl(str); }
str = pVarStrNameFX2->strGetDataSrc();
if (str != "") { pLX2 = (FSynch*)FGetPtrFsaAppl(str); }
str = pVarStrNameFX3->strGetDataSrc();
if (str != "") { pLX3 = (FX1X2X3*)FGetPtrFsaAppl(str); }
return true;
}
int FPrint::x1() { return pLX3->FGetState() == "s1"; }
void FPrint::y1() {
QString strX1; strX1.setNum(pLX1->dGetData());
QString strX2; strX2.setNum(pLX2->dGetData());
QString strX3; strX3.setNum(pLX3->dGetData());
QString qstr = "X1=" + strX1 + ", X2=" + strX2 + ", X3=" + strX3;
pVarY->SetDataSrc(nullptr, qstr.toStdString(), nullptr);
}