Go to the documentation of this file.00001 #ifndef __RMOL_BOM_BOMABSTRACT_HPP
00002 #define __RMOL_BOM_BOMABSTRACT_HPP
00003
00004
00005
00006
00007
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
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
00070 iBom.toStream (ostr);
00071
00072
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
00089 ioBom.fromStream (ioIn);
00090 return ioIn;
00091 }
00092
00093 #endif // __RMOL_BOM_BOMABSTRACT_HPP