StdAir Logo  1.00.0
C++ Standard Airline IT Object Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ServiceAbstract.hpp
Go to the documentation of this file.
1 #ifndef __STDAIR_SVC_SERVICEABSTRACT_HPP
2 #define __STDAIR_SVC_SERVICEABSTRACT_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <iosfwd>
9 
10 namespace stdair {
11 
16  public:
17 
21  virtual ~ServiceAbstract() {}
22 
28  virtual void toStream (std::ostream& ioOut) const {}
29 
35  virtual void fromStream (std::istream& ioIn) {}
36 
40  // virtual const std::string describe() const = 0;
41 
42  protected:
47  };
48 }
49 
55 template <class charT, class traits>
56 inline
57 std::basic_ostream<charT, traits>&
58 operator<< (std::basic_ostream<charT, traits>& ioOut,
59  const stdair::ServiceAbstract& iService) {
65  std::basic_ostringstream<charT,traits> ostr;
66  ostr.copyfmt (ioOut);
67  ostr.width (0);
68 
69  // Fill string stream
70  iService.toStream (ostr);
71 
72  // Print string stream
73  ioOut << ostr.str();
74 
75  return ioOut;
76 }
77 
83 template <class charT, class traits>
84 inline
85 std::basic_istream<charT, traits>&
86 operator>> (std::basic_istream<charT, traits>& ioIn,
87  stdair::ServiceAbstract& ioService) {
88  // Fill Service object with input stream
89  ioService.fromStream (ioIn);
90  return ioIn;
91 }
92 
93 #endif // __STDAIR_SVC_SERVICEABSTRACT_HPP