ParamNodeClass.php 1.62 KB
<?php

define ("PARAM_NAME", "param");
define ("PARAM_ID", "xml:id");
define ("PARAM_SAMPLING", "time_resolution");
define ("PARAM_GAP", "gap_threshold");
define ("PARAM_GET", "get");
define ("PARAM_PROCESS", "process");
define ("PARAM_OUTPUT", "output");

abstract class ParamGetTypeEnum
{
	const AMDAPARAM   = "AmdaParam";
	const DDBASE      = "DDBase";
}

/**
 * @class ParamNodeClass
 * @brief Definition of a parameter for AMDA_Kernel
 * @details
 */
class ParamNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(PARAM_NAME);
	}

	public function setId($id)
	{
		$this->setAttribute(PARAM_ID, $id);
	}

	public function setSampling($sampling)
	{
		$node = $this->getChildInstanceByName(PARAM_SAMPLING,true);
		$node->setValue($sampling);
	}

	public function setGap($gap)
	{

		$node = $this->getChildInstanceByName(PARAM_GAP,true);
		$node->setValue($gap);
	}

	public function addParamGet($type)
	{
		$node = $this->getChildInstanceByName(PARAM_GET, true);

		switch ($type)
		{
			case ParamGetTypeEnum::AMDAPARAM :
				$paramGet = new ParamGetAmdaParamNodeClass();
				break;
			case ParamGetTypeEnum::DDBASE :
				$paramGet = new ParamGetDDBaseNodeClass();
				break;
			default :
				throw new Exception('Param get node not implemented');
		}

		$node->addChild($paramGet);

		return $paramGet;
	}

	public function setProcess($process)
	{
		$node = $this->getChildInstanceByName(PARAM_PROCESS, true);
		$node->setValue($process);
	}

	public function setOutput()
	{
		$node = $this->getChildInstanceByName(PARAM_OUTPUT, true);
	}
}

?>