klee
TreeStream.h
Go to the documentation of this file.
1//===-- TreeStream.h --------------------------------------------*- C++ -*-===//
2//
3// The KLEE Symbolic Virtual Machine
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef KLEE_TREESTREAM_H
11#define KLEE_TREESTREAM_H
12
13#include <string>
14#include <vector>
15
16namespace klee {
17
18 typedef unsigned TreeStreamID;
19 class TreeOStream;
20
22 static const unsigned bufferSize = 4*4096;
23
24 friend class TreeOStream;
25
26 private:
29
30 std::string path;
31 std::ofstream *output;
32 unsigned ids;
33
34 void write(TreeOStream &os, const char *s, unsigned size);
35 void flushBuffer();
36
37 public:
38 TreeStreamWriter(const std::string &_path);
40
41 bool good();
42
44 TreeOStream open(const TreeOStream &node);
45
46 void flush();
47
48 // hack, to be replace by proper stream capabilities
50 std::vector<unsigned char> &out);
51 };
52
54 friend class TreeStreamWriter;
55
56 private:
58 unsigned id;
59
60 TreeOStream(TreeStreamWriter &_writer, unsigned _id);
61
62 public:
65
66 unsigned getID() const;
67
68 void write(const char *buffer, unsigned size);
69
70 TreeOStream &operator<<(const std::string &s);
71
72 void flush();
73 };
74}
75
76#endif /* KLEE_TREESTREAM_H */
TreeStreamWriter * writer
Definition: TreeStream.h:57
void write(const char *buffer, unsigned size)
Definition: TreeStream.cpp:183
unsigned getID() const
Definition: TreeStream.cpp:178
TreeOStream & operator<<(const std::string &s)
Definition: TreeStream.cpp:188
TreeOStream open()
Definition: TreeStream.cpp:50
TreeStreamWriter(const std::string &_path)
Definition: TreeStream.cpp:28
void write(TreeOStream &os, const char *s, unsigned size)
Definition: TreeStream.cpp:64
void readStream(TreeStreamID id, std::vector< unsigned char > &out)
Definition: TreeStream.cpp:96
std::ofstream * output
Definition: TreeStream.h:31
static const unsigned bufferSize
Definition: TreeStream.h:22
char buffer[bufferSize]
Definition: TreeStream.h:27
Definition: main.cpp:291
unsigned TreeStreamID
Definition: TreeStream.h:18