scenarioitem.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarXCore::core
19 * @author Cedric Seehausen (usdnr at kit dot edu)
20 * @date 2016
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25
26#pragma once
27
28#include <QVariant>
29#include <QVector>
30
32
33#include "treeitem.h"
34
35/**
36* @class ScenarioItem
37* @brief TreeItem representing data contained in a Scenario or an Application.
38*/
39
40class ScenarioItem : public TreeItem
41{
42public:
43 /**
44 * Constructor that sets the data contained in this item.
45 * @param rootData data
46 */
47 ScenarioItem(QList<QVariant> rootData);
48
49 /**
50 * Constructor that sets the scenario-data contained in this item.
51 * @param scenario Scenario to read out the data
52 */
54
55 /**
56 * Constructor that sets the application-data contained in this item.
57 * @param application Application to read out the data
58 */
60
61 ScenarioItem(std::string name,
62 std::vector<ScenarioManager::Data_Structure::ApplicationInstancePtr> applications);
63 std::string getPackageName();
64
65 /**
66 * Clears the item_data and parses the Scenario or Application for new data.
67 *
68 * Does not descend into the children: items that aggregate the status of their children (the
69 * package subtrees) expect those to have been updated already, which ScenarioModel::update()
70 * guarantees by walking the tree bottom-up.
71 *
72 * @return whether the displayed data of this item actually changed.
73 */
74 bool update();
75
76 /**
77 * If this item represents a Scenario, it is returned.
78 * @return the Scenario represented by this item
79 */
81
82 /**
83 * If this item represents an Application, it is returned.
84 * @return the Application represented by this item
85 */
88
89 /**
90 * The operation this row is currently moving towards, or Intent::None when idle.
91 *
92 * For an application this is the intent published by its ApplicationLifecycle. For a package or
93 * a scenario it is the intent shared by all of its busy children, or None if they disagree - a
94 * row only greys out a button when the whole subtree is doing that one thing.
95 */
97
98private:
99 /// The intent shared by every busy child, or None if they disagree or none of them is busy.
100 ScenarioManager::Data_Structure::Intent aggregateChildIntents();
101
104
107
108 std::string packageName;
110};
111
112Q_DECLARE_METATYPE(ScenarioItem*)
TreeItem representing data contained in a Scenario or an Application.
ScenarioManager::Data_Structure::ScenarioPtr getScenario()
If this item represents a Scenario, it is returned.
ScenarioManager::Data_Structure::ApplicationInstancePtr getApplicationInstance()
If this item represents an Application, it is returned.
std::string getPackageName()
ScenarioManager::Data_Structure::Intent getPendingIntent() const
The operation this row is currently moving towards, or Intent::None when idle.
bool update()
Clears the item_data and parses the Scenario or Application for new data.
ScenarioManager::Data_Structure::ApplicationInstanceVectorPtr getApplicationInstances()
ScenarioItem(QList< QVariant > rootData)
Constructor that sets the data contained in this item.
std::shared_ptr< Scenario > ScenarioPtr
Definition Scenario.h:35
Intent
What the ScenarioManager is currently trying to do with an application.
std::shared_ptr< ApplicationInstance > ApplicationInstancePtr
std::shared_ptr< std::vector< ApplicationInstancePtr > > ApplicationInstanceVectorPtr