AronTreeWidgetConverter.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 RobotAPI::gui-plugins::SkillManagerMonitorWidgetController
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 #pragma once
23 
27 
28 // forward declarations of qt
29 class QTreeWidgetItem;
30 
31 namespace armarx::skills::gui
32 {
33  // Conversion from TreeView to aron data
35  {
36  public:
37  QTreeWidgetItem* parentItem;
38  int index;
40 
42 
43  AronTreeWidgetConverterVisitor(QTreeWidgetItem* i, int x) : parentItem(i), index(x)
44  {
45  }
46 
47  // if the conversion was successful after calling visit()
49  // returns true if this type itself was sucessfully parsed, but some contained object failed.
50  // also false if there is no error
52 
53  bool hasDirectError() const;
54 
55  private:
56  bool isDirectError = false;
57  bool hasTransitiveError = false;
58  // adds all errors from other visitor to our own error collection -> collecting errors
59  // with ownFault, we also add this node to the collection
60  void handleErrors(AronTreeWidgetConverterVisitor childV, bool ownFault = false);
61  // we are the cause...
62  void handleErrors(bool ownFault = true);
63 
64  public:
65  void visitAronVariant(const aron::type::ObjectPtr&) final;
66  void visitAronVariant(const aron::type::DictPtr&) final;
67  void visitAronVariant(const aron::type::PairPtr&) final;
68  void visitAronVariant(const aron::type::TuplePtr&) final;
69  void visitAronVariant(const aron::type::ListPtr&) final;
70  void visitAronVariant(const aron::type::NDArrayPtr&) final;
71  void visitAronVariant(const aron::type::MatrixPtr&) final;
73  void visitAronVariant(const aron::type::ImagePtr&) final;
75  void visitAronVariant(const aron::type::IntEnumPtr&) final;
76  void visitAronVariant(const aron::type::IntPtr&) final;
77  void visitAronVariant(const aron::type::LongPtr&) final;
78  void visitAronVariant(const aron::type::FloatPtr&) final;
79  void visitAronVariant(const aron::type::DoublePtr&) final;
80  void visitAronVariant(const aron::type::BoolPtr&) final;
81  void visitAronVariant(const aron::type::StringPtr&) final;
82  void visitUnknown(Input&) final;
83  };
84 } // namespace armarx::skills::gui
armarx::aron::type::MatrixPtr
std::shared_ptr< class Matrix > MatrixPtr
Definition: forward_declarations.h:20
VariantVisitor.h
armarx::skills::gui::AronTreeWidgetConverterVisitor::AronTreeWidgetConverterVisitor
AronTreeWidgetConverterVisitor(QTreeWidgetItem *i, int x)
Definition: AronTreeWidgetConverter.h:43
armarx::skills::gui::AronTreeWidgetConverterVisitor::hasDirectError
bool hasDirectError() const
Definition: AronTreeWidgetConverter.cpp:57
armarx::aron::type::ImagePtr
std::shared_ptr< class Image > ImagePtr
Definition: forward_declarations.h:22
armarx::aron::type::NDArrayPtr
std::shared_ptr< class NDArray > NDArrayPtr
Definition: forward_declarations.h:19
armarx::skills::gui::AronTreeWidgetConverterVisitor
Definition: AronTreeWidgetConverter.h:34
armarx::skills::gui::AronTreeWidgetConverterVisitor::AronTreeWidgetConverterVisitor
AronTreeWidgetConverterVisitor()=delete
armarx::skills::gui::AronTreeWidgetConverterVisitor::index
int index
Definition: AronTreeWidgetConverter.h:38
All.h
armarx::aron::type::TuplePtr
std::shared_ptr< class Tuple > TuplePtr
Definition: forward_declarations.h:17
armarx::aron::type::PointCloudPtr
std::shared_ptr< class PointCloud > PointCloudPtr
Definition: forward_declarations.h:23
armarx::aron::type::FloatPtr
std::shared_ptr< class Float > FloatPtr
Definition: forward_declarations.h:29
armarx::aron::data::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
armarx::aron::type::ListPtr
std::shared_ptr< class List > ListPtr
Definition: forward_declarations.h:14
armarx::aron::type::LongPtr
std::shared_ptr< class Long > LongPtr
Definition: forward_declarations.h:28
armarx::skills::gui::AronTreeWidgetConverterVisitor::createdAron
aron::data::VariantPtr createdAron
Definition: AronTreeWidgetConverter.h:39
armarx::aron::type::StringPtr
std::shared_ptr< class String > StringPtr
Definition: forward_declarations.h:31
armarx::skills::gui::AronTreeWidgetConverterVisitor::parentItem
QTreeWidgetItem * parentItem
Definition: AronTreeWidgetConverter.h:37
armarx::skills::gui::AronTreeWidgetConverterVisitor::isConversionSuccessful
bool isConversionSuccessful()
Definition: AronTreeWidgetConverter.cpp:45
All.h
armarx::aron::type::PairPtr
std::shared_ptr< class Pair > PairPtr
Definition: forward_declarations.h:16
armarx::aron::type::DictPtr
std::shared_ptr< class Dict > DictPtr
Definition: forward_declarations.h:13
armarx::skills::gui
Definition: PeriodicUpdateWidget.cpp:11
armarx::skills::gui::AronTreeWidgetConverterVisitor::visitAronVariant
void visitAronVariant(const aron::type::ObjectPtr &) final
Definition: AronTreeWidgetConverter.cpp:86
armarx::aron::type::Visitor< const type::VariantPtr >::Input
typename VisitorBase< const type::VariantPtr >::Input Input
Definition: Visitor.h:106
armarx::aron::type::BoolPtr
std::shared_ptr< class Bool > BoolPtr
Definition: forward_declarations.h:32
armarx::skills::gui::AronTreeWidgetConverterVisitor::visitUnknown
void visitUnknown(Input &) final
Definition: AronTreeWidgetConverter.cpp:649
armarx::skills::gui::AronTreeWidgetConverterVisitor::onlyChildFailedConversion
bool onlyChildFailedConversion()
Definition: AronTreeWidgetConverter.cpp:51
armarx::aron::type::IntEnumPtr
std::shared_ptr< IntEnum > IntEnumPtr
Definition: IntEnum.h:36
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
armarx::aron::type::ConstVariantVisitor
The VariantVisitor struct.
Definition: VariantVisitor.h:38
armarx::aron::type::QuaternionPtr
std::shared_ptr< class Quaternion > QuaternionPtr
Definition: forward_declarations.h:21
armarx::aron::type::IntPtr
std::shared_ptr< class Int > IntPtr
Definition: forward_declarations.h:27
armarx::aron::type::DoublePtr
std::shared_ptr< class Double > DoublePtr
Definition: forward_declarations.h:30