00001
00007 #ifndef __STDAIR_BOM_BOMABSTRACT_HPP
00008 #define __STDAIR_BOM_BOMABSTRACT_HPP
00009
00010
00011
00012
00013
00014 #include <iosfwd>
00015 #include <string>
00016 #include <map>
00017 #include <typeinfo>
00018
00019 namespace stdair {
00020
00024 class BomAbstract {
00025 public:
00026
00032 virtual void toStream (std::ostream& ioOut) const = 0;
00033
00039 virtual void fromStream (std::istream& ioIn) = 0;
00040
00046 virtual std::string toString() const = 0;
00047
00048
00049 protected:
00053 BomAbstract() {}
00054 BomAbstract(const BomAbstract&) {}
00055 public:
00059 virtual ~BomAbstract() {}
00060 };
00061
00062
00063 typedef std::map<const std::type_info*, BomAbstract*> HolderMap_T;
00064 }
00065
00071 template <class charT, class traits>
00072 inline
00073 std::basic_ostream<charT, traits>&
00074 operator<< (std::basic_ostream<charT, traits>& ioOut,
00075 const stdair::BomAbstract& iBom) {
00081 std::basic_ostringstream<charT,traits> ostr;
00082 ostr.copyfmt (ioOut);
00083 ostr.width (0);
00084
00085
00086 iBom.toStream (ostr);
00087
00088
00089 ioOut << ostr.str();
00090
00091 return ioOut;
00092 }
00093
00099 template <class charT, class traits>
00100 inline
00101 std::basic_istream<charT, traits>&
00102 operator>> (std::basic_istream<charT, traits>& ioIn,
00103 stdair::BomAbstract& ioBom) {
00104
00105 ioBom.fromStream (ioIn);
00106 return ioIn;
00107 }
00108
00109 #endif // __STDAIR_BOM_BOMABSTRACT_HPP