00001 #ifndef _POTYPES_H_
00002 #define _POTYPES_H_
00003 #include<Packable.h>
00004 #include<string>
00005 using namespace std;
00006
00007 #ifdef WIN32
00008 #include <windows.h>
00009 #ifdef PEXPR_EXPORTS
00010 #define PEXPR_API __declspec(dllexport)
00011 #else
00012 #define PEXPR_API __declspec(dllimport)
00013 #endif
00014 #else
00015 #define PEXPR_API
00016 #endif
00017
00018 class PEXPR_API POString : public Packable
00019 {
00020 public:
00021 POString( const string& str = ""):m_str(str){};
00022 POString( const POString& str ):Packable(),m_str(str.val()){};
00023 virtual ~POString(){}
00024
00025 int packsize()const;
00026 int pack( char* buf )const;
00027 int unpack( char* buf );
00028
00029 operator string&() { return m_str; }
00030 string val()const { return m_str; }
00031 private:
00032 string m_str;
00033 };
00034
00035 class PEXPR_API POInt : public Packable
00036 {
00037 public:
00038 POInt( const int& val = 0 ):m_int(val){};
00039
00040 int packsize()const;
00041 int pack( char* buf )const;
00042 int unpack( char* buf );
00043
00044 POInt& operator = ( int val ) { m_int = val; return *this; };
00045 operator int&() { return m_int; }
00046 int val()const { return m_int; }
00047
00048 private:
00049 int m_int;
00050 };
00051 class PEXPR_API POFloat : public Packable
00052 {
00053 public:
00054 POFloat( const float& val = 0 ):m_float(val){};
00055
00056 int packsize()const;
00057 int pack( char* buf )const;
00058 int unpack( char* buf );
00059
00060 POFloat& operator = ( float val ) { m_float = val; return *this; };
00061 operator float&() { return m_float; }
00062 float val()const { return m_float; }
00063
00064 private:
00065 float m_float;
00066 };
00067
00068
00069 class PEXPR_API PODouble : public Packable
00070 {
00071 public:
00072 PODouble( const double& val = 0 ):m_double(val){};
00073
00074 int packsize()const;
00075 int pack( char* buf )const;
00076 int unpack( char* buf );
00077
00078 PODouble& operator = ( double val ) { m_double = val; return *this; };
00079 operator double&() { return m_double; }
00080 double val()const { return m_double; }
00081
00082 private:
00083 double m_double;
00084 };
00085
00086
00087 #endif