Beispiel #1
0
void Action::clearOutputAgumentValues() {
  ArgumentList *outArgList = getOutputArgumentList();
  int nArgs = outArgList->size();
  for (int n = 0; n < nArgs; n++) {
    Argument *arg = outArgList->getArgument(n);
    arg->setValue("");
  }
}
Beispiel #2
0
Argument *Action::getArgument(const std::string &name) {
  ArgumentList *argList = getArgumentList();
  int nArgs = argList->size();
  for (int n = 0; n < nArgs; n++) {
    Argument *arg = argList->getArgument(n);
    const char *argName = arg->getName();
    if (argName == NULL)
      continue;
    string argNameStr = argName;
    if (argNameStr.compare(name) == 0)
      return arg;
  }
  return NULL;
}
void PrintDeviceInfo(Device *dev, int indent)
{
	string indentStr;
	GetIndentString(indent, indentStr);
	const char *devName = dev->getFriendlyName();
	cout << indentStr << devName << endl;

	int i, n, j;
	ServiceList *serviceList = dev->getServiceList();
	int serviceCnt = serviceList->size();
	for (n=0; n<serviceCnt; n++) {
		Service *service = serviceList->getService(n);
		cout << indentStr << " service[" << n << "] = "<< service->getServiceType() << endl;
		ActionList *actionList = service->getActionList();
		int actionCnt = actionList->size();
		for (i=0; i<actionCnt; i++) {
			Action *action = actionList->getAction(i);
			cout << indentStr << "  action[" << i << "] = "<< action->getName() << endl;
			ArgumentList *argList = action->getArgumentList();
			int argCnt = argList->size();
			for (j=0; j<argCnt; j++) {
					Argument *arg = argList->getArgument(j);
					cout << indentStr << "    arg[" << j << "] = " << arg->getName() << "("  << arg->getDirection() << ")";
					StateVariable *stateVar = arg->getRelatedStateVariable();
					if (stateVar != NULL)
						cout << " - " << stateVar->getName();
					cout << endl;
			}
		}
		ServiceStateTable *stateTable = service->getServiceStateTable();
		int varCnt = stateTable->size();
		for (i=0; i<varCnt; i++) {
			StateVariable *stateVar = stateTable->getStateVariable(i);
			cout << indentStr << "  stateVar[" << i << "] = " << stateVar->getName() << endl;
			AllowedValueList *valueList = stateVar->getAllowedValueList();
			int valueListCnt = valueList->size();
			if (0 < valueListCnt) {
				for (j=0; j<valueListCnt; j++)
					cout << indentStr << "    AllowedValueList[" << j << "] = " << valueList->getAllowedValue(j) << endl;
			}
			AllowedValueRange *valueRange = stateVar->getAllowedValueRange();
			if (valueRange != NULL) {
					cout << indentStr << "    AllowedRange[minimum] = " << valueRange->getMinimum() << endl;
					cout << indentStr << "    AllowedRange[maximum] = " << valueRange->getMaximum() << endl;
					cout << indentStr << "    AllowedRange[step] = " << valueRange->getStep() << endl;
			}
		}
	}
}