27 namespace astrotypes {
34 stream.write(reinterpret_cast<const char*>(&var),
sizeof(T));
41 stream.read(reinterpret_cast<char*>(&var),
sizeof(T));
42 return stream.gcount();
46 template<
typename Unit,
typename T>
52 template<
typename Unit,
typename NumericalRep>
55 stream.
read(reinterpret_cast<char*>(const_cast<NumericalRep*>(&var.value())),
sizeof(NumericalRep));
56 return stream.gcount();
62 int32_t size=
static_cast<int32_t
>(var.size());
64 throw std::runtime_error(
"SigProc::write: illegal size of string (max 80): " + std::to_string(size));
68 stream.
write(var.data(), size);
76 stream.read(reinterpret_cast<char*>(&size),
sizeof(size));
77 auto s =
sizeof(int32_t);
79 if( size < 0 || size > 80 ) {
80 std::runtime_error e(
"SigProcVariable<std::string>::read: illegal size of string: " + std::to_string(size));
86 stream.read(&var[0], size);
120 struct hash<
pss::astrotypes::sigproc::SigProcLabel>
124 return std::hash<std::string>()(quantity.
string());
static unsigned write(std::ostream &, T const &var)
write the provided variable to the stream
std::string const & string() const
static unsigned read(std::istream &, T &var)
read form the stream into the variable provided
std::istream & operator>>(std::istream &stream, HeaderBase< Derived > &headers)
Read and write variables to sigproc format.
void read(std::istream &is)
Header::InfoSentry< Stream > operator<<(Stream &os, Header::Info const &adapter)
std::size_t operator()(const pss::astrotypes::sigproc::SigProcLabel &quantity) const
void write(std::ostream &os) const