rtstreams.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Thu Oct 10 16:17:00 CEST 2002 rtstreams.hpp
3 
4  rtstreams.hpp - description
5  -------------------
6  begin : Thu October 10 2002
7  copyright : (C) 2002 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 #include "fosi.h"
39 
40 #include "rtconversions.hpp"
41 #include "rtstreambufs.hpp"
42 
43 #ifndef RTSTREAMS_HPP
44 #define RTSTREAMS_HPP
45 
56 namespace RTT
57 {
58 namespace os
59 {
60 
76  class RTT_API basic_streams
77  {
78 
79  public:
80  virtual ~basic_streams();
81 
87 /*
88  virtual void write( const char * c );
89  virtual void write( const char * c, size_t n );
90  virtual void write( const string s );
91  virtual void put( char ch );
92 */
98 /*
99  virtual string read( int n );
100  virtual string read( char delimiter );
101  virtual char read();
102 */
103  };
104 
113  class RTT_API basic_istreams
114  : virtual public basic_streams
115  {
116 
117  public:
119 
120  basic_istreams( streambufs& s ) : buf(s) {}
121  virtual ~basic_istreams();
122 
123  int get();
124  basic_istreams& get(char& c);
125  basic_istreams& get(char* c, streamsize n, char delim);
126  basic_istreams& get(char* c, char delim);
127 
128  basic_istreams& read( char* c, streamsize n );
129  streamsize readsome( char* c, streamsize n);
130 
131 
132  basic_istreams& operator>>( int &i );
133  basic_istreams& operator>>( char &c );
134  basic_istreams& operator>>( double &f );
135  basic_istreams& operator>>( std::string &s );
136  basic_istreams& operator>>( unsigned int &u );
137  private:
139  };
140 
145  class RTT_API basic_ostreams : virtual public basic_streams
146  {
147 
148  public:
150 
151  basic_ostreams( streambufs& s ) : buf(s) {}
152  virtual ~basic_ostreams();
153 
154  virtual basic_ostreams& put( char c );
155  virtual basic_ostreams& write( const char * c, streamsize n );
156 
161  basic_ostreams& operator<<( int i );
162  basic_ostreams& operator<<( long i );
163  basic_ostreams& operator<<( char c );
164  basic_ostreams& operator<<( char * c );
165  basic_ostreams& operator<<( double f );
166  basic_ostreams& operator<<( std::string s );
167  basic_ostreams& operator<<( unsigned int u );
169  private:
171  };
172 
173 //#ifdef __KERNEL__
174 // defined in the namespace os
179 //#endif
180 
184  class RTT_API basic_iostreams
185  : public basic_istreams, public basic_ostreams
186  {
187  public:
189  : basic_istreams(s), basic_ostreams(s) {}
190  };
191 
192 
193  struct RTT_API print_helper { printbufs printer; };
194 
200  class RTT_API printstream
201  : private print_helper, public basic_ostreams
202  {
203 
204  public:
205  printstream() : basic_ostreams(printer) {}
206  virtual ~printstream();
207  };
208 
212  extern printstream cout;
213 
214  struct RTT_API string_helper { string_helper() : str() {}; string_helper(const std::string& _init) : str(_init) {}; stringbufs str; };
215 
219  class RTT_API stringstreams
220  : private string_helper, public basic_iostreams
221  {
222  public:
223  stringstreams(const std::string& _init) : string_helper(_init), basic_iostreams(str) {}
225  virtual ~stringstreams();
226  };
227 
228 }
229 }
230 #endif
string_helper(const std::string &_init)
Definition: rtstreams.hpp:214
stringstreams(const std::string &_init)
Definition: rtstreams.hpp:223
unsigned int streamsize
std::istream & operator>>(std::istream &is, BufferPolicy &bp)
streambufs::streamsize streamsize
Definition: rtstreams.hpp:149
printstream cout
Definition: rtstreams.cpp:45
basic_ostreams(streambufs &s)
Definition: rtstreams.hpp:151
streambufs::streamsize streamsize
Definition: rtstreams.hpp:118
basic_ostreams & endl(basic_ostreams &s)
Definition: rtstreams.cpp:110
std::ostream & operator<<(std::ostream &os, const BufferPolicy &bp)
basic_iostreams(streambufs &s)
Definition: rtstreams.hpp:188
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
basic_istreams(streambufs &s)
Definition: rtstreams.hpp:120


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:27