00001 #ifndef __RMOL_BOM_BOMABSTRACT_HPP 00002 #define __RMOL_BOM_BOMABSTRACT_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 BomAbstract { 00017 friend class FacBomAbstract; 00018 public: 00019 // /////////// Display support methods ///////// 00022 virtual void toStream (std::ostream& ioOut) const = 0; 00023 00026 virtual void fromStream (std::istream& ioIn) = 0; 00027 00029 virtual std::string toString() const = 0; 00030 00033 virtual const std::string describeKey() const = 0; 00034 00037 virtual const std::string describeShortKey() const = 0; 00038 00039 00040 protected: 00042 BomAbstract() {} 00043 BomAbstract(const BomAbstract&) {} 00044 00046 virtual ~BomAbstract() {} 00047 }; 00048 } 00049 00055 template <class charT, class traits> 00056 inline 00057 std::basic_ostream<charT, traits>& 00058 operator<< (std::basic_ostream<charT, traits>& ioOut, 00059 const RMOL::BomAbstract& iBom) { 00065 std::basic_ostringstream<charT,traits> ostr; 00066 ostr.copyfmt (ioOut); 00067 ostr.width (0); 00068 00069 // Fill string stream 00070 iBom.toStream (ostr); 00071 00072 // Print string stream 00073 ioOut << ostr.str(); 00074 00075 return ioOut; 00076 } 00077 00083 template <class charT, class traits> 00084 inline 00085 std::basic_istream<charT, traits>& 00086 operator>> (std::basic_istream<charT, traits>& ioIn, 00087 RMOL::BomAbstract& ioBom) { 00088 // Fill Bom object with input stream 00089 ioBom.fromStream (ioIn); 00090 return ioIn; 00091 } 00092 00093 #endif // __RMOL_BOM_BOMABSTRACT_HPP
Generated on Wed Feb 9 2011 17:09:14 for RMOL by Doxygen 1.7.1