ParamGetConstantNodeClass.php
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
require_once "ParamGetConstantParamNodeClass.php";
define ("PARAMGETCONSTANT_VI", "constant");
/**
* @class ParamGetConstantNodeClass
* @brief Definition of a constant getter for AMDA_Kernel
* @details
*/
class ParamGetConstantNodeClass extends NodeClass
{
public function __construct()
{
parent::__construct(PARAMGETCONSTANT_VI);
}
public function getConstant($sampling = "60", $type = "int", $dim1 = "1", $dim2 = "1", $value = "1")
{
$nodes = $this->getChildrenByName(PARAMGETCONSTANTPARAM_NAME);
foreach ($nodes as $node)
if (($node->getSampling() == $sampling) && ($node->getType() == $type) && ($node->getConstValue() == $value) &&
($node->getDim1() == $dim1) && ($node->getDim2() == $dim2))
return $node;
return NULL;
}
public function addConstant($sampling = "60", $type = "int", $dim1 = "1", $dim2 = "1", $value = "1")
{
$constantNode = new ParamGetConstantParamNodeClass();
$constantNode->setSampling($sampling);
$constantNode->setType($type);
$constantNode->setDim1($dim1);
$constantNode->setDim2($dim2);
$constantNode->setConstValue($value);
$this->addChild($constantNode);
return $constantNode;
}
public function loadFromNode($xmlNode)
{
foreach ($this->getXmlNodeChildrenByTagName($xmlNode, PARAMGETCONSTANTPARAM_NAME) as $constantXmlNode) {
$this->addConstant()->loadFromNode($constantXmlNode);
}
}
}
?>