String.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/String.h"
34 
35 namespace armarx::aron::data
36 {
37 
38  class String;
39  typedef std::shared_ptr<String> StringPtr;
40 
41  class String : public detail::PrimitiveVariant<data::dto::AronString, std::string, String>
42  {
43  public:
44  /* constructors */
45  String(const Path& = Path());
46  String(const data::dto::AronStringPtr&, const Path& = Path());
47  String(const std::string&, const Path& = Path());
48 
49  /* operators */
51  bool operator==(const String&) const override;
52  bool operator==(const StringPtr&) const override;
53 
54  /* static methods */
55  static StringPtr FromAronStringDTO(const data::dto::AronStringPtr& aron);
56  static data::dto::AronStringPtr ToAronStringDTO(const StringPtr& navigator);
57 
58  /* public member functions */
59  data::dto::AronStringPtr toAronStringDTO() const;
60 
61  /* virtual implementations */
62  void fromString(const std::string& setter) override;
63 
64  std::string getShortName() const override;
65  std::string getFullName() const override;
66 
67  type::VariantPtr recalculateType() const override;
68  bool fullfillsType(const type::VariantPtr&) const override;
69  };
70 } // namespace armarx::aron::data
71 
72 namespace armarx::aron
73 {
74  template <typename... _Args>
76  make_string(_Args&&... args)
77  {
78  return std::make_shared<aron::data::String>(args...);
79  }
80 } // namespace armarx::aron
armarx::aron::type::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
armarx::aron::data::String::getFullName
std::string getFullName() const override
get the full str representation of this variant
Definition: String.cpp:114
armarx::aron::make_string
aron::data::StringPtr make_string(_Args &&... args)
Definition: String.h:76
armarx::aron::data::String::toAronStringDTO
data::dto::AronStringPtr toAronStringDTO() const
Definition: String.cpp:95
armarx::aron::Path
The Path class.
Definition: Path.h:35
armarx::aron::data::String::recalculateType
type::VariantPtr recalculateType() const override
recalculate the type of a data variant. Please not tha the mapping ist NOT bijective,...
Definition: String.cpp:128
armarx::aron::data::String::fromString
void fromString(const std::string &setter) override
set a primitive from a std string
Definition: String.cpp:102
armarx::aron::data::String::getShortName
std::string getShortName() const override
get a short str representation of this variant
Definition: String.cpp:108
armarx::aron
Definition: DataDisplayVisitor.cpp:5
armarx::aron::data::String::operator==
bool operator==(const String &) const override
Definition: String.cpp:56
armarx::aron::data::String
Definition: String.h:41
armarx::aron::data::String::ToAronStringDTO
static data::dto::AronStringPtr ToAronStringDTO(const StringPtr &navigator)
Definition: String.cpp:88
armarx::aron::data
A convenience header to include all aron files (full include, not forward declared)
Definition: aron_conversions.cpp:3
armarx::aron::data::detail::PrimitiveVariant
Definition: PrimitiveVariant.h:40
armarx::aron::data::String::fullfillsType
bool fullfillsType(const type::VariantPtr &) const override
checks, if the current data variant fullfills the given type
Definition: String.cpp:120
armarx::armem::server::ltm::detail::mixin::Path
std::filesystem::path Path
Definition: DiskStorageMixin.h:17
armarx::aron::data::StringPtr
std::shared_ptr< String > StringPtr
Definition: forward_declarations.h:35
cxxopts::String
std::string String
Definition: cxxopts.hpp:192
armarx::aron::data::String::FromAronStringDTO
static StringPtr FromAronStringDTO(const data::dto::AronStringPtr &aron)
Definition: String.cpp:78
armarx::aron::data::detail::SpecializedVariantBase< data::dto::AronString, String >::aron
AronDataType::PointerType aron
Definition: SpecializedVariant.h:153
armarx::aron::data::String::String
String(const Path &=Path())
Definition: String.cpp:39