00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _StreamCoder_incl_
00020 #define _StreamCoder_incl_
00021
00022 #include <rel/IODevice.h>
00023 #include <rel/SmartPtr.h>
00024
00025 #include <string>
00026
00027 namespace rel
00028 {
00029
00035 class StreamCoder
00036 {
00037 public:
00038 typedef IODevice::size_type size_type;
00039
00040 StreamCoder(const SmartPtr<IODevice> &passThru);
00041 virtual ~StreamCoder();
00042
00043
00044 virtual bool read(int8_t &) const;
00045 virtual bool read(uint8_t &) const;
00046 virtual bool read(int16_t &) const;
00047 virtual bool read(uint16_t &) const;
00048 virtual bool read(int32_t &) const;
00049 virtual bool read(uint32_t &) const;
00050 virtual bool read(int64_t &) const;
00051 virtual bool read(uint64_t &) const;
00052 virtual bool read(float &) const;
00053 virtual bool read(double &) const;
00054 virtual bool read(std::string &) const;
00055
00056
00057 virtual bool write(int8_t);
00058 virtual bool write(uint8_t);
00059 virtual bool write(int16_t);
00060 virtual bool write(uint16_t);
00061 virtual bool write(int32_t);
00062 virtual bool write(uint32_t);
00063 virtual bool write(int64_t);
00064 virtual bool write(uint64_t);
00065 virtual bool write(float);
00066 virtual bool write(double);
00067 virtual bool write(const std::string &);
00068
00069
00070
00071 virtual int getReadDescriptor() const;
00072 virtual bool isDirectAccess() const;
00073 virtual size_type at() const;
00074 virtual bool at(size_type offset);
00075 virtual bool atEnd() const;
00076 virtual void flush();
00077
00078
00079
00080 virtual bool writeBytes(const char *data, size_type len);
00081 virtual bool readBytes(char *data, size_type maxLen) const;
00082
00083
00084 virtual size_type writeRawBytes(const char *data, size_type len);
00085 virtual size_type readRawBytes(char *data, size_type maxLen) const;
00086
00087 virtual SmartPtr<char*> print();
00088
00089 protected:
00090 SmartPtr<IODevice> passThru;
00091 };
00092
00093 }
00094
00095 #endif
00096