NDArrayVariant.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5  * Karlsruhe Institute of Technology (KIT), all rights reserved.
6  *
7  * ArmarX is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * ArmarX is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * @author Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu)
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
24 #pragma once
25 
26 // STD/STL
27 #include <memory>
28 #include <string>
29 #include <unordered_map>
30 
31 // Base class
32 #include "SpecializedVariant.h"
33 
34 // ArmarX
35 
37 {
38  template <typename AronTypeT, typename DerivedT>
39  class NDArrayVariant : public SpecializedVariantBase<AronTypeT, DerivedT>
40  {
41  public:
43 
44  virtual ~NDArrayVariant() = default;
45 
46  /* virtual implementations */
48  navigateAbsolute(const Path& path) const override
49  {
51  __PRETTY_FUNCTION__,
52  "Could not navigate through a non container navigator. The input path was: " +
53  path.toString(),
55  }
56 
57  std::vector<VariantPtr>
58  getChildren() const override
59  {
60  return {};
61  }
62 
63  size_t
64  childrenSize() const override
65  {
66  return 0;
67  }
68 
69  std::string
71  {
72  return this->aron->defaultValue;
73  }
74 
75  void
76  setDefaultValue(const std::string& v)
77  {
78  this->aron->defaultValue = v;
79  }
80  };
81 } // namespace armarx::aron::type::detail
armarx::aron::error::AronException
A base class for aron exceptions.
Definition: Exception.h:42
armarx::aron::type::detail::NDArrayVariant::navigateAbsolute
VariantPtr navigateAbsolute(const Path &path) const override
naviate absolute
Definition: NDArrayVariant.h:48
armarx::aron::type::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
armarx::aron::type::detail
Definition: AnyVariant.h:36
armarx::aron::type::detail::NDArrayVariant::getChildren
std::vector< VariantPtr > getChildren() const override
get all child elements
Definition: NDArrayVariant.h:58
armarx::aron::type::detail::NDArrayVariant::~NDArrayVariant
virtual ~NDArrayVariant()=default
SpecializedVariant.h
armarx::aron::type::detail::SpecializedVariantBase
Definition: SpecializedVariant.h:40
armarx::aron::Path
The Path class.
Definition: Path.h:36
armarx::aron::type::detail::NDArrayVariant
Definition: NDArrayVariant.h:39
armarx::aron::type::detail::SpecializedVariantBase::aron
AronTypeT::PointerType aron
Definition: SpecializedVariant.h:137
armarx::aron::type::detail::NDArrayVariant::setDefaultValue
void setDefaultValue(const std::string &v)
Definition: NDArrayVariant.h:76
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
armarx::aron::type::detail::NDArrayVariant::getDefaultValue
std::string getDefaultValue() const
Definition: NDArrayVariant.h:70
armarx::aron::type::Variant::path
const Path path
Definition: Variant.h:139
armarx::aron::type::detail::NDArrayVariant::childrenSize
size_t childrenSize() const override
Definition: NDArrayVariant.h:64
armarx::aron::Path::toString
std::string toString() const
Definition: Path.cpp:125
armarx::aron::type::Variant::getPath
Path getPath() const
Definition: Variant.h:99