NlohmannJSONReaderWithoutTypeCheck.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 {
35  class NlohmannJSONReaderWithoutTypeCheck : public ReaderInterface<const nlohmann::json>
36  {
38 
39  public:
40  // constructors
42 
44 
45  using Base::readBool;
46  using Base::readDict;
47  using Base::readDouble;
48  using Base::readFloat;
49  using Base::readInt;
50  using Base::readList;
51  using Base::readLong;
52  using Base::readNDArray;
53  using Base::readString;
54 
55  void readList(InputType& input, std::vector<InputTypeNonConst>& elements, Path& p) override;
56  void readDict(InputType& input,
57  std::map<std::string, InputTypeNonConst>& elements,
58  Path& p) override;
59 
61  std::vector<int>& shape,
62  std::string& typeAsString,
63  std::vector<unsigned char>& data,
64  Path& p) override;
65 
66  void readInt(InputType& input, int& i, Path& p) override;
67  void readLong(InputType& input, long& i, Path& p) override;
68  void readFloat(InputType& input, float& i, Path& p) override;
69  void readDouble(InputType& input, double& i, Path& p) override;
70  void readString(InputType& input, std::string& i, Path& p) override;
71  void readBool(InputType& input, bool& i, Path& p) override;
72 
73  };
74 } // namespace armarx::aron::data::reader
armarx::aron::data::reader::NlohmannJSONReaderWithoutTypeCheck::readString
void readString(InputType &input, std::string &i, Path &p) override
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:169
armarx::aron::data::reader::NlohmannJSONReaderWithoutTypeCheck::readInt
void readInt(InputType &input, int &i, Path &p) override
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:145
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::NlohmannJSONReaderWithoutTypeCheck::readNDArray
void readNDArray(InputType &input, std::vector< int > &shape, std::string &typeAsString, std::vector< unsigned char > &data, Path &p) override
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:92
armarx::aron::data::reader::NlohmannJSONReaderWithoutTypeCheck::readDict
void readDict(InputType &input, std::map< std::string, InputTypeNonConst > &elements, Path &p) override
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:60
Reader.h
armarx::aron::data::reader::NlohmannJSONReaderWithoutTypeCheck::getDescriptor
data::Descriptor getDescriptor(InputType &input) final
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:46
armarx::aron::data::ReaderInterface< const nlohmann::json >::readInt
virtual void readInt(InputType &input, int &i, Path &)=0
armarx::aron::data::reader::NlohmannJSONReaderWithoutTypeCheck::readList
void readList(InputType &input, std::vector< InputTypeNonConst > &elements, Path &p) override
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:52
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::NlohmannJSONReaderWithoutTypeCheck::readFloat
void readFloat(InputType &input, float &i, Path &p) override
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:157
armarx::aron::data::reader::NlohmannJSONReaderWithoutTypeCheck
Definition: NlohmannJSONReaderWithoutTypeCheck.h:35
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 nlohmann::json >::readFloat
virtual void readFloat(InputType &input, float &i, Path &)=0
armarx::aron::data::reader::NlohmannJSONReaderWithoutTypeCheck::NlohmannJSONReaderWithoutTypeCheck
NlohmannJSONReaderWithoutTypeCheck()=default
armarx::aron::data::reader::NlohmannJSONReaderWithoutTypeCheck::readDouble
void readDouble(InputType &input, double &i, Path &p) override
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:163
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::NlohmannJSONReaderWithoutTypeCheck::readBool
void readBool(InputType &input, bool &i, Path &p) override
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:177
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::reader::NlohmannJSONReaderWithoutTypeCheck::readLong
void readLong(InputType &input, long &i, Path &p) override
Definition: NlohmannJSONReaderWithoutTypeCheck.cpp:151
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::aron::data::ReaderInterface< const nlohmann::json >::readBool
virtual void readBool(InputType &input, bool &i, Path &)=0