Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JAbstractIO.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JABSTRACTIO__
2 #define __JLANG__JABSTRACTIO__
3 
4 #include <istream>
5 #include <ostream>
6 
7 
8 /**
9  * \author mdejong
10  */
11 
12 namespace JLANG {}
13 namespace JPP { using namespace JLANG; }
14 
15 namespace JLANG {
16 
17 
18  /**
19  * Interface for ASCII input using standard streams.
20  */
21  class JStreamInput {
22  public:
23  /**
24  * Virtual destructor.
25  */
26  virtual ~JStreamInput()
27  {}
28 
29 
30  /**
31  * Stream input.
32  *
33  * \param in input stream
34  * \return input stream
35  */
36  virtual std::istream& read(std::istream& in) = 0;
37 
38 
39  /**
40  * Read object from input.
41  *
42  * \param in input stream
43  * \param object object
44  * \return input stream
45  */
46  friend inline std::istream& operator>>(std::istream& in, JStreamInput& object)
47  {
48  return object.read(in);
49  }
50  };
51 
52 
53  /**
54  * Interface for ASCII output using standard streams.
55  */
56  class JStreamOutput {
57  public:
58  /**
59  * Virtual destructor.
60  */
61  virtual ~JStreamOutput()
62  {}
63 
64 
65  /**
66  * Stream output.
67  *
68  * \param out output stream
69  * \return output stream
70  */
71  virtual std::ostream& write(std::ostream& out) const = 0;
72 
73 
74  /**
75  * Write object to output.
76  *
77  * \param out output stream
78  * \param object object
79  * \return output stream
80  */
81  friend inline std::ostream& operator<<(std::ostream& out, const JStreamOutput& object)
82  {
83  return object.write(out);
84  }
85  };
86 
87 
88  /**
89  * Interface for ASCII output with prefix and postfix using standard streams.
90  */
92  public:
93  /**
94  * Virtual destructor.
95  */
97  {}
98 
99 
100  /**
101  * Stream output.
102  *
103  * \param out output stream
104  * \param prefix prefix
105  * \param postfix postfix
106  * \return output stream
107  */
108  virtual std::ostream& write(std::ostream& out,
109  const char* prefix,
110  const char postfix) const = 0;
111  };
112 }
113 
114 #endif
Interface for ASCII input using standard streams.
Definition: JAbstractIO.hh:21
friend std::ostream & operator<<(std::ostream &out, const JStreamOutput &object)
Write object to output.
Definition: JAbstractIO.hh:81
virtual ~JStreamSuffixOutput()
Virtual destructor.
Definition: JAbstractIO.hh:96
virtual std::ostream & write(std::ostream &out) const =0
Stream output.
Interface for ASCII output using standard streams.
Definition: JAbstractIO.hh:56
virtual ~JStreamOutput()
Virtual destructor.
Definition: JAbstractIO.hh:61
virtual std::ostream & write(std::ostream &out, const char *prefix, const char postfix) const =0
Stream output.
friend std::istream & operator>>(std::istream &in, JStreamInput &object)
Read object from input.
Definition: JAbstractIO.hh:46
virtual ~JStreamInput()
Virtual destructor.
Definition: JAbstractIO.hh:26
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
Interface for ASCII output with prefix and postfix using standard streams.
Definition: JAbstractIO.hh:91
virtual std::istream & read(std::istream &in)=0
Stream input.