ISMRMRD: serialization_iostream.h Source File

ISMRMRD ISMRM Raw Data Format

Loading...
Searching...
No Matches
serialization_iostream.h
1#pragma once
2
3#include <iostream>
4#include <ismrmrd/serialization.h>
5
6namespace ISMRMRD {
7
8 class IStreamView : public ReadableStreamView {
9public:
10 IStreamView(std::istream &is) : _is(is) {}
11
12 virtual void read(char *buffer, size_t count) {
13 _is.read(buffer, count);
14 }
15
16 virtual bool eof() {
17 return _is.eof();
18 }
19
20protected:
21 std::istream &_is;
22};
23
24 class OStreamView : public WritableStreamView {
25public:
26 OStreamView(std::ostream &os) : _os(os) {}
27
28 void write(const char *buffer, size_t count) {
29 _os.write(buffer, count);
30 }
31
32 bool bad() {
33 return _os.bad();
34 }
35
36private:
37 std::ostream &_os;
38};
39
40} // namespace ISMRMRD
ISMRMRD::ReadableStreamView
Definition serialization.h:41
ISMRMRD::WritableStreamView
Definition serialization.h:49
serialization.h
Serialization functions for ISMRMRD data structures.