Scopira 20080306

nullflow.h

00001 
00002 /*
00003  *  Copyright (c) 2003    National Research Council
00004  *
00005  *  All rights reserved.
00006  *
00007  *  This material is confidential and proprietary information of
00008  *  National Research Council Canada ("Confidential Information").
00009  *  This Confidential Information may only be used and reproduced
00010  *  in accordance with the terms of the license agreement.
00011  *
00012  */
00013  
00014 #ifndef __INCLUDED_SCOPIRA_TOOL_NULLFLOW_H__
00015 #define __INCLUDED_SCOPIRA_TOOL_NULLFLOW_H__
00016 
00017 #include <scopira/tool/flow.h>
00018 #include <scopira/tool/export.h>
00019 
00020 namespace scopira
00021 {
00022   namespace tool
00023   {
00024     class nullflow;
00025 
00026     class countoflow;
00027   }
00028 }
00029 
00035 class scopira::tool::nullflow : public scopira::tool::iflow_i, public scopira::tool::oflow_i
00036 {
00037   public:
00039     SCOPIRA_EXPORT nullflow(void);
00040 
00042     virtual bool failed(void) const { return false; }
00043 
00045     virtual size_t read(byte_t* _buf, size_t _maxsize) { return 0; }
00047     virtual size_t write(const byte_t* _buf, size_t _size) { return 0; }
00048 };
00049 
00056 class scopira::tool::countoflow : public scopira::tool::oflow_i
00057 {
00058   private:
00059     size_t dm_count;
00060   public:
00062     SCOPIRA_EXPORT countoflow(void);
00063 
00065     virtual bool failed(void) const { return false; }
00066 
00068     virtual size_t write(const byte_t* _buf, size_t _size) { dm_count += _size; return _size; }
00069 
00071     size_t get_count(void) const { return dm_count; }
00073     void set_count(size_t new_count = 0) { dm_count = new_count; }
00074 };
00075 
00076 #endif
00077