tue_serialization
include
tue
serialization
output_archive.h
Go to the documentation of this file.
1
#ifndef TUE_SERIALIZATION_OUTPUT_ARCHIVE_H_
2
#define TUE_SERIALIZATION_OUTPUT_ARCHIVE_H_
3
4
#include <
iostream
>
5
6
#include "
tue/serialization/version.h
"
7
8
namespace
tue
9
{
10
namespace
serialization
11
{
12
13
class
OutputArchive
{
14
15
public
:
16
17
OutputArchive
(
std::ostream
&
stream
) :
stream_
(
stream
) {
18
stream_
.
write
((
char
*)&
tue::serialization::VERSION
,
sizeof
(
tue::serialization::VERSION
));
19
}
20
21
virtual
~OutputArchive
() {}
22
23
inline
OutputArchive
&
operator<<
(
unsigned
char
c) {
stream_
.
write
((
char
*)&c,
sizeof
(c));
return
*
this
; }
24
25
inline
OutputArchive
&
operator<<
(
float
f) {
stream_
.
write
((
char
*)&f,
sizeof
(f));
return
*
this
; }
26
27
inline
OutputArchive
&
operator<<
(
double
d) {
stream_
.
write
((
char
*)&d,
sizeof
(d));
return
*
this
; }
28
29
inline
OutputArchive
&
operator<<
(
int
i) {
stream_
.
write
((
char
*)&i,
sizeof
(i));
return
*
this
; }
30
31
inline
OutputArchive
&
operator<<
(
std::string
s) {
stream_
.
write
(s.
c_str
(), s.
size
() + 1);
return
*
this
; }
32
33
inline
OutputArchive
&
write
(
const
char
* data,
unsigned
int
size) {
stream_
.
write
(data, size);
return
*
this
; }
34
35
inline
std::ostream
&
stream
() {
return
stream_
; }
36
37
protected
:
38
39
std::ostream
&
stream_
;
40
41
};
42
43
}
44
45
}
46
47
#endif
tue::serialization::OutputArchive::stream_
std::ostream & stream_
Definition:
output_archive.h:39
std::string
tue::serialization::OutputArchive::operator<<
OutputArchive & operator<<(unsigned char c)
Definition:
output_archive.h:23
std::string::size
T size(T... args)
tue::serialization::OutputArchive
Definition:
output_archive.h:13
version.h
iostream
std::ostream::write
T write(T... args)
tue::serialization::OutputArchive::operator<<
OutputArchive & operator<<(int i)
Definition:
output_archive.h:29
std::ostream
std::string::c_str
T c_str(T... args)
tue::serialization::OutputArchive::OutputArchive
OutputArchive(std::ostream &stream)
Definition:
output_archive.h:17
tue::serialization::OutputArchive::operator<<
OutputArchive & operator<<(double d)
Definition:
output_archive.h:27
tue::serialization::OutputArchive::operator<<
OutputArchive & operator<<(float f)
Definition:
output_archive.h:25
tue::serialization::OutputArchive::~OutputArchive
virtual ~OutputArchive()
Definition:
output_archive.h:21
tue::serialization::OutputArchive::stream
std::ostream & stream()
Definition:
output_archive.h:35
tue::serialization::VERSION
static int VERSION
Definition:
version.h:9
tue::serialization::OutputArchive::operator<<
OutputArchive & operator<<(std::string s)
Definition:
output_archive.h:31
tue
Definition:
archive.h:9
tue::serialization::OutputArchive::write
OutputArchive & write(const char *data, unsigned int size)
Definition:
output_archive.h:33
Generated on Sat Apr 5 2025 04:35:52 for tue_serialization by
1.8.17