Scopira  20080306
nullflow.h
1 
2 /*
3  * Copyright (c) 2003 National Research Council
4  *
5  * All rights reserved.
6  *
7  * This material is confidential and proprietary information of
8  * National Research Council Canada ("Confidential Information").
9  * This Confidential Information may only be used and reproduced
10  * in accordance with the terms of the license agreement.
11  *
12  */
13 
14 #ifndef __INCLUDED_SCOPIRA_TOOL_NULLFLOW_H__
15 #define __INCLUDED_SCOPIRA_TOOL_NULLFLOW_H__
16 
17 #include <scopira/tool/flow.h>
18 #include <scopira/tool/export.h>
19 
20 namespace scopira
21 {
22  namespace tool
23  {
24  class nullflow;
25 
26  class countoflow;
27  }
28 }
29 
36 {
37  public:
39  SCOPIRA_EXPORT nullflow(void);
40 
42  virtual bool failed(void) const { return false; }
43 
45  virtual size_t read(byte_t* _buf, size_t _maxsize) { return 0; }
47  virtual size_t write(const byte_t* _buf, size_t _size) { return 0; }
48 };
49 
57 {
58  private:
59  size_t dm_count;
60  public:
62  SCOPIRA_EXPORT countoflow(void);
63 
65  virtual bool failed(void) const { return false; }
66 
68  virtual size_t write(const byte_t* _buf, size_t _size) { dm_count += _size; return _size; }
69 
71  size_t get_count(void) const { return dm_count; }
73  void set_count(size_t new_count = 0) { dm_count = new_count; }
74 };
75 
76 #endif
77 
size_t get_count(void) const
gets the current count
Definition: nullflow.h:71
virtual size_t write(const byte_t *_buf, size_t _size)
write a raw block of data
Definition: nullflow.h:47
Definition: flow.h:108
virtual size_t read(byte_t *_buf, size_t _maxsize)
read raw block data, returns num read in
Definition: nullflow.h:45
virtual bool failed(void) const
are we in a failed state. always false (or should this be truee?
Definition: nullflow.h:65
scopira::tool::byte_t byte_t
Definition: flow.h:73
Definition: archiveflow.h:20
virtual size_t write(const byte_t *_buf, size_t _size)
write a raw block of data
Definition: nullflow.h:68
Definition: nullflow.h:35
nullflow(void)
default constructor
void set_count(size_t new_count=0)
sets the current count
Definition: nullflow.h:73
Definition: nullflow.h:56
virtual bool failed(void) const
are we in a failed state. always false (or should this be truee?
Definition: nullflow.h:42
Definition: flow.h:159