Exemple #1
0
CalcTriple prepair()
{
    static Error error;
    LPRDORuntime pRuntime = rdo::Factory<RDORuntime>::create(&error);
    BOOST_CHECK(pRuntime);

    LPRDOCalc pLeft = rdo::Factory<RDOCalcConst>::create(RDOValue(const1));
    BOOST_CHECK(pLeft);

    LPRDOCalc pRight = rdo::Factory<RDOCalcConst>::create(RDOValue(const2));
    BOOST_CHECK(pRight);

    return CalcTriple(pRuntime, pLeft, pRight);
}
void RDOPROCBlockForQueue::_onStart(const LPRDORuntime& pRuntime)
{
	int Id_res = fromParser.Id_res;
	int Id_param = fromParser.Id_param;
	LPRDOResource res = pRuntime->getResourceByID(Id_res);
	forRes.Id_param = Id_param;
	forRes.rss = res.object_static_cast<RDOPROCResource>();
	forRes.defaultValue = RDOValue(RDOPROCQueue::getDefaultValue());
}
void RDOPROCBlockForSeize::_onStart(const LPRDORuntime& pRuntime)
{
	/// @todo: если потребуется стоить деревья, вершинами которых будут полные снимки БД,
	// как при DPT search, то инициализацию атрибутов надо будет делать в checkOperation
	std::vector<parser_for_Seize>::iterator it1 = fromParser.begin();
	while (it1 != fromParser.end())
	{
		int Id_res = (*it1).Id_res;
		int Id_param = (*it1).Id_param;
		LPRDOResource res = pRuntime->getResourceByID(Id_res);
		runtime_for_Seize bbb;
		bbb.Id_param = Id_param;
		bbb.rss = res.object_static_cast<RDOPROCResource>();
		bbb.enum_free = RDOValue(bbb.rss->getParam(Id_param).getEnum(), RDOPROCBlockForSeize::getStateEnumFree());
		bbb.enum_buzy = RDOValue(bbb.rss->getParam(Id_param).getEnum(), RDOPROCBlockForSeize::getStateEnumBuzy());
		forRes.push_back(bbb);
		++it1;
	}
}
bool RDOPROCQueue::onCheckCondition(const LPRDORuntime& /*pRuntime*/)
{
	if (!m_transacts.empty())
	{
		RDOValue i = forRes.rss->getParam(forRes.Id_param);
		RDOValue j = RDOValue(int (1));
		forRes.rss->setParam(forRes.Id_param, i + j);
		return true;
	}
	else
	{
		return false;
	}
}
Exemple #5
0
// --------------------------------------------------------------------------------
// -------------------- RDOFunCalcNotExist
// --------------------------------------------------------------------------------
RDOValue RDOFunCalcNotExist::doCalc(const LPRDORuntime& pRuntime)
{
	bool res = true;
	RDORuntime::ResCIterator end = pRuntime->getResType(m_nResType)->res_end();
	for (RDORuntime::ResCIterator it = pRuntime->getResType(m_nResType)->res_begin(); it != end && res; it++)
	{
		if (*it == LPRDOResource(NULL))
			continue;

		pRuntime->pushGroupFunc(*it);
		if (m_pCondition->calcValue(pRuntime).getAsBool())
			res = false;
		pRuntime->popGroupFunc();
	}
	return RDOValue(res);
}
Exemple #6
0
RDOValue RDOFunAlgorithmicCalc::doCalc(const LPRDORuntime& pRuntime)
{
    RDOCalcList::const_iterator actionIt = m_actionList.begin();
    for (const auto& condition: m_conditionList)
    {
        if (condition->calcValue(pRuntime).getAsBool())
        {
            return (*actionIt)->calcValue(pRuntime);
        }
        ++actionIt;
    }

    // До сюда дело дойти не должно, т.к. последний conditions должен быть значением по молчанию
    pRuntime->error().push("Внутренняя ошибка, RDOFunAlgorithmicCalc", srcInfo());
    return RDOValue();
}
Exemple #7
0
// --------------------------------------------------------------------------------
// -------------------- RDOFunCalcForAll
// --------------------------------------------------------------------------------
RDOValue RDOFunCalcForAll::doCalc(const LPRDORuntime& pRuntime)
{
	bool first_found = false;
	bool res = true;
	RDORuntime::ResCIterator end = pRuntime->getResType(m_nResType)->res_end();
	for (RDORuntime::ResCIterator it = pRuntime->getResType(m_nResType)->res_begin(); it != end && res; it++)
	{
		if (*it == LPRDOResource(NULL))
			continue;

		pRuntime->pushGroupFunc(*it);
		if (!m_pCondition->calcValue(pRuntime).getAsBool())
		{
			res = false;
		}
		else if (!first_found)
		{
			first_found = true;
		}
		pRuntime->popGroupFunc();
	}
	return RDOValue(first_found ? res : false);
}
Exemple #8
0
RDOValue RDOCalcSetConst::doCalc(const LPRDORuntime& pRuntime)
{
    pRuntime->setConstValue(m_constantID, m_pCalc->calcValue(pRuntime));
    return RDOValue();
}
Exemple #9
0
void RDORuntime::pushFuncTop()
{
    m_funcStack.push_back(RDOValue(m_currFuncTop));
}