24 #include "base_types.hpp"
27 #include "globals.hpp"
38 size_t getHeaderLength(
const std::vector<std::string>& name);
39 int writeHeader(Global::buflen_pair& buf,
40 Global::MsgType msgtype,
41 const std::vector<std::string>& names);
44 Global::buflen_pair make_append_msg(
const std::vector<std::string>& names,
const arr::Array<T>& a)
47 throw std::out_of_range(
"make_append_msg: no data");
49 const auto headersz = getHeaderLength(names);
51 auto buf = std::make_pair(std::make_unique<
char[]>(totalsz), totalsz);
52 a.to_buffer(buf.first.get() + headersz);
53 writeHeader(buf, Global::MsgType::APPEND, names);
58 Global::buflen_pair make_append_msg(
const std::vector<std::string>& names,
const Vector<T>& v)
61 throw std::out_of_range(
"make_append_msg: no data");
63 const auto headersz = getHeaderLength(names);
64 const auto totalsz = headersz + v.getBufferSize();
65 auto buf = std::make_pair(std::make_unique<
char[]>(totalsz), totalsz);
66 v.to_buffer(buf.first.get() + headersz);
67 writeHeader(buf, Global::MsgType::APPEND_VECTOR, names);
71 Global::buflen_pair make_append_msg(
const std::vector<std::string>& names,
72 const Vector<Global::dtime>& idx,
73 const Vector<double>& v);
78 Global::buflen_pair make_append_msg(
const std::vector<string>& name,
const arr::zts& z);