00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef STREAMWRITER_H
00016 #define STREAMWRITER_H
00017
00018 #include "dtoolbase.h"
00019 #include "pnotify.h"
00020 #include "numeric_types.h"
00021 #include "littleEndian.h"
00022 #include "bigEndian.h"
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class EXPCL_DTOOLCONFIG StreamWriter {
00034 public:
00035 INLINE StreamWriter(ostream &out);
00036 PUBLISHED:
00037 INLINE StreamWriter(ostream *out, bool owns_stream);
00038 INLINE StreamWriter(const StreamWriter ©);
00039 INLINE void operator = (const StreamWriter ©);
00040 INLINE ~StreamWriter();
00041
00042 INLINE ostream *get_ostream() const;
00043
00044 BLOCKING INLINE void add_bool(bool value);
00045 BLOCKING INLINE void add_int8(PN_int8 value);
00046 BLOCKING INLINE void add_uint8(PN_uint8 value);
00047
00048
00049 BLOCKING INLINE void add_int16(PN_int16 value);
00050 BLOCKING INLINE void add_int32(PN_int32 value);
00051 BLOCKING INLINE void add_int64(PN_int64 value);
00052 BLOCKING INLINE void add_uint16(PN_uint16 value);
00053 BLOCKING INLINE void add_uint32(PN_uint32 value);
00054 BLOCKING INLINE void add_uint64(PN_uint64 value);
00055 BLOCKING INLINE void add_float32(float value);
00056 BLOCKING INLINE void add_float64(PN_float64 value);
00057
00058
00059 BLOCKING INLINE void add_be_int16(PN_int16 value);
00060 BLOCKING INLINE void add_be_int32(PN_int32 value);
00061 BLOCKING INLINE void add_be_int64(PN_int64 value);
00062 BLOCKING INLINE void add_be_uint16(PN_uint16 value);
00063 BLOCKING INLINE void add_be_uint32(PN_uint32 value);
00064 BLOCKING INLINE void add_be_uint64(PN_uint64 value);
00065 BLOCKING INLINE void add_be_float32(float value);
00066 BLOCKING INLINE void add_be_float64(PN_float64 value);
00067
00068 BLOCKING INLINE void add_string(const string &str);
00069 BLOCKING INLINE void add_string32(const string &str);
00070 BLOCKING INLINE void add_z_string(string str);
00071 BLOCKING INLINE void add_fixed_string(const string &str, size_t size);
00072
00073 BLOCKING void pad_bytes(size_t size);
00074 BLOCKING INLINE void append_data(const void *data, size_t size);
00075 BLOCKING INLINE void append_data(const string &data);
00076
00077 BLOCKING INLINE void flush();
00078
00079 BLOCKING INLINE void write(const string &str);
00080
00081 private:
00082 ostream *_out;
00083 bool _owns_stream;
00084 };
00085
00086 #include "streamWriter.I"
00087
00088 #endif