Go to the documentation of this file.00001 #ifndef EndianStream_CLASS
00002 #define EndianStream_CLASS
00003
00004 #include <stdint.h>
00005 #include <iostream>
00006 #include <fstream>
00007 #include <sstream>
00008 #include <string>
00009
00010 #include "Misc.h"
00011
00012 using namespace std;
00013
00014 namespace asdm {
00015
00016 class EndianOSStream : public ostringstream {
00017 protected :
00018
00019
00020 public :
00021 EndianOSStream() ;
00022 EndianOSStream(const asdm::ByteOrder* byteOrder);
00023 ~EndianOSStream();
00024
00025 const asdm::ByteOrder* byteOrder() const;
00026
00027 void writeBoolean(bool b);
00028 void writeBool(bool b);
00029 void writeByte(char c);
00030 void writeShort(short int s);
00031 void writeUShort(unsigned short int s);
00032 void writeInt(int i);
00033 void writeUInt(unsigned int ui);
00034 void writeLongLong(int64_t li);
00035 void writeLong(int64_t li);
00036 void writeULongLong(uint64_t li);
00037 void writeFloat(float f);
00038 void writeDouble(double d);
00039 void writeString(const string& s);
00040
00041 private:
00042 const asdm::ByteOrder* byteOrder_;
00043
00044 };
00045
00046 class EndianISStream : public istringstream {
00047 public :
00048 EndianISStream(const string& s) ;
00049 EndianISStream(const string& s, const asdm::ByteOrder* byteOrder);
00050 ~EndianISStream();
00051
00052 const asdm::ByteOrder* byteOrder() const ;
00053 bool readBoolean();
00054 char readByte();
00055 short int readShort();
00056 unsigned short int readUShort();
00057 int readInt();
00058 unsigned int readUInt();
00059 int64_t readLongLong();
00060 int64_t readLong();
00061 uint64_t readULongLong();
00062 float readFloat();
00063 double readDouble();
00064 string readString();
00065
00066 private :
00067 const asdm::ByteOrder* byteOrder_;
00068 };
00069 };
00070
00071 #endif // EndianStream_CLASS