Mercurial > hg > orthanc-stone
annotate Resources/CodeGeneration/template.in.h.j2 @ 601:8432926e9db9 am-dev
codegen tools: support for int64, uint32, uint64
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 29 Apr 2019 12:01:55 +0200 |
parents | 75664eeacae5 |
children | 84af39146e76 |
rev | line source |
---|---|
490 | 1 /* |
2 1 2 3 4 5 6 7 | |
3 12345678901234567890123456789012345678901234567890123456789012345678901234567890 | |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
4 |
507 | 5 Generated on {{currentDatetime}} by stonegentool |
6 | |
490 | 7 */ |
507 | 8 #pragma once |
490 | 9 |
507 | 10 #include <exception> |
490 | 11 #include <iostream> |
12 #include <string> | |
13 #include <sstream> | |
14 #include <assert.h> | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
15 #include <memory> |
543
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
16 #include <set> |
490 | 17 #include <json/json.h> |
18 | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
19 //#define STONEGEN_NO_CPP11 1 |
490 | 20 |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
21 #ifdef STONEGEN_NO_CPP11 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
22 #define StoneSmartPtr std::auto_ptr |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
23 #else |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
24 #define StoneSmartPtr std::unique_ptr |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
25 #endif |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
26 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
27 namespace {{rootName}} |
490 | 28 { |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
29 /** Throws in case of problem */ |
507 | 30 inline void _StoneDeserializeValue(int32_t& destValue, const Json::Value& jsonValue) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
31 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
32 destValue = jsonValue.asInt(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
33 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
34 |
507 | 35 inline Json::Value _StoneSerializeValue(int32_t value) |
490 | 36 { |
37 Json::Value result(value); | |
38 return result; | |
39 } | |
40 | |
601
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
41 inline void _StoneDeserializeValue(int64_t& destValue, const Json::Value& jsonValue) |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
42 { |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
43 destValue = jsonValue.asInt64(); |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
44 } |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
45 |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
46 inline Json::Value _StoneSerializeValue(int64_t value) |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
47 { |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
48 Json::Value result(value); |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
49 return result; |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
50 } |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
51 |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
52 inline void _StoneDeserializeValue(uint32_t& destValue, const Json::Value& jsonValue) |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
53 { |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
54 destValue = jsonValue.asUInt(); |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
55 } |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
56 |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
57 inline Json::Value _StoneSerializeValue(uint32_t value) |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
58 { |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
59 Json::Value result(value); |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
60 return result; |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
61 } |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
62 |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
63 inline void _StoneDeserializeValue(uint64_t& destValue, const Json::Value& jsonValue) |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
64 { |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
65 destValue = jsonValue.asUInt64(); |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
66 } |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
67 |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
68 inline Json::Value _StoneSerializeValue(uint64_t value) |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
69 { |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
70 Json::Value result(value); |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
71 return result; |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
72 } |
8432926e9db9
codegen tools: support for int64, uint32, uint64
Alain Mazy <alain@mazy.be>
parents:
543
diff
changeset
|
73 |
508
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
74 inline void _StoneDeserializeValue(Json::Value& destValue, const Json::Value& jsonValue) |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
75 { |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
76 destValue = jsonValue; |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
77 } |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
78 |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
79 inline Json::Value _StoneSerializeValue(Json::Value value) |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
80 { |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
81 return value; |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
82 } |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
83 |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
84 /** Throws in case of problem */ |
507 | 85 inline void _StoneDeserializeValue(double& destValue, const Json::Value& jsonValue) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
86 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
87 destValue = jsonValue.asDouble(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
88 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
89 |
507 | 90 inline Json::Value _StoneSerializeValue(double value) |
490 | 91 { |
92 Json::Value result(value); | |
93 return result; | |
94 } | |
95 | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
96 /** Throws in case of problem */ |
507 | 97 inline void _StoneDeserializeValue(bool& destValue, const Json::Value& jsonValue) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
98 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
99 destValue = jsonValue.asBool(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
100 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
101 |
507 | 102 inline Json::Value _StoneSerializeValue(bool value) |
490 | 103 { |
104 Json::Value result(value); | |
105 return result; | |
106 } | |
107 | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
108 /** Throws in case of problem */ |
507 | 109 inline void _StoneDeserializeValue( |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
110 std::string& destValue |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
111 , const Json::Value& jsonValue) |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
112 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
113 destValue = jsonValue.asString(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
114 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
115 |
507 | 116 inline Json::Value _StoneSerializeValue(const std::string& value) |
490 | 117 { |
118 // the following is better than | |
119 Json::Value result(value.data(),value.data()+value.size()); | |
120 return result; | |
121 } | |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
122 |
524 | 123 inline std::string MakeIndent(size_t indent) |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
124 { |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
125 char* txt = reinterpret_cast<char*>(malloc(indent+1)); // NO EXCEPTION BELOW!!!!!!!!!!!! |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
126 for(size_t i = 0; i < indent; ++i) |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
127 txt[i] = ' '; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
128 txt[indent] = 0; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
129 std::string retVal(txt); |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
130 free(txt); // NO EXCEPTION ABOVE !!!!!!!!!! |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
131 return retVal; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
132 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
133 |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
134 // generic dumper |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
135 template<typename T> |
524 | 136 std::ostream& StoneDumpValue(std::ostream& out, const T& value, size_t indent) |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
137 { |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
138 out << MakeIndent(indent) << value; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
139 return out; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
140 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
141 |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
142 // string dumper |
524 | 143 inline std::ostream& StoneDumpValue(std::ostream& out, const std::string& value, size_t indent) |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
144 { |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
145 out << MakeIndent(indent) << "\"" << value << "\""; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
146 return out; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
147 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
148 |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
149 /** Throws in case of problem */ |
490 | 150 template<typename T> |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
151 void _StoneDeserializeValue( |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
152 std::map<std::string, T>& destValue, const Json::Value& jsonValue) |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
153 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
154 destValue.clear(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
155 for ( |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
156 Json::Value::const_iterator itr = jsonValue.begin(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
157 itr != jsonValue.end(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
158 itr++) |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
159 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
160 std::string key; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
161 _StoneDeserializeValue(key, itr.key()); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
162 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
163 T innerDestValue; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
164 _StoneDeserializeValue(innerDestValue, *itr); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
165 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
166 destValue[key] = innerDestValue; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
167 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
168 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
169 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
170 template<typename T> |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
171 Json::Value _StoneSerializeValue(const std::map<std::string,T>& value) |
490 | 172 { |
173 Json::Value result(Json::objectValue); | |
174 | |
499 | 175 for (typename std::map<std::string, T>::const_iterator it = value.cbegin(); |
490 | 176 it != value.cend(); ++it) |
177 { | |
178 // it->first it->second | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
179 result[it->first] = _StoneSerializeValue(it->second); |
490 | 180 } |
181 return result; | |
182 } | |
183 | |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
184 template<typename T> |
524 | 185 std::ostream& StoneDumpValue(std::ostream& out, const std::map<std::string,T>& value, size_t indent) |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
186 { |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
187 out << MakeIndent(indent) << "{\n"; |
499 | 188 for (typename std::map<std::string, T>::const_iterator it = value.cbegin(); |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
189 it != value.cend(); ++it) |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
190 { |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
191 out << MakeIndent(indent+2) << "\"" << it->first << "\" : "; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
192 StoneDumpValue(out, it->second, indent+2); |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
193 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
194 out << MakeIndent(indent) << "}\n"; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
195 return out; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
196 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
197 |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
198 /** Throws in case of problem */ |
490 | 199 template<typename T> |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
200 void _StoneDeserializeValue( |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
201 std::vector<T>& destValue, const Json::Value& jsonValue) |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
202 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
203 destValue.clear(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
204 destValue.reserve(jsonValue.size()); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
205 for (Json::Value::ArrayIndex i = 0; i != jsonValue.size(); i++) |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
206 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
207 T innerDestValue; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
208 _StoneDeserializeValue(innerDestValue, jsonValue[i]); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
209 destValue.push_back(innerDestValue); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
210 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
211 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
212 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
213 template<typename T> |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
214 Json::Value _StoneSerializeValue(const std::vector<T>& value) |
490 | 215 { |
216 Json::Value result(Json::arrayValue); | |
217 for (size_t i = 0; i < value.size(); ++i) | |
218 { | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
219 result.append(_StoneSerializeValue(value[i])); |
490 | 220 } |
221 return result; | |
222 } | |
223 | |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
224 template<typename T> |
524 | 225 std::ostream& StoneDumpValue(std::ostream& out, const std::vector<T>& value, size_t indent) |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
226 { |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
227 out << MakeIndent(indent) << "[\n"; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
228 for (size_t i = 0; i < value.size(); ++i) |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
229 { |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
230 StoneDumpValue(out, value[i], indent+2); |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
231 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
232 out << MakeIndent(indent) << "]\n"; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
233 return out; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
234 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
235 |
543
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
236 /** Throws in case of problem */ |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
237 template<typename T> |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
238 void _StoneDeserializeValue( |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
239 std::set<T>& destValue, const Json::Value& jsonValue) |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
240 { |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
241 destValue.clear(); |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
242 for (Json::Value::ArrayIndex i = 0; i != jsonValue.size(); i++) |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
243 { |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
244 T innerDestValue; |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
245 _StoneDeserializeValue(innerDestValue, jsonValue[i]); |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
246 destValue.insert(innerDestValue); |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
247 } |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
248 } |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
249 |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
250 template<typename T> |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
251 Json::Value _StoneSerializeValue(const std::set<T>& value) |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
252 { |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
253 Json::Value result(Json::arrayValue); |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
254 for (typename std::set<T>::const_iterator it = value.begin(); it != value.end(); ++it) |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
255 { |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
256 result.append(_StoneSerializeValue(*it)); |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
257 } |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
258 return result; |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
259 } |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
260 |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
261 template<typename T> |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
262 std::ostream& StoneDumpValue(std::ostream& out, const std::set<T>& value, size_t indent) |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
263 { |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
264 out << MakeIndent(indent) << "[\n"; |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
265 for (typename std::set<T>::const_iterator it = value.begin(); it != value.end(); ++it) |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
266 { |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
267 StoneDumpValue(out, *it, indent+2); |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
268 } |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
269 out << MakeIndent(indent) << "]\n"; |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
270 return out; |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
271 } |
75664eeacae5
added sets in code generation (not tested yet in TS)
Alain Mazy <alain@mazy.be>
parents:
524
diff
changeset
|
272 |
507 | 273 inline void StoneCheckSerializedValueTypeGeneric(const Json::Value& value) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
274 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
275 if ((!value.isMember("type")) || (!value["type"].isString())) |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
276 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
277 std::stringstream ss; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
278 ss << "Cannot deserialize value ('type' key invalid)"; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
279 throw std::runtime_error(ss.str()); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
280 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
281 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
282 |
507 | 283 inline void StoneCheckSerializedValueType( |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
284 const Json::Value& value, std::string typeStr) |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
285 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
286 StoneCheckSerializedValueTypeGeneric(value); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
287 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
288 std::string actTypeStr = value["type"].asString(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
289 if (actTypeStr != typeStr) |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
290 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
291 std::stringstream ss; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
292 ss << "Cannot deserialize type" << actTypeStr |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
293 << "into " << typeStr; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
294 throw std::runtime_error(ss.str()); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
295 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
296 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
297 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
298 // end of generic methods |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
299 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
300 // end of generic methods |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
301 {% for enum in enums%} |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
302 enum {{enum['name']}} { |
507 | 303 {% for key in enum['fields']%} {{enum['name']}}_{{key}}, |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
304 {%endfor%} }; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
305 |
507 | 306 inline std::string ToString(const {{enum['name']}}& value) |
307 { | |
308 {% for key in enum['fields']%} if( value == {{enum['name']}}_{{key}}) | |
309 { | |
310 return std::string("{{key}}"); | |
311 } | |
508
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
312 {%endfor%} std::stringstream ss; |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
313 ss << "Value \"" << value << "\" cannot be converted to {{enum['name']}}. Possible values are: " |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
314 {% for key in enum['fields']%} << " {{key}} = " << static_cast<int64_t>({{enum['name']}}_{{key}}) << ", " |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
315 {% endfor %} << std::endl; |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
316 std::string msg = ss.str(); |
7105a0bad250
- Added HandleSerializedMessage to IStoneApplication (empty impl)
Benjamin Golinvaux <bgo@osimis.io>
parents:
507
diff
changeset
|
317 throw std::runtime_error(msg); |
507 | 318 } |
319 | |
320 inline void FromString({{enum['name']}}& value, std::string strValue) | |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
321 { |
507 | 322 {% for key in enum['fields']%} if( strValue == std::string("{{key}}") ) |
323 { | |
324 value = {{enum['name']}}_{{key}}; | |
519
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
325 return; |
507 | 326 } |
327 {%endfor%} | |
328 std::stringstream ss; | |
519
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
329 ss << "String \"" << strValue << "\" cannot be converted to {{enum['name']}}. Possible values are: {% for key in enum['fields']%}{{key}} {% endfor %}"; |
507 | 330 std::string msg = ss.str(); |
331 throw std::runtime_error(msg); | |
332 } | |
333 | |
519
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
334 |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
335 inline void _StoneDeserializeValue( |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
336 {{enum['name']}}& destValue, const Json::Value& jsonValue) |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
337 { |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
338 FromString(destValue, jsonValue.asString()); |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
339 } |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
340 |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
341 inline Json::Value _StoneSerializeValue(const {{enum['name']}}& value) |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
342 { |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
343 std::string strValue = ToString(value); |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
344 return Json::Value(strValue); |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
345 } |
17106b29ed6d
Changed the metadata system for structs. A __handler entry is now required
Benjamin Golinvaux <bgo@osimis.io>
parents:
515
diff
changeset
|
346 |
524 | 347 inline std::ostream& StoneDumpValue(std::ostream& out, const {{enum['name']}}& value, size_t indent = 0) |
507 | 348 { |
349 {% for key in enum['fields']%} if( value == {{enum['name']}}_{{key}}) | |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
350 { |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
351 out << MakeIndent(indent) << "{{key}}" << std::endl; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
352 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
353 {%endfor%} return out; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
354 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
355 |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
356 {%endfor%} |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
357 {% for struct in structs%} |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
358 #ifdef _MSC_VER |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
359 #pragma region {{struct['name']}} |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
360 #endif //_MSC_VER |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
361 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
362 struct {{struct['name']}} |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
363 { |
507 | 364 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} {{CanonToCpp(struct['fields'][key])}} {{key}}; |
365 {% endfor %}{% endif %}{% endif %} | |
366 {{struct['name']}}({% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%}{{CanonToCpp(struct['fields'][key])}} {{key}} = {{CanonToCpp(struct['fields'][key])}}(){{ ", " if not loop.last }}{% endfor %}{% endif %}{% endif %}) | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
367 { |
507 | 368 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} this->{{key}} = {{key}}; |
369 {% endfor %}{% endif %}{% endif %} } | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
370 }; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
371 |
507 | 372 inline void _StoneDeserializeValue({{struct['name']}}& destValue, const Json::Value& value) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
373 { |
507 | 374 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} _StoneDeserializeValue(destValue.{{key}}, value["{{key}}"]); |
375 {% endfor %}{% endif %}{% endif %} } | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
376 |
507 | 377 inline Json::Value _StoneSerializeValue(const {{struct['name']}}& value) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
378 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
379 Json::Value result(Json::objectValue); |
507 | 380 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} result["{{key}}"] = _StoneSerializeValue(value.{{key}}); |
381 {% endfor %}{% endif %}{% endif %} | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
382 return result; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
383 } |
490 | 384 |
524 | 385 inline std::ostream& StoneDumpValue(std::ostream& out, const {{struct['name']}}& value, size_t indent = 0) |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
386 { |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
387 out << MakeIndent(indent) << "{\n"; |
507 | 388 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} out << MakeIndent(indent) << "{{key}}:\n"; |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
389 StoneDumpValue(out, value.{{key}},indent+2); |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
390 out << "\n"; |
507 | 391 {% endfor %}{% endif %}{% endif %} |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
392 out << MakeIndent(indent) << "}\n"; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
393 return out; |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
394 } |
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
395 |
507 | 396 inline void StoneDeserialize({{struct['name']}}& destValue, const Json::Value& value) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
397 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
398 StoneCheckSerializedValueType(value, "{{rootName}}.{{struct['name']}}"); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
399 _StoneDeserializeValue(destValue, value["value"]); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
400 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
401 |
507 | 402 inline Json::Value StoneSerializeToJson(const {{struct['name']}}& value) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
403 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
404 Json::Value result(Json::objectValue); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
405 result["type"] = "{{rootName}}.{{struct['name']}}"; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
406 result["value"] = _StoneSerializeValue(value); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
407 return result; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
408 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
409 |
507 | 410 inline std::string StoneSerialize(const {{struct['name']}}& value) |
411 { | |
412 Json::Value resultJson = StoneSerializeToJson(value); | |
413 std::string resultStr = resultJson.toStyledString(); | |
414 return resultStr; | |
415 } | |
416 | |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
417 #ifdef _MSC_VER |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
418 #pragma endregion {{struct['name']}} |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
419 #endif //_MSC_VER |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
420 {% endfor %} |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
421 #ifdef _MSC_VER |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
422 #pragma region Dispatching code |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
423 #endif //_MSC_VER |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
424 |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
425 class IHandler |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
426 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
427 public: |
513
dea3787a8f4b
Added support for struct metadata, to disable/enable handler support in Typescript or C++
Benjamin Golinvaux <bgo@osimis.io>
parents:
508
diff
changeset
|
428 {% for struct in structs%}{% if struct['__meta__'].handleInCpp %} virtual bool Handle(const {{struct['name']}}& value) = 0; |
dea3787a8f4b
Added support for struct metadata, to disable/enable handler support in Typescript or C++
Benjamin Golinvaux <bgo@osimis.io>
parents:
508
diff
changeset
|
429 {% endif %}{% endfor %} }; |
490 | 430 |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
431 /** Service function for StoneDispatchToHandler */ |
507 | 432 inline bool StoneDispatchJsonToHandler( |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
433 const Json::Value& jsonValue, IHandler* handler) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
434 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
435 StoneCheckSerializedValueTypeGeneric(jsonValue); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
436 std::string type = jsonValue["type"].asString(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
437 if (type == "") |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
438 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
439 // this should never ever happen |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
440 throw std::runtime_error("Caught empty type while dispatching"); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
441 } |
513
dea3787a8f4b
Added support for struct metadata, to disable/enable handler support in Typescript or C++
Benjamin Golinvaux <bgo@osimis.io>
parents:
508
diff
changeset
|
442 {% for struct in structs%}{% if struct['__meta__'].handleInCpp %} else if (type == "{{rootName}}.{{struct['name']}}") |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
443 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
444 {{struct['name']}} value; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
445 _StoneDeserializeValue(value, jsonValue["value"]); |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
446 return handler->Handle(value); |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
447 } |
513
dea3787a8f4b
Added support for struct metadata, to disable/enable handler support in Typescript or C++
Benjamin Golinvaux <bgo@osimis.io>
parents:
508
diff
changeset
|
448 {% endif %}{% endfor %} else |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
449 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
450 return false; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
451 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
452 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
453 |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
454 /** Takes a serialized type and passes this to the handler */ |
507 | 455 inline bool StoneDispatchToHandler(std::string strValue, IHandler* handler) |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
456 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
457 Json::Value readValue; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
458 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
459 Json::CharReaderBuilder builder; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
460 Json::CharReader* reader = builder.newCharReader(); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
461 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
462 StoneSmartPtr<Json::CharReader> ptr(reader); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
463 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
464 std::string errors; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
465 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
466 bool ok = reader->parse( |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
467 strValue.c_str(), |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
468 strValue.c_str() + strValue.size(), |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
469 &readValue, |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
470 &errors |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
471 ); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
472 if (!ok) |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
473 { |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
474 std::stringstream ss; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
475 ss << "Jsoncpp parsing error: " << errors; |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
476 throw std::runtime_error(ss.str()); |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
477 } |
495
6405435480ae
Fixed template to add dump capabilities + started work on an integrated TS/WASM test
bgo-osimis
parents:
494
diff
changeset
|
478 return StoneDispatchJsonToHandler(readValue, handler); |
494
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
479 } |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
480 |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
481 #ifdef _MSC_VER |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
482 #pragma endregion Dispatching code |
fc17251477d6
TS and CPP tests OK. Ongoing code for C++ program that reads list of serialized messages in N files. Requires conan
bgo-osimis
parents:
490
diff
changeset
|
483 #endif //_MSC_VER |
490 | 484 } |