Blame view

src/Request/ParamsRequestImpl/Nodes/Params/ParamGetDDBaseBaseParamNodeClass.php 2.08 KB
22521f1c   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

define ("PARAMGETDDBASEBASEPARAM_NAME", "baseParam");
define ("PARAMGETDDBASEBASEPARAM_NAMEATT", "name");
define ("PARAMGETDDBASEBASEPARAM_TENSORORDER", "tensor_order");
define ("PARAMGETDDBASEBASEPARAM_CALIB", "clb");
define ("PARAMGETDDBASEBASEPARAM_CALIBNAME", "name");

/**
 * @class ParamGetDDBaseBaseParamNodeClass
 * @brief Definition of a DDBase parameter
 * @details
*/
class ParamGetDDBaseBaseParamNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(PARAMGETDDBASEBASEPARAM_NAME);
	}

966bd5f8   Benjamin Renard   Add request to ge...
21
	public function setParamName($name)
22521f1c   Benjamin Renard   First commit
22
23
24
25
	{
		$this->setAttribute(PARAMGETDDBASEBASEPARAM_NAMEATT, $name);
	}

966bd5f8   Benjamin Renard   Add request to ge...
26
	public function getParamName()
22521f1c   Benjamin Renard   First commit
27
28
29
30
31
32
33
34
35
36
	{
		return $this->getAttribute(PARAMGETDDBASEBASEPARAM_NAMEATT);
	}

	public function setTensorOrder($tensor_order)
	{
		$tensorNode = $this->getChildInstanceByName(PARAMGETDDBASEBASEPARAM_TENSORORDER, true);
		$tensorNode->setValue($tensor_order);
	}

966bd5f8   Benjamin Renard   Add request to ge...
37
	public function addCalibInfo($calibInfo = "")
22521f1c   Benjamin Renard   First commit
38
39
	{
		if ($this->calibInfoExist($calibInfo))
966bd5f8   Benjamin Renard   Add request to ge...
40
			return NULL;
22521f1c   Benjamin Renard   First commit
41
42
43
44

		$node = new NodeClass(PARAMGETDDBASEBASEPARAM_CALIB);
		$node->setAttribute(PARAMGETDDBASEBASEPARAM_CALIBNAME,$calibInfo);
		$this->addChild($node);
966bd5f8   Benjamin Renard   Add request to ge...
45
46
		
		return $node;
22521f1c   Benjamin Renard   First commit
47
48
49
50
51
52
53
54
55
56
57
58
	}

	public function calibInfoExist($calibInfo)
	{
		$calibNodes = $this->getChildrenByName(PARAMGETDDBASEBASEPARAM_CALIB);

		foreach ($calibNodes as $calibNode)
		if ($calibNode->getAttribute(PARAMGETDDBASEBASEPARAM_CALIBNAME) == $calibInfo)
			return true;

		return false;
	}
966bd5f8   Benjamin Renard   Add request to ge...
59
60
61
62
63
64
65
66
67
68
69
70
71
	
	public function loadFromNode($xmlNode)
	{
		$this->setParamName($this->getXmlNodeAttribute($xmlNode, PARAMGETDDBASEBASEPARAM_NAMEATT));
		
		$tensorOrderXmlNode = $this->getXmlNodeChildByTagName($xmlNode, PARAMGETDDBASEBASEPARAM_TENSORORDER);
		if (isset($tensorOrderXmlNode))
			$this->setTensorOrder($this->getXmlNodeValue($tensorOrderXmlNode));
		
		foreach ($this->getXmlNodeChildrenByTagName($xmlNode, PARAMGETDDBASEBASEPARAM_CALIB) as $clbXmlNode) {
			$this->addCalibInfo($this->getXmlNodeAttribute($xmlNode, PARAMGETDDBASEBASEPARAM_CALIBNAME));
		}
	}
22521f1c   Benjamin Renard   First commit
72
73
74
}

?>