$treeview $search $mathjax
SimCRS Logo  1.01.1
$projectbrief
$projectbrief
$searchbox

BomAbstract.hpp

Go to the documentation of this file.
00001 #ifndef __SIMCRS_BOM_BOMABSTRACT_HPP
00002 #define __SIMCRS_BOM_BOMABSTRACT_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // STL
00008 #include <iosfwd>
00009 #include <string>
00010 
00011 namespace SIMCRS {
00012 
00014   class BomAbstract {
00015     friend class FacBomAbstract;
00016   public:
00017     // /////////// Display support methods /////////
00020     virtual void toStream (std::ostream& ioOut) const = 0;
00021 
00024     virtual void fromStream (std::istream& ioIn) = 0;
00025 
00027     virtual std::string toString() const = 0;
00028     
00031     virtual std::string describeKey() const = 0;
00032 
00035     virtual std::string describeShortKey() const = 0;
00036 
00037     
00038   protected:
00040     BomAbstract() {}
00041     BomAbstract(const BomAbstract&) {}
00042 
00044     virtual ~BomAbstract() {}
00045   };
00046 }
00047 
00053 template <class charT, class traits>
00054 inline
00055 std::basic_ostream<charT, traits>&
00056 operator<< (std::basic_ostream<charT, traits>& ioOut,
00057             const SIMCRS::BomAbstract& iBom) {
00063   std::basic_ostringstream<charT,traits> ostr;
00064   ostr.copyfmt (ioOut);
00065   ostr.width (0);
00066 
00067   // Fill string stream
00068   iBom.toStream (ostr);
00069 
00070   // Print string stream
00071   ioOut << ostr.str();
00072 
00073   return ioOut;
00074 }
00075 
00081 template <class charT, class traits>
00082 inline
00083 std::basic_istream<charT, traits>&
00084 operator>> (std::basic_istream<charT, traits>& ioIn,
00085             SIMCRS::BomAbstract& ioBom) {
00086   // Fill Bom object with input stream
00087   ioBom.fromStream (ioIn);
00088   return ioIn;
00089 }
00090 
00091 #endif // __SIMCRS_BOM_BOMABSTRACT_HPP