Scopira 20080306

binflow.h

00001 
00002 /*
00003  *  Copyright (c) 2002-2007    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_BINFLOW_H__
00015 #define __INCLUDED_SCOPIRA_TOOL_BINFLOW_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 biniflow;
00025     class binoflow;
00026 
00027     class bin64iflow;
00028     class bin64oflow;
00029   }
00030 }
00031 
00037 class scopira::tool::biniflow : public scopira::tool::itflow_i
00038 {
00039   protected:
00041     count2_ptr< iflow_i > dm_in;
00042     
00043   public:
00051     SCOPIRA_EXPORT biniflow(bool doref, iflow_i* in);
00053     SCOPIRA_EXPORT virtual ~biniflow(void);
00054 
00056     SCOPIRA_EXPORT virtual bool failed(void) const;
00057 
00059     SCOPIRA_EXPORT virtual size_t read(byte_t* _buf, size_t _maxsize);
00060 
00061     SCOPIRA_EXPORT virtual bool read_bool(bool&);
00062     SCOPIRA_EXPORT virtual bool read_char(char&);
00063     SCOPIRA_EXPORT virtual bool read_short(short&);
00064     SCOPIRA_EXPORT virtual bool read_int(int&);
00065     SCOPIRA_EXPORT virtual bool read_size_t(size_t&);
00066     SCOPIRA_EXPORT virtual bool read_int64_t(int64_t&);
00067     SCOPIRA_EXPORT virtual bool read_long(long&);
00068     SCOPIRA_EXPORT virtual bool read_float(float&);
00069     SCOPIRA_EXPORT virtual bool read_double(double&);
00070     SCOPIRA_EXPORT virtual bool read_string(std::string&);
00071 
00073     SCOPIRA_EXPORT void open(iflow_i* in);
00075     SCOPIRA_EXPORT void close(void);
00076 };
00077 
00084 class scopira::tool::binoflow : public scopira::tool::otflow_i
00085 {
00086   protected:
00088     count2_ptr< oflow_i > dm_out;
00089 
00090   public:
00098     SCOPIRA_EXPORT binoflow(bool doref, oflow_i* in);
00100     SCOPIRA_EXPORT virtual ~binoflow(void);
00101       
00103     SCOPIRA_EXPORT virtual bool failed(void) const;
00104 
00106     SCOPIRA_EXPORT virtual size_t write(const byte_t* _buf, size_t _size);
00107 
00108     SCOPIRA_EXPORT virtual void write_bool(bool val);
00109     SCOPIRA_EXPORT virtual void write_char(char val);
00110     SCOPIRA_EXPORT virtual void write_short(short val);
00111     SCOPIRA_EXPORT virtual void write_int(int val);
00112     SCOPIRA_EXPORT virtual void write_size_t(size_t val);
00113     SCOPIRA_EXPORT virtual void write_int64_t(int64_t val);
00114     SCOPIRA_EXPORT virtual void write_long(long val);
00115     SCOPIRA_EXPORT virtual void write_float(float val);
00116     SCOPIRA_EXPORT virtual void write_double(double val);
00117     SCOPIRA_EXPORT virtual void write_string(const std::string& val);
00118 
00120     SCOPIRA_EXPORT void open(oflow_i* in);
00122     SCOPIRA_EXPORT void close(void);
00123 };
00124 
00131 class scopira::tool::bin64iflow : public scopira::tool::biniflow
00132 {
00133   public:
00141     SCOPIRA_EXPORT bin64iflow(bool doref, iflow_i* in);
00142 
00143     SCOPIRA_EXPORT virtual bool read_size_t(size_t&);
00144     SCOPIRA_EXPORT virtual bool read_long(long&);
00145 };
00146 
00147 
00154 class scopira::tool::bin64oflow : public scopira::tool::binoflow
00155 {
00156   public:
00164     SCOPIRA_EXPORT bin64oflow(bool doref, oflow_i* in);
00165 
00166     SCOPIRA_EXPORT virtual void write_size_t(size_t val);
00167     SCOPIRA_EXPORT virtual void write_long(long val);
00168 };
00169 
00170 #endif
00171