Go to the documentation of this file.00001 #ifndef __TRADEMGEN_TRADEMGEN_ABSTRACT_HPP
00002 #define __TRADEMGEN_TRADEMGEN_ABSTRACT_HPP
00003
00004
00005
00006
00007
00008 #include <istream>
00009 #include <ostream>
00010 #include <sstream>
00011 #include <string>
00012
00013 namespace TRADEMGEN {
00014
00016 struct TRADEMGEN_Abstract {
00017 public:
00018
00021 virtual void toStream (std::ostream& ioOut) const = 0;
00022
00025 virtual void fromStream (std::istream& ioIn) = 0;
00026
00028 virtual std::string toString() const = 0;
00029
00030
00031 protected:
00033 TRADEMGEN_Abstract () {}
00034 TRADEMGEN_Abstract (const TRADEMGEN_Abstract&) {}
00035
00037 virtual ~TRADEMGEN_Abstract() {}
00038 };
00039 }
00040
00046 template <class charT, class traits>
00047 inline
00048 std::basic_ostream<charT, traits>&
00049 operator<< (std::basic_ostream<charT, traits>& ioOut,
00050 const TRADEMGEN::TRADEMGEN_Abstract& iStructure) {
00056 std::basic_ostringstream<charT,traits> ostr;
00057 ostr.copyfmt (ioOut);
00058 ostr.width (0);
00059
00060
00061 iStructure.toStream (ostr);
00062
00063
00064 ioOut << ostr.str();
00065
00066 return ioOut;
00067 }
00068
00074 template <class charT, class traits>
00075 inline
00076 std::basic_istream<charT, traits>&
00077 operator>> (std::basic_istream<charT, traits>& ioIn,
00078 TRADEMGEN::TRADEMGEN_Abstract& ioStucture) {
00079
00080 ioStucture.fromStream (ioIn);
00081 return ioIn;
00082 }
00083
00084 #endif // __TRADEMGEN_TRADEMGEN_ABSTRACT_HPP