StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
BomAbstract.hpp
Go to the documentation of this file.
1 
7 #ifndef __STDAIR_BOM_BOMABSTRACT_HPP
8 #define __STDAIR_BOM_BOMABSTRACT_HPP
9 
10 // //////////////////////////////////////////////////////////////////////
11 // Import section
12 // //////////////////////////////////////////////////////////////////////
13 // STL
14 #include <iosfwd>
15 #include <string>
16 #include <map>
17 #include <typeinfo>
18 
19 namespace stdair {
20 
24  class BomAbstract {
25  public:
26  // /////////// Display support methods /////////
32  virtual void toStream (std::ostream& ioOut) const = 0;
33 
39  virtual void fromStream (std::istream& ioIn) = 0;
40 
46  virtual std::string toString() const = 0;
47 
48 
49  protected:
55  public:
59  virtual ~BomAbstract() {}
60  };
61 
62  /* Define the map of object holder type. */
63  typedef std::map<const std::type_info*, BomAbstract*> HolderMap_T;
64 }
65 
71 template <class charT, class traits>
72 inline
73 std::basic_ostream<charT, traits>&
74 operator<< (std::basic_ostream<charT, traits>& ioOut,
75  const stdair::BomAbstract& iBom) {
81  std::basic_ostringstream<charT,traits> ostr;
82  ostr.copyfmt (ioOut);
83  ostr.width (0);
84 
85  // Fill string stream
86  iBom.toStream (ostr);
87 
88  // Print string stream
89  ioOut << ostr.str();
90 
91  return ioOut;
92 }
93 
99 template <class charT, class traits>
100 inline
101 std::basic_istream<charT, traits>&
102 operator>> (std::basic_istream<charT, traits>& ioIn,
103  stdair::BomAbstract& ioBom) {
104  // Fill Bom object with input stream
105  ioBom.fromStream (ioIn);
106  return ioIn;
107 }
108 
109 #endif // __STDAIR_BOM_BOMABSTRACT_HPP
Handle on the StdAir library context.
std::map< const std::type_info *, BomAbstract * > HolderMap_T
Definition: BomAbstract.hpp:63
Base class for the Business Object Model (BOM) layer.
Definition: BomAbstract.hpp:24
BomAbstract(const BomAbstract &)
Definition: BomAbstract.hpp:54
virtual ~BomAbstract()
Definition: BomAbstract.hpp:59
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, stdair::BomAbstract &ioBom)
virtual std::string toString() const =0
virtual void fromStream(std::istream &ioIn)=0
virtual void toStream(std::ostream &ioOut) const =0