UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Serial.hpp
Go to the documentation of this file.
1 /* Serial.hpp */
2 /* $Id: Serial.hpp,v 1.4 2004/06/03 10:41:07 vlad Exp $ */
3 #ifndef __Serial_hpp
4 #define __Serial_hpp
5 
6 #include <mix/trans.h>
7 #include <mix/growbuf.h>
8 
9 
23 {
24 private:
25 
27  int debug_level;
28 
29 protected:
30 
33  virtual void get_data (size_t nbytes, void* dst) = 0;
34 
35 public:
36 
39  virtual ByteOrder arch () const = 0;
40 
43  virtual void get_any (AtomType atom_type,
44  unsigned count,
45  void* dst = NULL);
46 
47  /*
48  * Debugging facility
49  */
50 
52  void set_debug_level (int dl) {
53  debug_level = dl;
54  }
55 
57  int get_debug_level () const {
58  return debug_level;
59  }
60 
61 };
62 
63 
70 {
71 private:
72 
74  int debug_level;
75 
77  ByteOrder byte_order;
78 
80  GrowingBuffer trans_buf;
81 
82 protected:
83 
86  virtual void put_data (size_t nbytes, const void* src) = 0;
87 
88 public:
89 
91  OutputStream (ByteOrder arch);
92 
94  virtual ~OutputStream ();
95 
98  ByteOrder arch () const {
99  return byte_order;
100  }
101 
106  virtual void put_any (AtomType atom_type,
107  unsigned count,
108  const void* src = NULL);
109 
110  /*
111  * Debugging facility
112  */
113 
115  void set_debug_level (int dl) {
116  debug_level = dl;
117  }
118 
120  int get_debug_level () const {
121  return debug_level;
122  }
123 
124 };
125 
126 
132 {
133 public:
134 
136  SerialThis ();
137 
139  SerialThis (InputStream& ist);
140 
143  virtual void serialize (OutputStream& ost) const;
144 
147  virtual void deserialize (InputStream& ist);
148 
149 };
150 
151 
152 #endif /* Serial.hpp */
virtual ByteOrder arch() const =0
int get_debug_level() const
Definition: Serial.hpp:57
virtual void put_data(size_t nbytes, const void *src)=0
virtual void serialize(OutputStream &ost) const
void set_debug_level(int dl)
Definition: Serial.hpp:52
virtual void get_data(size_t nbytes, void *dst)=0
Definition: Serial.hpp:22
int get_debug_level() const
Definition: Serial.hpp:120
virtual void deserialize(InputStream &ist)
virtual void put_any(AtomType atom_type, unsigned count, const void *src=NULL)
Definition: Serial.hpp:69
ByteOrder arch() const
Definition: Serial.hpp:98
void set_debug_level(int dl)
Definition: Serial.hpp:115
OutputStream(ByteOrder arch)
Definition: growbuf.h:23
virtual ~OutputStream()
Definition: Serial.hpp:131
virtual void get_any(AtomType atom_type, unsigned count, void *dst=NULL)