VariantWriter.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 
34 {
35  class VariantWriter :
36  public WriterInterface<data::VariantPtr>
37  {
38  public:
39  VariantWriter() = default;
40 
42 
43  data::VariantPtr writeList(const std::vector<data::VariantPtr>& elements, const Path& p = Path()) override;
44  data::VariantPtr writeDict(const std::map<std::string, data::VariantPtr>& elements, const std::optional<data::VariantPtr>& extends = std::nullopt, const Path& p = Path()) override;
45 
46  data::VariantPtr writeNDArray(const std::vector<int>& shape, const std::string& typeAsString, const unsigned char* data, const Path& p = Path()) override;
47 
48  data::VariantPtr writeInt(const int i, const Path& p = Path()) override;
49  data::VariantPtr writeLong(const long i, const Path& p = Path()) override;
50  data::VariantPtr writeFloat(const float i, const Path& p = Path()) override;
51  data::VariantPtr writeDouble(const double i, const Path& p = Path()) override;
52  data::VariantPtr writeString(const std::string& i, const Path& p = Path()) override;
53  data::VariantPtr writeBool(const bool i, const Path& p = Path()) override;
54 
56  };
57 }
Variant.h
armarx::aron::data::writer::VariantWriter::writeList
data::VariantPtr writeList(const std::vector< data::VariantPtr > &elements, const Path &p=Path()) override
Definition: VariantWriter.cpp:40
armarx::aron::data::writer::VariantWriter::writeNDArray
data::VariantPtr writeNDArray(const std::vector< int > &shape, const std::string &typeAsString, const unsigned char *data, const Path &p=Path()) override
Definition: VariantWriter.cpp:61
armarx::aron::data::Descriptor
Descriptor
Definition: Descriptor.h:193
armarx::aron::data::writer::VariantWriter::getDescriptor
data::Descriptor getDescriptor(ReturnTypeConst &input) final
Definition: VariantWriter.cpp:35
armarx::aron::data::writer::VariantWriter
Definition: VariantWriter.h:35
armarx::aron::data::writer::VariantWriter::writeLong
data::VariantPtr writeLong(const long i, const Path &p=Path()) override
Definition: VariantWriter.cpp:78
armarx::aron::Path
The Path class.
Definition: Path.h:36
armarx::aron::data::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
armarx::aron::data::writer::VariantWriter::VariantWriter
VariantWriter()=default
armarx::aron::data::writer::VariantWriter::writeString
data::VariantPtr writeString(const std::string &i, const Path &p=Path()) override
Definition: VariantWriter.cpp:99
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::aron::data::writer::VariantWriter::writeFloat
data::VariantPtr writeFloat(const float i, const Path &p=Path()) override
Definition: VariantWriter.cpp:85
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::aron::data::writer::VariantWriter::writeDouble
data::VariantPtr writeDouble(const double i, const Path &p=Path()) override
Definition: VariantWriter.cpp:92
armarx::aron::data::writer::VariantWriter::writeBool
data::VariantPtr writeBool(const bool i, const Path &p=Path()) override
Definition: VariantWriter.cpp:106
armarx::aron::data::writer::VariantWriter::writeInt
data::VariantPtr writeInt(const int i, const Path &p=Path()) override
Definition: VariantWriter.cpp:71
armarx::aron::data::writer
Definition: NlohmannJSONWriter.cpp:33
armarx::aron::data::WriterInterface< data::VariantPtr >::ReturnTypeConst
typename std::add_const< ReturnType >::type ReturnTypeConst
Definition: Writer.h:42
armarx::armem::server::ltm::detail::mixin::Path
std::filesystem::path Path
Definition: DiskStorageMixin.h:17
Writer.h
armarx::aron::data::writer::VariantWriter::writeDict
data::VariantPtr writeDict(const std::map< std::string, data::VariantPtr > &elements, const std::optional< data::VariantPtr > &extends=std::nullopt, const Path &p=Path()) override
Definition: VariantWriter.cpp:50
armarx::aron::data::WriterInterface
Definition: Writer.h:38