VariantReader.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 * @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 #pragma once
22 
23 // STD/STL
24 #include <memory>
25 #include <stack>
26 
27 // BaseClass
29 
30 // ArmarX
32 
33 
35 {
36  class VariantReader :
37  public ReaderInterface<const data::VariantPtr>
38  {
40 
41  public:
42  // constructors
43  VariantReader() = default;
44 
45  using Base::readList;
46  using Base::readDict;
47  using Base::readNDArray;
48  using Base::readInt;
49  using Base::readLong;
50  using Base::readFloat;
51  using Base::readDouble;
52  using Base::readString;
53  using Base::readBool;
54 
56 
57  void readList(InputType& input, std::vector<InputTypeNonConst>& elements, Path& p) final;
58  void readDict(InputType& input, std::map<std::string, InputTypeNonConst>& elements, Path& p) final;
59 
60  void readNDArray(InputType& input, std::vector<int>& shape, std::string& typeAsString, std::vector<unsigned char>& data, Path& p) final;
61 
62  void readInt(InputType& input, int& i, Path& p) final;
63  void readLong(InputType& input, long& i, Path& p) final;
64  void readFloat(InputType& input, float& i, Path& p) final;
65  void readDouble(InputType& input, double& i, Path& p) final;
66  void readString(InputType& input, std::string& s, Path& p) final;
67  void readBool(InputType& input, bool& i, Path& p) final;
68  };
69 }
Variant.h
armarx::aron::data::reader::VariantReader
Definition: VariantReader.h:36
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:36
armarx::aron::data::ReaderInterface< const data::VariantPtr >::InputType
const data::VariantPtr InputType
Definition: Reader.h:39
armarx::aron::data::ReaderInterface< const data::VariantPtr >::readDict
virtual void readDict(InputType &input, std::map< std::string, InputTypeNonConst > &elements, Path &)=0
armarx::aron::data::Descriptor
Descriptor
Definition: Descriptor.h:193
armarx::aron::data::reader::VariantReader::readList
void readList(InputType &input, std::vector< InputTypeNonConst > &elements, Path &p) final
Reader.h
armarx::aron::data::reader::VariantReader::readFloat
void readFloat(InputType &input, float &i, Path &p) final
armarx::aron::data::ReaderInterface< const data::VariantPtr >::readInt
virtual void readInt(InputType &input, int &i, Path &)=0
armarx::aron::data::reader::VariantReader::VariantReader
VariantReader()=default
armarx::aron::data::ReaderInterface< const data::VariantPtr >::readString
virtual void readString(InputType &input, std::string &s, Path &)=0
armarx::aron::Path
The Path class.
Definition: Path.h:36
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:19
armarx::aron::data::ReaderInterface< const data::VariantPtr >::readFloat
virtual void readFloat(InputType &input, float &i, Path &)=0
armarx::aron::data::reader::VariantReader::readDict
void readDict(InputType &input, std::map< std::string, InputTypeNonConst > &elements, Path &p) final
armarx::aron::data::ReaderInterface< const data::VariantPtr >::readNDArray
virtual void readNDArray(InputType &input, std::vector< int > &shape, std::string &typeAsString, std::vector< unsigned char > &data, Path &)=0
armarx::aron::data::ReaderInterface
Definition: Reader.h:36
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::aron::data::ReaderInterface< const data::VariantPtr >::readLong
virtual void readLong(InputType &input, long &i, Path &)=0
armarx::aron::data::ReaderInterface< const data::VariantPtr >::readList
virtual void readList(InputType &input, std::vector< InputTypeNonConst > &elements, Path &)=0
armarx::aron::data::ReaderInterface< const data::VariantPtr >::readDouble
virtual void readDouble(InputType &input, double &i, Path &)=0
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx::aron::data::ReaderInterface< const data::VariantPtr >::readBool
virtual void readBool(InputType &input, bool &i, Path &)=0
armarx::aron::data::reader::VariantReader::readInt
void readInt(InputType &input, int &i, Path &p) final
armarx::aron::data::reader::VariantReader::readLong
void readLong(InputType &input, long &i, Path &p) final