00001
00002
00003 #ifndef _VFN_STREAM_FORMAT_H_
00004 #define _VFN_STREAM_FORMAT_H_
00005
00006 #include <string>
00007 #include <iostream>
00008
00009 using namespace std;
00010
00011 #include "CrystVector/CrystVector.h"
00012
00019 class FormatInt
00020 {
00021 public:
00022 FormatInt(const long num,const int width=5);
00023 ~FormatInt();
00024 private:
00025 const long mValue;
00026 const int mWidth;
00027
00028 friend ostream& operator<< (ostream& os, const FormatInt &fInt);
00029 };
00030
00031 ostream& operator<< (ostream& os, const FormatInt& fInt);
00032
00033
00040 class FormatFloat
00041 {
00042 public:
00043 FormatFloat(const double num,const int width=10,const int precision=4);
00044 ~FormatFloat();
00045
00046 private:
00047 const double mValue;
00048 const int mWidth;
00049 const int mPrecision;
00050 friend ostream& operator<< (ostream&, const FormatFloat&);
00051 };
00052
00053 ostream& operator<< (ostream& os, const FormatFloat &fFloat);
00054
00060 class FormatString
00061 {
00062 public:
00063 FormatString(const string &str,const unsigned int width=5);
00064 ~FormatString();
00065 int length() const;
00066 private:
00067 string mString;
00068 const unsigned int mWidth;
00069
00070 friend ostream& operator<< (ostream&, const FormatString&);
00071 };
00072
00073 ostream& operator<< (ostream& os, const FormatString& fStr);
00074
00085 template<class T> class FormatVertVector
00086 {
00087 public:
00088 FormatVertVector( const CrystVector<T> &fVect,
00089 const int width=10,
00090 const int precision=4);
00091 FormatVertVector( const CrystVector<T> &fVect1,
00092 const CrystVector<T> &fVect2,
00093 const int width=10,
00094 const int precision=4);
00095 FormatVertVector( const CrystVector<T> &fVect1,
00096 const CrystVector<T> &fVect2,
00097 const CrystVector<T> &fVect3,
00098 const int width=10,
00099 const int precision=4);
00100 FormatVertVector( const CrystVector<T> &fVect1,
00101 const CrystVector<T> &fVect2,
00102 const CrystVector<T> &fVect3,
00103 const CrystVector<T> &fVect4,
00104 const int width=10,
00105 const int precision=4);
00106 FormatVertVector( const CrystVector<T> &fVect1,
00107 const CrystVector<T> &fVect2,
00108 const CrystVector<T> &fVect3,
00109 const CrystVector<T> &fVect4,
00110 const CrystVector<T> &fVect5,
00111 const int width=10,
00112 const int precision=4);
00113 FormatVertVector( const CrystVector<T> &fVect1,
00114 const CrystVector<T> &fVect2,
00115 const CrystVector<T> &fVect3,
00116 const CrystVector<T> &fVect4,
00117 const CrystVector<T> &fVect5,
00118 const CrystVector<T> &fVect6,
00119 const int width=10,
00120 const int precision=4);
00121 FormatVertVector( const CrystVector<T> *pVect,
00122 const int nbVect,
00123 const int width=10,
00124 const int precision=4);
00125 FormatVertVector( const CrystVector<T> &fVect1,
00126 const CrystVector<T> *pVect,
00127 const int nbVect,
00128 const int width=10,
00129 const int precision=4);
00130 ~FormatVertVector();
00131
00132
00133 const CrystVector<T> **mpVectors;
00134 const int mNbVectors;
00135 const int mWidth;
00136 const int mPrecision;
00137
00138 friend ostream& operator<< <T>(ostream&, const FormatVertVector<T>&);
00139 };
00140
00141 template<class T> ostream& operator<< (ostream &os, const FormatVertVector<T> &fVect);
00142
00147 template<class T> class FormatHorizVector
00148 {
00149 public:
00150 FormatHorizVector(const CrystVector<T> &fVect,
00151 const int width=10,
00152 const int precision=4);
00153 ~FormatHorizVector();
00154
00155
00156 const CrystVector<T> *mpVectors;
00157 const int mWidth;
00158 const int mPrecision;
00159
00160 friend ostream& operator<< <T>(ostream&, const FormatHorizVector<T>&);
00161 };
00162
00163 template<class T> ostream& operator<< (ostream &os, const FormatHorizVector<T> &fVect);
00164
00169 template<class T>class FormatVertVectorHKLFloats
00170 {
00171 public:
00172 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00173 const CrystVector<T> &k,
00174 const CrystVector<T> &l,
00175 const int width=10,
00176 const int precision=4);
00177 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00178 const CrystVector<T> &k,
00179 const CrystVector<T> &l,
00180 const CrystVector<T> &m,
00181 const int width=10,
00182 const int precision=4);
00183 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00184 const CrystVector<T> &k,
00185 const CrystVector<T> &l,
00186 const CrystVector<T> &m,
00187 const CrystVector<T> &n,
00188 const int width=10,
00189 const int precision=4);
00190 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00191 const CrystVector<T> &k,
00192 const CrystVector<T> &l,
00193 const CrystVector<T> &m,
00194 const CrystVector<T> &n,
00195 const CrystVector<T> &o,
00196 const int width=10,
00197 const int precision=4);
00198 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00199 const CrystVector<T> &k,
00200 const CrystVector<T> &l,
00201 const CrystVector<T> &m,
00202 const CrystVector<T> &n,
00203 const CrystVector<T> &o,
00204 const CrystVector<T> &p,
00205 const int width=10,
00206 const int precision=4);
00207 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00208 const CrystVector<T> &k,
00209 const CrystVector<T> &l,
00210 const CrystVector<T> &m,
00211 const CrystVector<T> &n,
00212 const CrystVector<T> &o,
00213 const CrystVector<T> &p,
00214 const CrystVector<T> &q,
00215 const int width=10,
00216 const int precision=4);
00217 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00218 const CrystVector<T> &k,
00219 const CrystVector<T> &l,
00220 const CrystVector<T> &m,
00221 const CrystVector<T> &n,
00222 const CrystVector<T> &o,
00223 const CrystVector<T> &p,
00224 const CrystVector<T> &q,
00225 const CrystVector<T> &r,
00226 const int width=10,
00227 const int precision=4);
00228 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00229 const CrystVector<T> &k,
00230 const CrystVector<T> &l,
00231 const CrystVector<T> &m,
00232 const CrystVector<T> &n,
00233 const CrystVector<T> &o,
00234 const CrystVector<T> &p,
00235 const CrystVector<T> &q,
00236 const CrystVector<T> &r,
00237 const CrystVector<T> &s,
00238 const int width=10,
00239 const int precision=4);
00240 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00241 const CrystVector<T> &k,
00242 const CrystVector<T> &l,
00243 const CrystVector<T> &m,
00244 const CrystVector<T> &n,
00245 const CrystVector<T> &o,
00246 const CrystVector<T> &p,
00247 const CrystVector<T> &q,
00248 const CrystVector<T> &r,
00249 const CrystVector<T> &s,
00250 const CrystVector<T> &t,
00251 const int width=10,
00252 const int precision=4);
00253 FormatVertVectorHKLFloats( const CrystVector<T> &h,
00254 const CrystVector<T> &k,
00255 const CrystVector<T> &l,
00256 const CrystVector<T> &m,
00257 const CrystVector<T> &n,
00258 const CrystVector<T> &o,
00259 const CrystVector<T> &p,
00260 const CrystVector<T> &q,
00261 const CrystVector<T> &r,
00262 const CrystVector<T> &s,
00263 const CrystVector<T> &t,
00264 const CrystVector<T> &u,
00265 const int width=10,
00266 const int precision=4);
00267 ~FormatVertVectorHKLFloats();
00268
00269
00270 const CrystVector<T> *mpVectors[20];
00271 const int mNbVectors;
00272 const int mWidth;
00273 const int mPrecision;
00274
00275 friend ostream& operator<< <T>(ostream&, const FormatVertVectorHKLFloats<T>&);
00276 };
00277
00278 template<class T> ostream& operator<< (ostream& os, const FormatVertVectorHKLFloats<T> &fStr);
00279
00280
00281 #endif
00282