Int.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 
29 // Base class
30 #include "../detail/PrimitiveVariant.h"
31 
32 // ArmarX
33 #include "../../../type/variant/primitive/Int.h"
34 #include "../../../type/variant/enum/IntEnum.h"
35 
36 namespace armarx::aron::data
37 {
38 
39  class Int;
40  typedef std::shared_ptr<Int> IntPtr;
41 
42  class Int :
43  public detail::PrimitiveVariant<data::dto::AronInt, int, Int>
44  {
45  public:
46  /* constructors */
47  Int(const Path& = Path());
48  Int(const data::dto::AronIntPtr&, const Path& = Path());
49  Int(const int, const Path& = Path());
50 
51  /* operators */
53 
54  bool operator==(const Int&) const override;
55  bool operator==(const IntPtr&) const override;
56 
57  /* static methods */
58  static IntPtr FromAronIntDTO(const data::dto::AronIntPtr& aron);
59  static data::dto::AronIntPtr ToAronIntDTO(const IntPtr& navigator);
60 
61  /* public member functions */
62  data::dto::AronIntPtr toAronIntDTO() const;
63 
64  /* virtual implementations */
65  void fromString(const std::string& setter) override;
66 
67  std::string getShortName() const override;
68  std::string getFullName() const override;
69 
70  type::VariantPtr recalculateType() const override;
71  bool fullfillsType(const type::VariantPtr&) const override;
72  };
73 }
74 
75 namespace armarx::aron
76 {
77  template<typename... _Args>
78  aron::data::IntPtr make_int(_Args&&... args)
79  {
80  return std::make_shared<aron::data::Int>(args...);
81  }
82 }
armarx::aron::type::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
armarx::aron::data::Int
Definition: Int.h:42
armarx::aron::data::Int::fromString
void fromString(const std::string &setter) override
set a primitive from a std string
Definition: Int.cpp:103
armarx::aron::Path
The Path class.
Definition: Path.h:36
armarx::aron::data::Int::ToAronIntDTO
static data::dto::AronIntPtr ToAronIntDTO(const IntPtr &navigator)
Definition: Int.cpp:89
armarx::aron::data::Int::toAronIntDTO
data::dto::AronIntPtr toAronIntDTO() const
Definition: Int.cpp:96
armarx::aron
Definition: DataDisplayVisitor.cpp:5
armarx::aron::data::Int::fullfillsType
bool fullfillsType(const type::VariantPtr &) const override
checks, if the current data variant fullfills the given type
Definition: Int.cpp:121
armarx::aron::data
A convenience header to include all aron files (full include, not forward declared)
Definition: aron_conversions.cpp:3
armarx::aron::data::Int::Int
Int(const Path &=Path())
Definition: Int.cpp:40
armarx::aron::data::detail::PrimitiveVariant
Definition: PrimitiveVariant.h:40
armarx::aron::data::Int::getShortName
std::string getShortName() const override
get a short str representation of this variant
Definition: Int.cpp:109
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:916
armarx::armem::server::ltm::detail::mixin::Path
std::filesystem::path Path
Definition: DiskStorageMixin.h:17
armarx::aron::data::Int::operator==
bool operator==(const Int &) const override
Definition: Int.cpp:57
armarx::aron::data::IntPtr
std::shared_ptr< Int > IntPtr
Definition: forward_declarations.h:23
armarx::aron::data::Int::getFullName
std::string getFullName() const override
get the full str representation of this variant
Definition: Int.cpp:115
armarx::aron::data::Int::recalculateType
type::VariantPtr recalculateType() const override
recalculate the type of a data variant. Please not tha the mapping ist NOT bijective,...
Definition: Int.cpp:130
armarx::aron::make_int
aron::data::IntPtr make_int(_Args &&... args)
Definition: Int.h:78
armarx::aron::data::detail::SpecializedVariantBase< data::dto::AronInt, Int >::aron
AronDataType::PointerType aron
Definition: SpecializedVariant.h:154
armarx::aron::data::Int::FromAronIntDTO
static IntPtr FromAronIntDTO(const data::dto::AronIntPtr &aron)
Definition: Int.cpp:79