StdAir Logo  1.00.17
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
BomAbstract.hpp
Go to the documentation of this file.
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
19namespace stdair {
20
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
71template <class charT, class traits>
72inline
73std::basic_ostream<charT, traits>&
74operator<< (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
99template <class charT, class traits>
100inline
101std::basic_istream<charT, traits>&
102operator>> (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
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, stdair::BomAbstract &ioBom)
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &ioOut, const stdair::BomAbstract &iBom)
Handle on the StdAir library context.
std::map< const std::type_info *, BomAbstract * > HolderMap_T
Base class for the Business Object Model (BOM) layer.
virtual void fromStream(std::istream &ioIn)=0
virtual std::string toString() const =0
BomAbstract(const BomAbstract &)
virtual void toStream(std::ostream &ioOut) const =0