TraDemGen Logo  1.00.9
C++ Simulated Travel Demand Generation Library
Loading...
Searching...
No Matches
TRADEMGEN_Abstract.hpp
Go to the documentation of this file.
1#ifndef __TRADEMGEN_TRADEMGEN_ABSTRACT_HPP
2#define __TRADEMGEN_TRADEMGEN_ABSTRACT_HPP
3
4// //////////////////////////////////////////////////////////////////////
5// Import section
6// //////////////////////////////////////////////////////////////////////
7// STL
8#include <istream>
9#include <ostream>
10#include <sstream>
11#include <string>
12
13namespace TRADEMGEN {
14
17 public:
18 // /////////// Display support methods /////////
21 virtual void toStream (std::ostream& ioOut) const = 0;
22
25 virtual void fromStream (std::istream& ioIn) = 0;
26
28 virtual std::string toString() const = 0;
29
30
31 protected:
35
38 };
39}
40
46template <class charT, class traits>
47inline
48std::basic_ostream<charT, traits>&
49operator<< (std::basic_ostream<charT, traits>& ioOut,
50 const TRADEMGEN::TRADEMGEN_Abstract& iStructure) {
56 std::basic_ostringstream<charT,traits> ostr;
57 ostr.copyfmt (ioOut);
58 ostr.width (0);
59
60 // Fill string stream
61 iStructure.toStream (ostr);
62
63 // Print string stream
64 ioOut << ostr.str();
65
66 return ioOut;
67}
68
74template <class charT, class traits>
75inline
76std::basic_istream<charT, traits>&
77operator>> (std::basic_istream<charT, traits>& ioIn,
79 // Fill Bom object with input stream
80 ioStucture.fromStream (ioIn);
81 return ioIn;
82}
83
84#endif // __TRADEMGEN_TRADEMGEN_ABSTRACT_HPP
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, TRADEMGEN::TRADEMGEN_Abstract &ioStucture)
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &ioOut, const TRADEMGEN::TRADEMGEN_Abstract &iStructure)
virtual void fromStream(std::istream &ioIn)=0
virtual void toStream(std::ostream &ioOut) const =0
virtual std::string toString() const =0
TRADEMGEN_Abstract(const TRADEMGEN_Abstract &)