FOX/ObjCryst++  1.10.X (development)
VFNStreamFormat.h
1 /* ObjCryst++ Object-Oriented Crystallographic Library
2  (c) 2000-2005 Vincent Favre-Nicolin vincefn@users.sourceforge.net
3  2000-2001 University of Geneva (Switzerland)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 // This file includes some "effectors" used to format
20 //strings, numbers, some arrays...
21 #ifndef _VFN_STREAM_FORMAT_H_
22 #define _VFN_STREAM_FORMAT_H_
23 
24 #include <string>
25 #include <iostream>
26 #include <vector>
27 
28 #include "ObjCryst/CrystVector/CrystVector.h"
29 
36 class FormatInt
37 {
38  public:
39  FormatInt(const long num,const int width=5);
40  ~FormatInt();
41  //private:
42  const long mValue;
43  const int mWidth;
44 };
45 
46 std::ostream& operator<< (std::ostream& os, const FormatInt& fInt);
47 
55 {
56  public:
57  FormatFloat(const REAL num,const int width=10,const int precision=4);
58  ~FormatFloat();
59 
60  //private:
61  const REAL mValue;
62  const int mWidth;
63  const int mPrecision;
64 };
65 
66 std::ostream& operator<< (std::ostream& os, const FormatFloat &fFloat);
67 
74 {
75  public:
76  FormatString(const string &str,const unsigned int width=5);
77  ~FormatString();
78  int length() const;
79  //private:
80  string mString;
81  const unsigned int mWidth;
82 };
83 
84 std::ostream& operator<< (std::ostream& os, const FormatString& fStr);
85 
96 template<class T> class FormatVertVector
97 {
98  public:
99  FormatVertVector( const CrystVector<T> &fVect,
100  const int width=10,
101  const int precision=4,
102  const int nb=0);
103  FormatVertVector( const CrystVector<T> &fVect1,
104  const CrystVector<T> &fVect2,
105  const int width=10,
106  const int precision=4,
107  const int nb=0);
108  FormatVertVector( const CrystVector<T> &fVect1,
109  const CrystVector<T> &fVect2,
110  const CrystVector<T> &fVect3,
111  const int width=10,
112  const int precision=4,
113  const int nb=0);
114  FormatVertVector( const CrystVector<T> &fVect1,
115  const CrystVector<T> &fVect2,
116  const CrystVector<T> &fVect3,
117  const CrystVector<T> &fVect4,
118  const int width=10,
119  const int precision=4,
120  const int nb=0);
121  FormatVertVector( const CrystVector<T> &fVect1,
122  const CrystVector<T> &fVect2,
123  const CrystVector<T> &fVect3,
124  const CrystVector<T> &fVect4,
125  const CrystVector<T> &fVect5,
126  const int width=10,
127  const int precision=4,
128  const int nb=0);
129  FormatVertVector( const CrystVector<T> &fVect1,
130  const CrystVector<T> &fVect2,
131  const CrystVector<T> &fVect3,
132  const CrystVector<T> &fVect4,
133  const CrystVector<T> &fVect5,
134  const CrystVector<T> &fVect6,
135  const int width=10,
136  const int precision=4,
137  const int nb=0);
138  FormatVertVector( const CrystVector<T> *pVect,
139  const int nbVect,
140  const int width=10,
141  const int precision=4,
142  const int nb=0);
143  FormatVertVector( const CrystVector<T> &fVect1,
144  const CrystVector<T> *pVect,
145  const int nbVect,
146  const int width=10,
147  const int precision=4,
148  const int nb=0);
149  FormatVertVector( std::vector<const CrystVector<T> *>& v,
150  const int width=10,
151  const int precision=4,
152  const int nb=0);
153  ~FormatVertVector();
154  //int length() const;
155  //private:
156  std::vector<const CrystVector<T> *>mvpVectors;
157  const int mWidth;
158  const int mPrecision;
159  const int mNb;
160 };
161 
162 template<class T> std::ostream& operator<< (std::ostream &os, const FormatVertVector<T> &fVect);
163 
168 template<class T> class FormatHorizVector
169 {
170  public:
171  FormatHorizVector(const CrystVector<T> &fVect,
172  const int width=10,
173  const int precision=4);
175  //int length() const;
176  //private:
177  const CrystVector<T> *mpVectors;
178  const int mWidth;
179  const int mPrecision;
180 };
181 
182 template<class T> ostream& operator<< (std::ostream &os, const FormatHorizVector<T> &fVect);
183 
188 template<class T>class FormatVertVectorHKLFloats
189 {
190  public:
192  const CrystVector<T> &k,
193  const CrystVector<T> &l,
194  const int width=10,
195  const int precision=4,
196  const int nb=0);
198  const CrystVector<T> &k,
199  const CrystVector<T> &l,
200  const CrystVector<T> &m,
201  const int width=10,
202  const int precision=4,
203  const int nb=0);
205  const CrystVector<T> &k,
206  const CrystVector<T> &l,
207  const CrystVector<T> &m,
208  const CrystVector<T> &n,
209  const int width=10,
210  const int precision=4,
211  const int nb=0);
213  const CrystVector<T> &k,
214  const CrystVector<T> &l,
215  const CrystVector<T> &m,
216  const CrystVector<T> &n,
217  const CrystVector<T> &o,
218  const int width=10,
219  const int precision=4,
220  const int nb=0);
222  const CrystVector<T> &k,
223  const CrystVector<T> &l,
224  const CrystVector<T> &m,
225  const CrystVector<T> &n,
226  const CrystVector<T> &o,
227  const CrystVector<T> &p,
228  const int width=10,
229  const int precision=4,
230  const int nb=0);
232  const CrystVector<T> &k,
233  const CrystVector<T> &l,
234  const CrystVector<T> &m,
235  const CrystVector<T> &n,
236  const CrystVector<T> &o,
237  const CrystVector<T> &p,
238  const CrystVector<T> &q,
239  const int width=10,
240  const int precision=4,
241  const int nb=0);
243  const CrystVector<T> &k,
244  const CrystVector<T> &l,
245  const CrystVector<T> &m,
246  const CrystVector<T> &n,
247  const CrystVector<T> &o,
248  const CrystVector<T> &p,
249  const CrystVector<T> &q,
250  const CrystVector<T> &r,
251  const int width=10,
252  const int precision=4,
253  const int nb=0);
255  const CrystVector<T> &k,
256  const CrystVector<T> &l,
257  const CrystVector<T> &m,
258  const CrystVector<T> &n,
259  const CrystVector<T> &o,
260  const CrystVector<T> &p,
261  const CrystVector<T> &q,
262  const CrystVector<T> &r,
263  const CrystVector<T> &s,
264  const int width=10,
265  const int precision=4,
266  const int nb=0);
268  const CrystVector<T> &k,
269  const CrystVector<T> &l,
270  const CrystVector<T> &m,
271  const CrystVector<T> &n,
272  const CrystVector<T> &o,
273  const CrystVector<T> &p,
274  const CrystVector<T> &q,
275  const CrystVector<T> &r,
276  const CrystVector<T> &s,
277  const CrystVector<T> &t,
278  const int width=10,
279  const int precision=4,
280  const int nb=0);
282  const CrystVector<T> &k,
283  const CrystVector<T> &l,
284  const CrystVector<T> &m,
285  const CrystVector<T> &n,
286  const CrystVector<T> &o,
287  const CrystVector<T> &p,
288  const CrystVector<T> &q,
289  const CrystVector<T> &r,
290  const CrystVector<T> &s,
291  const CrystVector<T> &t,
292  const CrystVector<T> &u,
293  const int width=10,
294  const int precision=4,
295  const int nb=0);
296  FormatVertVectorHKLFloats( std::vector<const CrystVector<T> *>& v,
297  const int width=10,
298  const int precision=4,
299  const int nb=0);
301  //int length() const;
302  //private:
303  std::vector<const CrystVector<T> *>mvpVectors;
304  const int mWidth;
305  const int mPrecision;
306  const int mNb;
307 };
308 
309 template<class T> std::ostream& operator<< (std::ostream& os, const FormatVertVectorHKLFloats<T> &fStr);
310 
311 
312 #endif
output a number as a formatted integer:
Output vectors as column arrays, with the first 3 columns printed as integers.
output one or several vectors as (a) column(s):
Format vector as horiz array:
Vector library (Blitz++ mimic) for ObjCryst++.
Definition: CrystVector.h:122
output a number as a formatted float:
output a string with a fixed length (adding necessary space or removing excess characters) : ...