Beispiel #1
0
std::list<Breakpoint> getQualifiedInvokeBreakpoints(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string invokeId, Breakpoint breakpointTemplate) {
	std::list<Breakpoint> breakpoints;

	Breakpoint bp = breakpointTemplate; // copy base as template
	bp.subject = Breakpoint::INVOKER;
	bp.element = invokeElem;
	bp.invokeId = invokeId;

	if (HAS_ATTR(invokeElem, "type")) {
		bp.invokeType = ATTR(invokeElem, "type");
	} else if (HAS_ATTR(invokeElem, "typeexpr")) {
		bp.invokeType = interpreter.getDataModel().evalAsString(ATTR(invokeElem, "typeexpr"));
	}

	breakpoints.push_back(bp);

	return breakpoints;
}
Beispiel #2
0
void PostponeElement::Resubmitter::onStableConfiguration(Interpreter interpreter) {
	std::list<Postponed>::iterator eventIter = _postponedEvents.begin();
	bool dispatched = false;
	while(eventIter != _postponedEvents.end()) {
		try {
//      LOG(INFO) << "Reevaluating: >> " << eventIter->first << " <<";
			if ((!dispatched || eventIter->chaining) && interpreter.getDataModel().evalAsBool(eventIter->until)) {
//        LOG(INFO) << "  -> is TRUE";
				eventIter->event.name += ".postponed";
				interpreter.receive(eventIter->event, true);
				_postponedEvents.erase(eventIter++);
				dispatched = true;
			}
//      LOG(INFO) << "  -> is FALSE";
		} catch (Event e) {
			LOG(ERROR) << "Syntax error while evaluating until attribute of postpone element:" << std::endl << e << std::endl;
			_postponedEvents.erase(eventIter++);
			continue;
		}
		eventIter++;
	}
//	LOG(ERROR) << _postponedEvents.size() << " Postponess remaining";

}
Beispiel #3
0
bool Breakpoint::matches(Interpreter interpreter, const Breakpoint& other) const {
	// would we match the given breakpoint?

	if (subject != UNDEF_SUBJECT &&
			other.subject != subject)
		return false; // subject does not match
	
	if (when != UNDEF_WHEN &&
			other.when != when)
		return false; // time does not match
	
	if (action != UNDEF_ACTION &&
			other.action != action)
		return false; // action does not match

	// when we have a qualifier it has to match
	if(invokeId.length() > 0 && invokeId != other.invokeId) {
		return false;
	}

	if(invokeType.length() > 0 && invokeType != other.invokeType) {
		return false;
	}

	if(stateId.length() > 0 && stateId != other.stateId) {
		return false;
	}

	if(eventName.length() > 0 && !InterpreterImpl::nameMatch(eventName, other.eventName)) {
		return false;
	}

	if(executableName.length() > 0 && executableName != other.executableName) {
		return false;
	}

	if(executableXPath.length()) {
		Arabica::XPath::NodeSet<std::string> nodes;
		try {
			nodes = interpreter.getNodeSetForXPath(executableXPath);
		} catch (...) {
			return false;
		}
		return Interpreter::isMember(other.element, nodes);
	}

	if(transSourceId.length() > 0 && transSourceId != other.transSourceId) {
		return false;
	}

	if(transTargetId.length() > 0 && transTargetId != other.transTargetId) {
		return false;
	}
	
	if (condition.length() > 0) {
		try {
			DataModel dm = interpreter.getDataModel();
			if (!dm || !dm.evalAsBool(condition)) {
				return false;
			}
		} catch (...) {
			return false;
		}
	}

	return true;
}