Blame view

src/Request/ParamsRequestImpl/Nodes/Requests/RequestNodeClass.php 1.76 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php

define ("REQUESTPARAM_NAME", "param");
define ("REQUESTPARAM_ID", "id");

/**
 * @class RequestParamNodeClass
 * @brief Definition of a request param node for AMDA_Kernel
 * @details
*/
class RequestParamNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTPARAM_NAME);
	}

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

	public function getId()
	{
		return $this->getAttribute(REQUESTPARAM_ID);
	}
}

define ("REQUESTPARAMS_NAME", "params");

/**
 * @class RequestParamsNodeClass
 * @brief Definition of a request params node for AMDA_Kernel
 * @details
*/
class RequestParamsNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTPARAMS_NAME);
	}

	public function addParam($id)
	{
4ede4320   Benjamin Renard   Integration for s...
45
46
47
		foreach ($this->getChildrenByName(REQUESTPARAM_NAME) as $paramNode)
			if ($paramNode->getId() == $id)
				return;
22521f1c   Benjamin Renard   First commit
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
		$param = new RequestParamNodeClass();
		$param->setId($id);
		$this->addChild($param);
	}

	public function getParamList()
	{
		return $this->getChildrenByName(REQUESTPARAM_NAME);
	}
}

define ("REQUEST_NAME", "request");

/**
 * @class RequestNodeClass
 * @brief Definition of a request node for AMDA_Kernel
 * @details
*/
class RequestNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUEST_NAME);

		$this->addChild(new RequestParamsNodeClass());
		$this->addChild(new RequestTimesNodeClass());
		$this->addChild(new RequestOutputsNodeClass());
	}

	public function getParamsNode()
	{
		return $this->getFirstChildByName(REQUESTPARAMS_NAME);
	}

	public function getTimesNode()
	{
		return $this->getFirstChildByName(REQUESTTIMES_NAME);
	}

	public function getOutputsNode()
	{
		return $this->getFirstChildByName(REQUESTOUTPUTS_NAME);
	}
}

?>