NlohmannJSONReader.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 // Simox
28 #include <SimoxUtility/json.h>
29 
30 // BaseClass
32 
34 {
36  public ReaderInterface<const nlohmann::json>
37  {
39 
40  public:
41  // constructors
42  NlohmannJSONReader() = default;
43 
45 
46  using Base::readList;
47  using Base::readDict;
48  using Base::readNDArray;
49  using Base::readInt;
50  using Base::readLong;
51  using Base::readFloat;
52  using Base::readDouble;
53  using Base::readString;
54  using Base::readBool;
55 
56  void readList(InputType& input, std::vector<InputTypeNonConst>& elements, Path& p) override;
57  void readDict(InputType& input, std::map<std::string, InputTypeNonConst>& elements, Path& p) override;
58 
59  void readNDArray(InputType& input, std::vector<int>& shape, std::string& typeAsString, std::vector<unsigned char>& data, Path& p) override;
60 
61  void readInt(InputType& input, int& i, Path& p) override;
62  void readLong(InputType& input, long& i, Path& p) override;
63  void readFloat(InputType& input, float& i, Path& p) override;
64  void readDouble(InputType& input, double& i, Path& p) override;
65  void readString(InputType& input, std::string& s, Path& p) override;
66  void readBool(InputType& input, bool& i, Path& p) override;
67  };
68 }
armarx::aron::data::reader::NlohmannJSONReader::readString
void readString(InputType &input, std::string &s, Path &p) override
armarx::aron::data::reader::NlohmannJSONReader
Definition: NlohmannJSONReader.h:35
armarx::aron::data::reader::NlohmannJSONReader::readFloat
void readFloat(InputType &input, float &i, Path &p) override
armarx::aron::data::reader::NlohmannJSONReader::readDict
void readDict(InputType &input, std::map< std::string, InputTypeNonConst > &elements, Path &p) override
armarx::aron::data::ReaderInterface< const nlohmann::json >::InputType
const nlohmann::json InputType
Definition: Reader.h:39
armarx::aron::data::ReaderInterface< const nlohmann::json >::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::NlohmannJSONReader::getDescriptor
data::Descriptor getDescriptor(InputType &input) final
Definition: NlohmannJSONReader.cpp:53
Reader.h
armarx::aron::data::ReaderInterface< const nlohmann::json >::readInt
virtual void readInt(InputType &input, int &i, Path &)=0
armarx::aron::data::ReaderInterface< const nlohmann::json >::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
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::reader::NlohmannJSONReader::NlohmannJSONReader
NlohmannJSONReader()=default
armarx::aron::data::reader::NlohmannJSONReader::readNDArray
void readNDArray(InputType &input, std::vector< int > &shape, std::string &typeAsString, std::vector< unsigned char > &data, Path &p) override
armarx::aron::data::ReaderInterface< const nlohmann::json >::readFloat
virtual void readFloat(InputType &input, float &i, Path &)=0
armarx::aron::data::reader::NlohmannJSONReader::readLong
void readLong(InputType &input, long &i, Path &p) override
armarx::aron::data::reader::NlohmannJSONReader::readDouble
void readDouble(InputType &input, double &i, Path &p) override
armarx::aron::data::reader::NlohmannJSONReader::readBool
void readBool(InputType &input, bool &i, Path &p) override
armarx::aron::data::reader::NlohmannJSONReader::readInt
void readInt(InputType &input, int &i, Path &p) override
armarx::aron::data::ReaderInterface< const nlohmann::json >::readNDArray
virtual void readNDArray(InputType &input, std::vector< int > &shape, std::string &typeAsString, std::vector< unsigned char > &data, Path &)=0
armarx::aron::data::reader::NlohmannJSONReader::readList
void readList(InputType &input, std::vector< InputTypeNonConst > &elements, Path &p) override
armarx::aron::data::ReaderInterface
Definition: Reader.h:36
armarx::aron::data::ReaderInterface< const nlohmann::json >::readLong
virtual void readLong(InputType &input, long &i, Path &)=0
armarx::aron::data::ReaderInterface< const nlohmann::json >::readList
virtual void readList(InputType &input, std::vector< InputTypeNonConst > &elements, Path &)=0
armarx::aron::data::ReaderInterface< const nlohmann::json >::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 nlohmann::json >::readBool
virtual void readBool(InputType &input, bool &i, Path &)=0