6namespace tinyrobotics {
9
10
11
12
13
14
15
18 SerializeSTL(std::istream* in, std::ostream* out) : p_in(in), p_out(out) {}
19 SerializeSTL(std::ostream* out) : p_in(
nullptr), p_out(out) {}
20 SerializeSTL(std::istream* in) : p_in(in), p_out(
nullptr) {}
22 size_t print(Serializable& obj) {
24 std::string str = obj.toString();
25 (*p_out) << str << std::endl;
29 bool read(Serializable& obj) {
30 if (!p_in)
return false;
32 if (!std::getline(*p_in, str))
return false;
33 return obj.fromString(str);
37 std::istream* p_in =
nullptr;
38 std::ostream* p_out =
nullptr;
STL-based serialization utility for Serializable objects.
Definition: SerializeSTL.h:16