ConditionTreeFactory.h
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package ArmarX::Gui::ConditionTreeFactory
17* @author Kai Welke ( welke at kit dot edu)
18* @date
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#pragma once
24
26#include <ArmarXCore/interface/observers/ConditionHandlerInterface.h>
28
29#include "TermNode.h"
30
31namespace armarx
32{
34 {
35 public:
36 static TermNodePtr
38 QTableWidget* checksTable,
39 const TermImplPtr& root,
40 int conditionId,
41 IceManagerPtr manager,
42 ConditionHandlerInterfacePrx handler)
43 {
44 // handle root node
45 std::list<TermNodePtr> nodes;
46 TermNodePtr rootNode(
47 new TermNode(scene, checksTable, root, conditionId, manager, handler));
48 nodes.push_back(rootNode);
49
50 std::list<TermNodePtr>::iterator iterNodes = nodes.begin();
51
52 while (iterNodes != nodes.end())
53 {
54 // retreive first element
55 TermNodePtr node = nodes.front();
56 nodes.pop_front();
57
58 // add childs to list
59 TermImplSequence childs = node->getImpl()->getChilds();
60 TermImplSequence::iterator iterChilds = childs.begin();
61
62 while (iterChilds != childs.end())
63 {
64 TermNodePtr childNode(new TermNode(scene,
65 checksTable,
66 TermImplPtr::dynamicCast(*iterChilds),
67 conditionId,
68 manager,
69 handler));
70 node->addChild(childNode);
71 nodes.push_back(childNode);
72
73 iterChilds++;
74 }
75
76 // next term
77 iterNodes = nodes.begin();
78 }
79
80 return rootNode;
81 }
82 };
83} // namespace armarx
#define ARMARXCOMPONENT_IMPORT_EXPORT
static TermNodePtr createConditionTree(TermTreeGraphicsScene *scene, QTableWidget *checksTable, const TermImplPtr &root, int conditionId, IceManagerPtr manager, ConditionHandlerInterfacePrx handler)
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< TermNode > TermNodePtr
Definition TermNode.h:42
IceInternal::Handle< TermImpl > TermImplPtr
Typedef of TermImplPtr as IceInternal::Handle<TermImpl> for convenience.
Definition TermImpl.h:41
IceUtil::Handle< IceManager > IceManagerPtr
IceManager smart pointer.
Definition ArmarXFwd.h:39