14 #ifndef __INCLUDED_SCOPIRA_TOOL_FLOW_H__ 15 #define __INCLUDED_SCOPIRA_TOOL_FLOW_H__ 19 #include <scopira/tool/object.h> 20 #include <scopira/tool/export.h> 54 typedef unsigned char byte_t;
73 typedef scopira::tool::byte_t
byte_t;
100 SCOPIRA_EXPORT
virtual bool failed(
void)
const = 0;
119 SCOPIRA_EXPORT
virtual size_t read(
byte_t *_buf,
size_t _maxsize) = 0;
128 return read(&out, 1);
140 return read(reinterpret_cast<byte_t*>(_buf), _numelem*
sizeof(TT))/
sizeof(TT);
151 inline size_t read_void(
void *_buf,
size_t _maxsize) {
return read(reinterpret_cast<byte_t*>(_buf), _maxsize); }
170 SCOPIRA_EXPORT
virtual size_t write(
const byte_t *_buf,
size_t _size) = 0;
179 return write(&b,
sizeof(b));
191 return write(reinterpret_cast<const byte_t*>(_buf), _numelem*
sizeof(TT))/
sizeof(TT);
202 inline size_t write_void(
const void *_buf,
size_t _size) {
return write(reinterpret_cast<const byte_t*>(_buf), _size); }
219 SCOPIRA_EXPORT
virtual bool read_bool(
bool&) = 0;
224 SCOPIRA_EXPORT
virtual bool read_char(
char&) = 0;
229 SCOPIRA_EXPORT
virtual bool read_short(
short&) = 0;
234 SCOPIRA_EXPORT
virtual bool read_int(
int&) = 0;
239 SCOPIRA_EXPORT
virtual bool read_size_t(
size_t&) = 0;
244 SCOPIRA_EXPORT
virtual bool read_int64_t(int64_t&) = 0;
249 SCOPIRA_EXPORT
virtual bool read_long(
long&) = 0;
254 SCOPIRA_EXPORT
virtual bool read_float(
float&) = 0;
259 SCOPIRA_EXPORT
virtual bool read_double(
double&) = 0;
264 SCOPIRA_EXPORT
virtual bool read_string(std::string&) = 0;
270 inline bool read_generic(TT &v);
288 SCOPIRA_EXPORT
virtual void write_bool(
bool) = 0;
293 SCOPIRA_EXPORT
virtual void write_char(
char) = 0;
298 SCOPIRA_EXPORT
virtual void write_short(
short) = 0;
303 SCOPIRA_EXPORT
virtual void write_int(
int) = 0;
308 SCOPIRA_EXPORT
virtual void write_size_t(
size_t) = 0;
313 SCOPIRA_EXPORT
virtual void write_int64_t(int64_t) = 0;
318 SCOPIRA_EXPORT
virtual void write_long(
long) = 0;
323 SCOPIRA_EXPORT
virtual void write_float(
float) = 0;
328 SCOPIRA_EXPORT
virtual void write_double(
double) = 0;
333 SCOPIRA_EXPORT
virtual void write_string(
const std::string&) = 0;
339 inline void write_generic(
const TT &v);
372 SCOPIRA_EXPORT
virtual bool read_object(
object* &out) = 0;
383 template <
class TT>
bool read_object_type(TT * &out);
389 template <
class TT>
bool read_object_type(
count_ptr<TT> &out);
397 assert(!o || dynamic_cast<TT*>(o));
398 out =
dynamic_cast<TT*
>(o);
407 assert(!o || dynamic_cast<TT*>(o));
408 out =
dynamic_cast<TT*
>(o);
437 { write_object(o.
get()); }
Definition: archiveflow.h:20