RMOL Logo Get Revenue Management Optimisation Library at SourceForge.net. Fast, secure and Free Open Source software downloads

FldAbstract.hpp

Go to the documentation of this file.
00001 #ifndef __RMOL_FLD_FLDABSTRACT_HPP
00002 #define __RMOL_FLD_FLDABSTRACT_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // STL
00008 #include <istream>
00009 #include <ostream>
00010 #include <sstream>
00011 #include <string>
00012 
00013 namespace RMOL {
00014 
00016   class FldAbstract {
00017   public:
00018     // /////////// Display support methods /////////
00021     virtual void toStream (std::ostream& ioOut) const = 0;
00022 
00025     virtual void fromStream (std::istream& ioIn) = 0;
00026     
00027   protected:
00029     FldAbstract() {}
00030     FldAbstract(const FldAbstract&) {}
00031 
00033     virtual ~FldAbstract() {}
00034  };
00035 }
00036 
00042 template <class charT, class traits>
00043 inline
00044 std::basic_ostream<charT, traits>&
00045 operator<< (std::basic_ostream<charT, traits>& ioOut,
00046             const RMOL::FldAbstract& iBom) {
00052   std::basic_ostringstream<charT,traits> ostr;
00053   ostr.copyfmt (ioOut);
00054   ostr.width (0);
00055 
00056   // Fill string stream
00057   iBom.toStream (ostr);
00058 
00059   // Print string stream
00060   ioOut << ostr.str();
00061 
00062   return ioOut;
00063 }
00064 
00070 template <class charT, class traits>
00071 inline
00072 std::basic_istream<charT, traits>&
00073 operator>> (std::basic_istream<charT, traits>& ioIn,
00074             RMOL::FldAbstract& ioBom) {
00075   // Fill Bom object with input stream
00076   ioBom.fromStream (ioIn);
00077   return ioIn;
00078 }
00079 
00080 #endif // __RMOL_FLD_FLDABSTRACT_HPP
SourceForge Logo

Generated on Sat Jun 6 13:49:02 2009 for RMOL by Doxygen 1.5.7.1