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 
32 namespace armarx
33 {
34  // Conversion from TreeView to aron data
36  {
37  public:
38  QTreeWidgetItem* parentItem;
39  int index;
41 
43  AronTreeWidgetConverterVisitor(QTreeWidgetItem* i, int x) : parentItem(i), index(x)
44  {
45  }
46  // if the conversion was successful after calling visit()
48  // returns true if this type itself was sucessfully parsed, but some contained object failed.
49  // also false if there is no error
51 
52  bool hasDirectError() const;
53 
54  private:
55  bool isDirectError = false;
56  bool hasTransitiveError = false;
57  // adds all errors from other visitor to our own error collection -> collecting errors
58  // with ownFault, we also add this node to the collection
59  void handleErrors(AronTreeWidgetConverterVisitor childV, bool ownFault = false);
60  // we are the cause...
61  void handleErrors(bool ownFault = true);
62 
63  public:
64  void visitAronVariant(const aron::type::ObjectPtr&) final;
65  void visitAronVariant(const aron::type::DictPtr&) final;
66  void visitAronVariant(const aron::type::PairPtr&) final;
67  void visitAronVariant(const aron::type::TuplePtr&) final;
68  void visitAronVariant(const aron::type::ListPtr&) final;
69  void visitAronVariant(const aron::type::NDArrayPtr&) final;
70  void visitAronVariant(const aron::type::MatrixPtr&) final;
72  void visitAronVariant(const aron::type::ImagePtr&) final;
74  void visitAronVariant(const aron::type::IntEnumPtr&) final;
75  void visitAronVariant(const aron::type::IntPtr&) final;
76  void visitAronVariant(const aron::type::LongPtr&) final;
77  void visitAronVariant(const aron::type::FloatPtr&) final;
78  void visitAronVariant(const aron::type::DoublePtr&) final;
79  void visitAronVariant(const aron::type::BoolPtr&) final;
80  void visitAronVariant(const aron::type::StringPtr&) final;
81  void visitUnknown(Input&) final;
82  };
83 } // namespace armarx
armarx::AronTreeWidgetConverterVisitor::AronTreeWidgetConverterVisitor
AronTreeWidgetConverterVisitor()=delete
armarx::aron::type::MatrixPtr
std::shared_ptr< class Matrix > MatrixPtr
Definition: forward_declarations.h:20
armarx::AronTreeWidgetConverterVisitor::isConversionSuccessful
bool isConversionSuccessful()
Definition: AronTreeWidgetConverter.cpp:45
VariantVisitor.h
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::AronTreeWidgetConverterVisitor::visitAronVariant
void visitAronVariant(const aron::type::ObjectPtr &) final
Definition: AronTreeWidgetConverter.cpp:86
armarx::AronTreeWidgetConverterVisitor::createdAron
aron::data::VariantPtr createdAron
Definition: AronTreeWidgetConverter.h:40
All.h
armarx::AronTreeWidgetConverterVisitor::parentItem
QTreeWidgetItem * parentItem
Definition: AronTreeWidgetConverter.h:38
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::aron::type::StringPtr
std::shared_ptr< class String > StringPtr
Definition: forward_declarations.h:31
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::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::AronTreeWidgetConverterVisitor::onlyChildFailedConversion
bool onlyChildFailedConversion()
Definition: AronTreeWidgetConverter.cpp:51
armarx::AronTreeWidgetConverterVisitor::index
int index
Definition: AronTreeWidgetConverter.h:39
armarx::AronTreeWidgetConverterVisitor::visitUnknown
void visitUnknown(Input &) final
Definition: AronTreeWidgetConverter.cpp:631
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
armarx::AronTreeWidgetConverterVisitor
Definition: AronTreeWidgetConverter.h:35
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::AronTreeWidgetConverterVisitor::hasDirectError
bool hasDirectError() const
Definition: AronTreeWidgetConverter.cpp:57
armarx::AronTreeWidgetConverterVisitor::AronTreeWidgetConverterVisitor
AronTreeWidgetConverterVisitor(QTreeWidgetItem *i, int x)
Definition: AronTreeWidgetConverter.h:43