ParamGetLocalBaseNodeClass.php 1.42 KB
<?php

require_once "ParamGetLocalBaseParamNodeClass.php";

define ("PARAMGETLOCALBASE_VI", "localvi");
define ("PARAMGETLOCALBASE_VIID", "id");

/**
 * @class ParamGetLocalBaseNodeClass
 * @brief Definition of a local base getter for AMDA_Kernel
 * @details
*/
class ParamGetLocalBaseNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(PARAMGETLOCALBASE_VI);
	}

	public function setVIId($id)
	{
		$this->setAttribute(PARAMGETLOCALBASE_VIID, $id);
	}

	public function getLocalParam($id)
	{
		$nodes = $this->getChildrenByName(PARAMGETLOCALBASEPARAM_NAME);
	
		foreach ($nodes as $node)
		if ($node->getId() == $id)
			return $node;
		return NULL;
	}
	
	public function addLocalParam($id = "", $minSampling = "", $maxSampling = "", $parameterType = "", $parameterSize = "")
	{
		$paramNode = new ParamGetLocalBaseParamNodeClass();
		
		$paramNode->setId($id);
		$paramNode->setMinSampling($minSampling);
		$paramNode->setMaxSampling($maxSampling);
		$paramNode->setParameterType($parameterType);
		$paramNode->setParameterSize($parameterSize);
		
		$this->addChild($paramNode);
		
		return $paramNode;
	}
	
	public function loadFromNode($xmlNode)
	{
		$this->setVIId($this->getXmlNodeAttribute($xmlNode, PARAMGETLOCALBASE_VIID));
	
		foreach ($this->getXmlNodeChildrenByTagName($xmlNode, PARAMGETLOCALBASEPARAM_NAME) as $localParamXmlNode) {
			$this->addLocalParam()->loadFromNode($localParamXmlNode);
		}
	}
}

?>