VariantReader.cpp
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 * @author Fabian Peller (fabian dot peller at kit dot edu)
17 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
18 * GNU General Public License
19 */
20 
21 // STD/STL
22 #include <memory>
23 #include <numeric>
24 
25 // Header
26 #include "VariantReader.h"
27 
28 // ArmarX
32 
34 {
35 
38  {
40  }
41 
42  void
44  std::vector<data::VariantPtr>& elements,
45  Path& p)
46  {
49  elements = o->getElements();
50  p = o->getPath();
51  }
52 
53  void
55  std::map<std::string, data::VariantPtr>& elements,
56  Path& p)
57  {
60  elements = o->getElements();
61  p = o->getPath();
62  }
63 
64  void
66  std::vector<int>& shape,
67  std::string& typeAsString,
68  std::vector<unsigned char>& data,
69  Path& p)
70  {
73  shape = o->getShape();
74  typeAsString = o->getType();
75  data = o->getDataAsVector();
76  p = o->getPath();
77  }
78 
79  void
81  {
84  i = o->getValue();
85  p = o->getPath();
86  }
87 
88  void
90  {
93  i = o->getValue();
94  p = o->getPath();
95  }
96 
97  void
99  {
102  i = o->getValue();
103  p = o->getPath();
104  }
105 
106  void
108  {
111  i = o->getValue();
112  p = o->getPath();
113  }
114 
115  void
116  VariantReader::readString(const data::VariantPtr& input, std::string& i, Path& p)
117  {
120  i = o->getValue();
121  p = o->getPath();
122  }
123 
124  void
126  {
129  i = o->getValue();
130  p = o->getPath();
131  }
132 } // namespace armarx::aron::data::reader
armarx::aron::data::reader::VariantReader::readNDArray
void readNDArray(InputType &input, std::vector< int > &shape, std::string &typeAsString, std::vector< unsigned char > &data, Path &p) final
armarx::aron::data::reader::VariantReader::getDescriptor
data::Descriptor getDescriptor(InputType &input) final
Definition: VariantReader.cpp:37
armarx::aron::data::ConstVariantVisitor::GetDescriptor
static data::Descriptor GetDescriptor(Input &n)
Definition: VariantVisitor.cpp:36
armarx::aron::data::ReaderInterface< const data::VariantPtr >::InputType
const data::VariantPtr InputType
Definition: Reader.h:39
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::aron::data::Descriptor
Descriptor
Definition: Descriptor.h:179
armarx::aron::data::reader::VariantReader::readList
void readList(InputType &input, std::vector< InputTypeNonConst > &elements, Path &p) final
armarx::aron::data::detail::SpecializedVariantBase< data::dto::List, List >::DynamicCastAndCheck
static PointerType DynamicCastAndCheck(const VariantPtr &n)
Definition: SpecializedVariant.h:134
armarx::aron::data::reader::VariantReader::readFloat
void readFloat(InputType &input, float &i, Path &p) final
armarx::aron::Path
The Path class.
Definition: Path.h:35
armarx::aron::data::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
VariantReader.h
armarx::aron::data::reader::VariantReader::readDouble
void readDouble(InputType &input, double &i, Path &p) final
armarx::aron::data::reader
Definition: NlohmannJSONReader.cpp:34
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:12
All.h
armarx::aron::data::reader::VariantReader::readDict
void readDict(InputType &input, std::map< std::string, InputTypeNonConst > &elements, Path &p) final
Exception.h
VariantVisitor.h
armarx::aron::data::reader::VariantReader::readString
void readString(InputType &input, std::string &s, Path &p) final
armarx::aron::data::reader::VariantReader::readBool
void readBool(InputType &input, bool &i, Path &p) final
armarx::armem::server::ltm::detail::mixin::Path
std::filesystem::path Path
Definition: DiskStorageMixin.h:17
armarx::aron::data::reader::VariantReader::readInt
void readInt(InputType &input, int &i, Path &p) final
armarx::aron::Path::getPath
std::vector< std::string > getPath() const
Definition: Path.cpp:87
armarx::aron::data::reader::VariantReader::readLong
void readLong(InputType &input, long &i, Path &p) final