IT++ Logo
itfile.h
Go to the documentation of this file.
1
29#ifndef ITFILE_H
30#define ITFILE_H
31
32#include <itpp/base/vec.h>
33
34#include <itpp/base/array.h>
35#include <itpp/base/binfile.h>
36#include <itpp/base/ittypes.h>
37#include <itpp/itexports.h>
38
39
40namespace itpp
41{
42
95{
96public:
112
113protected:
115 struct file_header {
117 char magic[4];
120 };
122 static char file_magic[4];
124 static char file_version;
125};
126
127
133{
134public:
136 it_ifile();
138 explicit it_ifile(const std::string& filename);
140 virtual ~it_ifile() { }
142 void open(const std::string& filename);
144 virtual void close();
146 bfstream& low_level() { return s; }
147
149 bool read_check_file_header();
151 void read_data_header(it_file_base::data_header& h);
152
154 void low_level_read(char& x);
156 void low_level_read(uint64_t& x);
158 void low_level_read(bool &x);
159
161 void low_level_read(bin& x);
163 void low_level_read(short& x);
165 void low_level_read(int& x);
167 void low_level_read(float& x);
169 void low_level_read(double& x);
171 void low_level_read(std::complex<float>& x);
173 void low_level_read(std::complex<double>& x);
174
176 void low_level_read(bvec& v);
178 void low_level_read(svec& v);
180 void low_level_read(ivec& v);
182 void low_level_read_lo(vec& v);
184 void low_level_read_hi(vec& v);
186 void low_level_read_lo(cvec& v);
188 void low_level_read_hi(cvec& v);
189
191 void low_level_read(std::string& str);
192
194 void low_level_read(bmat& m);
196 void low_level_read(smat& m);
198 void low_level_read(imat& m);
200 void low_level_read_lo(mat& m);
202 void low_level_read_hi(mat& m);
204 void low_level_read_lo(cmat& m);
206 void low_level_read_hi(cmat& m);
207
209 void low_level_read(Array<bin>& v);
211 void low_level_read(Array<short>& v);
213 void low_level_read(Array<int>& v);
215 void low_level_read(Array<float>& v);
217 void low_level_read_lo(Array<double>& v);
219 void low_level_read_hi(Array<double>& v);
221 void low_level_read(Array<std::complex<float> >& v);
223 void low_level_read_lo(Array<std::complex<double> >& v);
225 void low_level_read_hi(Array<std::complex<double> >& v);
226
228 bool seek(const std::string& name);
230 bool seek(int n);
232 void info(std::string& name, std::string& type, std::string& desc,
233 uint64_t& bytes);
234
235protected:
238};
239
240
246{
247public:
249 typedef it_file& (*it_manip)(it_file&);
250
252 it_file();
253
260 explicit it_file(const std::string& filename, bool trunc = false);
261
263 virtual ~it_file() { delete _strings;}
264
271 void open(const std::string& filename, bool trunc = false);
272
274 void close();
276 void flush();
277
279 bfstream& low_level() { return s; }
280
282 void set_low_precision(bool p = true) { low_prec = p; }
284 bool get_low_precision() const { return low_prec; }
285
287 void set_next_name(const std::string& name,
288 const std::string& description = "")
289 { next_name() = name; next_desc() = description; }
290
292 void write_file_header();
294 void write_data_header(const std::string& type, uint64_t size);
296 void write_data_header(const std::string& type, const std::string& name,
297 uint64_t size, const std::string& description = "");
298
300 void low_level_write(char x);
302 void low_level_write(uint64_t x);
304 void low_level_write(bool x);
305
307 void low_level_write(bin x);
309 void low_level_write(short x);
311 void low_level_write(int x);
313 void low_level_write(float x);
315 void low_level_write(double x);
317 void low_level_write(const std::complex<float>& x);
319 void low_level_write(const std::complex<double>& x);
320
322 void low_level_write(const bvec& v);
324 void low_level_write(const svec& v);
326 void low_level_write(const ivec& v);
328 void low_level_write(const vec& v);
330 void low_level_write(const cvec& v);
331
333 void low_level_write(const std::string& str);
334
336 void low_level_write(const bmat& m);
338 void low_level_write(const smat& m);
340 void low_level_write(const imat& m);
342 void low_level_write(const mat& m);
344 void low_level_write(const cmat& m);
345
347 void low_level_write(const Array<bin>& v);
349 void low_level_write(const Array<short>& v);
351 void low_level_write(const Array<int>& v);
353 void low_level_write(const Array<float>& v);
355 void low_level_write(const Array<double>& v);
357 void low_level_write(const Array<std::complex<float> >& v);
359 void low_level_write(const Array<std::complex<double> >& v);
360
362 it_file& operator<<(it_manip func) { return (*func)(*this); }
363
365 void remove(const std::string& name);
367 bool exists(const std::string& name);
369 void pack();
370
371protected:
373 void remove();
375 void write_data_header_here(const data_header& h);
376
380 std::string& next_name() {return _strings->_next_name;}
382 std::string& next_desc() {return _strings->_next_desc;}
383
384private:
385 struct Strings_Holder
386 {
387 std::string _next_name;
388 std::string _next_desc;
389 std::string _fname;
390 Strings_Holder():_next_name(""),_next_desc(""),_fname(""){}
391 };
392 Strings_Holder* _strings;
393 // Name of the opened file. Needed by the pack() method.
394 std::string& fname() {return _strings->_fname;}
395};
396
397
410{
411 f.flush();
412 return f;
413}
414
429{
430public:
432 Name(const std::string& n, const std::string& d = ""): name(n), desc(d) {}
434 Name &operator=(const Name&) { return *this; }
436 const std::string& name;
438 const std::string& desc;
439};
440
441
444
446inline it_ifile& operator>>(it_ifile& f, const Name& s)
447{
448 f.seek(s.name);
449 return f;
450}
451
453inline it_file& operator<<(it_file& f, const Name& s)
454{
455 f.set_next_name(s.name, s.desc);
456 return f;
457}
458
460ITPP_EXPORT it_ifile& operator>>(it_ifile& f, char& v);
462ITPP_EXPORT it_ifile& operator>>(it_ifile &f, bool &v);
463
465ITPP_EXPORT it_ifile& operator>>(it_ifile& f, bin& v);
467ITPP_EXPORT it_ifile& operator>>(it_ifile& f, short& v);
469ITPP_EXPORT it_ifile& operator>>(it_ifile& f, int& v);
471ITPP_EXPORT it_ifile& operator>>(it_ifile& f, float& v);
473ITPP_EXPORT it_ifile& operator>>(it_ifile& f, double& v);
475ITPP_EXPORT it_ifile& operator>>(it_ifile& f, std::complex<float>& v);
477ITPP_EXPORT it_ifile& operator>>(it_ifile& f, std::complex<double>& v);
478
480ITPP_EXPORT it_ifile& operator>>(it_ifile& f, bvec& v);
482ITPP_EXPORT it_ifile& operator>>(it_ifile& f, svec& v);
484ITPP_EXPORT it_ifile& operator>>(it_ifile& f, ivec& v);
486ITPP_EXPORT it_ifile& operator>>(it_ifile& f, vec& v);
488ITPP_EXPORT it_ifile& operator>>(it_ifile& f, cvec& v);
489
491ITPP_EXPORT it_ifile& operator>>(it_ifile& f, std::string& str);
492
494ITPP_EXPORT it_ifile& operator>>(it_ifile& f, bmat& m);
496ITPP_EXPORT it_ifile& operator>>(it_ifile& f, smat& m);
498ITPP_EXPORT it_ifile& operator>>(it_ifile& f, imat& m);
500ITPP_EXPORT it_ifile& operator>>(it_ifile& f, mat& m);
502ITPP_EXPORT it_ifile& operator>>(it_ifile& f, cmat& m);
503
505ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<bin>& v);
507ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<short>& v);
509ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<int>& v);
511ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<float>& v);
513ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<double>& v);
515ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<std::complex<float> >& v);
517ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<std::complex<double> >& v);
518
520ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<bvec>& v);
522ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<svec>& v);
524ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<ivec>& v);
526ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<vec>& v);
528ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<cvec>& v);
529
531ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<std::string>& v);
532
534ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<bmat>& v);
536ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<smat>& v);
538ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<imat>& v);
540ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<mat>& v);
542ITPP_EXPORT it_ifile& operator>>(it_ifile& f, Array<cmat>& v);
543
544
546ITPP_EXPORT it_file& operator<<(it_file& f, char x);
548ITPP_EXPORT it_file& operator<<(it_file &f, bool x);
549
551ITPP_EXPORT it_file& operator<<(it_file& f, bin x);
553ITPP_EXPORT it_file& operator<<(it_file& f, short x);
555ITPP_EXPORT it_file& operator<<(it_file& f, int x);
557ITPP_EXPORT it_file& operator<<(it_file& f, float x);
559ITPP_EXPORT it_file& operator<<(it_file& f, double x);
561ITPP_EXPORT it_file& operator<<(it_file& f, std::complex<float> x);
563ITPP_EXPORT it_file& operator<<(it_file& f, std::complex<double> x);
564
566ITPP_EXPORT it_file& operator<<(it_file& f, const bvec& v);
568ITPP_EXPORT it_file& operator<<(it_file& f, const svec& v);
570ITPP_EXPORT it_file& operator<<(it_file& f, const ivec& v);
572ITPP_EXPORT it_file& operator<<(it_file& f, const vec& v);
574ITPP_EXPORT it_file& operator<<(it_file& f, const cvec& v);
575
577ITPP_EXPORT it_file& operator<<(it_file& f, const std::string& str);
578
580ITPP_EXPORT it_file& operator<<(it_file& f, const bmat& m);
582ITPP_EXPORT it_file& operator<<(it_file& f, const smat& m);
584ITPP_EXPORT it_file& operator<<(it_file& f, const imat& m);
586ITPP_EXPORT it_file& operator<<(it_file& f, const mat& m);
588ITPP_EXPORT it_file& operator<<(it_file& f, const cmat& m);
589
591ITPP_EXPORT it_file& operator<<(it_file& f, const Array<bin>& v);
593ITPP_EXPORT it_file& operator<<(it_file& f, const Array<short>& v);
595ITPP_EXPORT it_file& operator<<(it_file& f, const Array<int>& v);
597ITPP_EXPORT it_file& operator<<(it_file& f, const Array<float>& v);
599ITPP_EXPORT it_file& operator<<(it_file& f, const Array<double>& v);
601ITPP_EXPORT it_file& operator<<(it_file& f, const Array<std::complex<float> >& v);
603ITPP_EXPORT it_file& operator<<(it_file& f, const Array<std::complex<double> >& v);
604
606ITPP_EXPORT it_file& operator<<(it_file& f, const Array<bvec>& v);
608ITPP_EXPORT it_file& operator<<(it_file& f, const Array<svec>& v);
610ITPP_EXPORT it_file& operator<<(it_file& f, const Array<ivec>& v);
612ITPP_EXPORT it_file& operator<<(it_file& f, const Array<vec>& v);
614ITPP_EXPORT it_file& operator<<(it_file& f, const Array<cvec>& v);
615
617ITPP_EXPORT it_file& operator<<(it_file& f, const Array<std::string>& v);
618
620ITPP_EXPORT it_file& operator<<(it_file& f, const Array<bmat>& v);
622ITPP_EXPORT it_file& operator<<(it_file& f, const Array<smat>& v);
624ITPP_EXPORT it_file& operator<<(it_file& f, const Array<imat>& v);
626ITPP_EXPORT it_file& operator<<(it_file& f, const Array<mat>& v);
628ITPP_EXPORT it_file& operator<<(it_file& f, const Array<cmat>& v);
629
631template <class T> inline
632void it_save_var_as(const T& v, const std::string& name)
633{
634 it_file f(name + ".it");
635 f << Name(name) << v;
636 f.close();
637}
638
640template <class T> inline
641void it_load_var_as(T& v, const std::string& name)
642{
643 it_ifile f(name + ".it");
644 f.seek(name);
645 f >> v;
646 f.close();
647}
648
650#define it_save_var(v) it_save_var_as(v,#v)
652#define it_load_var(v) it_load_var_as(v,#v)
653
655
656
657// ----------------------------------------------------------------------
658// Deprecated implementation of IT++ file format version 2
659// Will be removed in future versions
660// ----------------------------------------------------------------------
661
669{
670public:
671
673 struct data_header {
678 uint32_t hdr_bytes, data_bytes, block_bytes;
681 std::string name;
683 std::string type;
684 };
685
686protected:
687
689 struct file_header {
691 char magic[4];
694 };
696 static char file_magic[4];
698 static char file_version;
699};
700
708{
709public:
711 it_ifile_old();
713 explicit it_ifile_old(const std::string& name);
715 virtual ~it_ifile_old() { }
717 void open(const std::string& name);
719 virtual void close();
721 bfstream& low_level() { return s; }
722
724 bool read_check_file_header();
726 void read_data_header(data_header& h);
728 void low_level_read(char& x);
730 void low_level_read(bin& x);
732 void low_level_read(short& x);
734 void low_level_read(int& x);
736 void low_level_read(float& x);
738 void low_level_read(double& x);
740 void low_level_read(std::complex<float>& x);
742 void low_level_read(std::complex<double>& x);
744 void low_level_read_lo(vec& v);
746 void low_level_read_hi(vec& v);
748 void low_level_read(ivec& v);
750 void low_level_read(bvec& v);
752 void low_level_read_lo(cvec& v);
754 void low_level_read_hi(cvec& v);
756 void low_level_read(std::string& str);
758 void low_level_read_lo(mat& m);
760 void low_level_read_hi(mat& m);
762 void low_level_read(imat& m);
764 void low_level_read(bmat& m);
766 void low_level_read_lo(cmat& m);
768 void low_level_read_hi(cmat& m);
769
771 void low_level_read_lo(Array<float>& v);
773 void low_level_read_lo(Array<double>& v);
775 void low_level_read_hi(Array<double>& v);
777 void low_level_read(Array<int>& v);
779 void low_level_read(Array<bin>& v);
781 void low_level_read_lo(Array<std::complex<float> >& v);
783 void low_level_read_lo(Array<std::complex<double> >& v);
785 void low_level_read_hi(Array<std::complex<double> >& v);
786
788 bool seek(const std::string& name);
789
791 bool seek(int n);
793 void info(std::string& name, std::string& type, int& bytes);
794
795protected:
798};
799
807{
808public:
810 typedef it_file_old& (*it_manip)(it_file_old&);
811
813 it_file_old();
814
821 explicit it_file_old(const std::string& name, bool trunc = false);
822
824 virtual ~it_file_old() { delete _string;}
825
832 void open(const std::string& name, bool trunc = false);
833
835 void close();
836
838 void flush();
839
841 bfstream& low_level() { return s; }
842
844 void set_low_precision(bool p = true) { low_prec = p; }
845
847 bool get_low_precision() { return low_prec; }
848
850 void set_next_name(const std::string& n) { next_name() = n; }
851
853 void write_file_header();
855 void write_data_header(const std::string& type, uint32_t size);
857 void write_data_header(const std::string& type, const std::string& name,
858 uint32_t size);
860 void low_level_write(char x);
862 void low_level_write(bin x);
864 void low_level_write(short x);
866 void low_level_write(int x);
868 void low_level_write(float x);
870 void low_level_write(double x);
872 void low_level_write(const std::complex<float>& x);
874 void low_level_write(const std::complex<double>& x);
876 void low_level_write(const vec& v);
878 void low_level_write(const ivec& v);
880 void low_level_write(const bvec& v);
882 void low_level_write(const cvec& v);
884 void low_level_write(const std::string& str);
886 void low_level_write(const mat& m);
888 void low_level_write(const imat& m);
890 void low_level_write(const bmat& m);
892 void low_level_write(const cmat& m);
894 void low_level_write(const Array<float>& v);
896 void low_level_write(const Array<double>& v);
898 void low_level_write(const Array<int>& v);
900 void low_level_write(const Array<bin>& v);
902 void low_level_write(const Array<std::complex<float> >& v);
904 void low_level_write(const Array<std::complex<double> >& v);
905
907 it_file_old& operator<<(it_manip func) { return (*func)(*this); }
908
910 void remove(const std::string& name);
912 bool exists(const std::string& name);
914 void pack();
915
916protected:
918 void remove();
920 void write_data_header_here(const data_header& h);
921
925 std::string& next_name() {return _string->_next_name;}
926private:
927 struct String_Holder
928 {
929 std::string _next_name;
930 String_Holder():_next_name(""){}
931 };
932 String_Holder* _string;
933};
934
948{
949 f.flush();
950 return f;
951}
952
953
956
959{
960 f.seek(s.name);
961 return f;
962}
963
966{
967 f.set_next_name(s.name);
968 return f;
969}
970
972ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, char& v);
973
975ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, bin& v);
976
978ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, short& v);
979
981ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, int& v);
982
984ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, float& v);
985
987ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, double& v);
988
990ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, std::complex<float>& v);
991
993ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, std::complex<double>& v);
994
996ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, vec& v);
997
999ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, ivec& v);
1000
1002ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, bvec& v);
1003
1005ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, cvec& v);
1006
1008ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, std::string& str);
1009
1011ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, mat& m);
1012
1014ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, imat& m);
1015
1017ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, bmat& m);
1018
1020ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, cmat& m);
1021
1023ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<float>& v);
1024
1026ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<double>& v);
1027
1029ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<int>& v);
1030
1032ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<bin>& v);
1033
1035ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<std::complex<float> >& v);
1036
1038ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<std::complex<double> >& v);
1039
1041ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<vec>& v);
1042
1044ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<ivec>& v);
1045
1047ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<bvec>& v);
1048
1050ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<cvec>& v);
1051
1053ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<std::string>& v);
1054
1056ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<mat>& v);
1057
1059ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<imat>& v);
1060
1062ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<bmat>& v);
1063
1065ITPP_EXPORT it_ifile_old& operator>>(it_ifile_old& f, Array<cmat>& v);
1066
1067
1069ITPP_EXPORT it_file_old& operator<<(it_file_old& f, char x);
1070
1072ITPP_EXPORT it_file_old& operator<<(it_file_old& f, bin x);
1073
1075ITPP_EXPORT it_file_old& operator<<(it_file_old& f, short x);
1076
1078ITPP_EXPORT it_file_old& operator<<(it_file_old& f, int x);
1079
1081ITPP_EXPORT it_file_old& operator<<(it_file_old& f, float x);
1082
1084ITPP_EXPORT it_file_old& operator<<(it_file_old& f, double x);
1085
1087ITPP_EXPORT it_file_old& operator<<(it_file_old& f, std::complex<float> x);
1088
1090ITPP_EXPORT it_file_old& operator<<(it_file_old& f, std::complex<double> x);
1091
1093ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const vec& v);
1094
1096ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const ivec& v);
1097
1099ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const bvec& v);
1100
1102ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const cvec& v);
1103
1105ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const std::string& str);
1106
1108ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const mat& m);
1109
1111ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const imat& m);
1112
1114ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const bmat& m);
1115
1117ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const cmat& m);
1118
1120ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<float>& v);
1121
1123ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<double>& v);
1124
1126ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<int>& v);
1127
1129ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<bin>& v);
1130
1132ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<std::complex<float> >& v);
1133
1135ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<std::complex<double> >& v);
1136
1138ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<vec>& v);
1139
1141ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<ivec>& v);
1142
1144ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<bvec>& v);
1145
1147ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<cvec>& v);
1148
1150ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<std::string>& v);
1151
1153ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<mat>& v);
1154
1156ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<imat>& v);
1157
1159ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<bmat>& v);
1160
1162ITPP_EXPORT it_file_old& operator<<(it_file_old& f, const Array<cmat>& v);
1163
1165
1166// ----------------------------------------------------------------------
1167// End of the deprecated implementation of IT++ file format version 2
1168// Will be removed in future versions
1169// ----------------------------------------------------------------------
1170
1171} // namespace itpp
1172
1173#endif // #ifndef IT_FILE_H
1174
Definition of Array class (container)
Binary file formats definitions.
General array class.
Definition array.h:105
int size() const
Returns the number of data elements in the array object.
Definition array.h:155
Automatic naming when saving.
Definition itfile.h:429
Name & operator=(const Name &)
Dummy assignment operator - MSVC++ warning C4512.
Definition itfile.h:434
const std::string & name
The name string.
Definition itfile.h:436
Name(const std::string &n, const std::string &d="")
Constructor.
Definition itfile.h:432
const std::string & desc
The description.
Definition itfile.h:438
Binary in/out-file Class.
Definition binfile.h:604
Binary arithmetic (boolean) class.
Definition binary.h:57
Base class for it_ifile_old and it_file_old.
Definition itfile.h:669
static char file_version
ACTION: Add documentation.
Definition itfile.h:698
Base class for it_ifile and it_file.
Definition itfile.h:95
static char file_version
IT++ file version.
Definition itfile.h:124
The old (version 2) IT++ file format reading and writing class.
Definition itfile.h:807
bool low_prec
ACTION: Add documenation for this protected member.
Definition itfile.h:923
it_file_old & operator<<(it_manip func)
ACTION: ADD DOCUMENTATION FOR THIS MEMBER !!!!!!!!
Definition itfile.h:907
void flush()
Flush the data to disk.
Definition itfile.cpp:2352
bool get_low_precision()
Get the precision.
Definition itfile.h:847
void set_next_name(const std::string &n)
Set the name of the next name to be saved. See also the Name class.
Definition itfile.h:850
std::string & next_name()
ACTION: Add documenation for this protected member.
Definition itfile.h:925
void set_low_precision(bool p=true)
Set the precision. Low precision means floats, high means doubles.
Definition itfile.h:844
virtual ~it_file_old()
Destructor.
Definition itfile.h:824
bfstream & low_level()
Returns pointer to the underlying bfstream used.
Definition itfile.h:841
The IT++ file format reading and writing class.
Definition itfile.h:246
void flush()
Flush the data to disk.
Definition itfile.cpp:535
bool get_low_precision() const
Get the precision.
Definition itfile.h:284
void set_low_precision(bool p=true)
Set the precision. Low precision means floats, high means doubles.
Definition itfile.h:282
std::string & next_name()
Name to be used for saving the next variable.
Definition itfile.h:380
void close()
Close the file.
Definition itfile.cpp:530
std::string & next_desc()
Description to be used for saving the next variable.
Definition itfile.h:382
virtual ~it_file()
Destructor.
Definition itfile.h:263
void set_next_name(const std::string &name, const std::string &description="")
Set the name and optionally description of the next variable to be saved.
Definition itfile.h:287
it_file & operator<<(it_manip func)
ACTION: ADD DOCUMENTATION FOR THIS MEMBER !!!!!!!!
Definition itfile.h:362
bfstream & low_level()
Returns pointer to the underlying bfstream used.
Definition itfile.h:279
bool low_prec
Low precision flag. If true, use float type, otherwise double.
Definition itfile.h:378
The old (version 2) IT++ file format reading class.
Definition itfile.h:708
bool seek(const std::string &name)
Find the variable name.
Definition itfile.cpp:1906
virtual ~it_ifile_old()
Destructor.
Definition itfile.h:715
bfstream & low_level()
Returns pointer to the underlying bfstream used.
Definition itfile.h:721
bfstream s
Protected binary file stream.
Definition itfile.h:797
The IT++ file format reading class.
Definition itfile.h:133
bool seek(const std::string &name)
Find the variable name.
Definition itfile.cpp:65
virtual void close()
Close the file.
Definition itfile.cpp:60
bfstream & low_level()
Returns pointer to the underlying bfstream used.
Definition itfile.h:146
virtual ~it_ifile()
Destructor.
Definition itfile.h:140
bfstream s
Protected binary file stream.
Definition itfile.h:237
void it_load_var_as(T &v, const std::string &name)
Load the variable v from the file name.it as the name name.
Definition itfile.h:641
void it_save_var_as(const T &v, const std::string &name)
Save the variable v in the file name.it as the name name.
Definition itfile.h:632
it_file & flush(it_file &f)
Flush operator.
Definition itfile.h:409
IT++ type definitions.
Mat< bin > bmat
bin matrix
Definition mat.h:508
itpp namespace
Definition itmex.h:37
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
Definition binary.cpp:36
std::istream & operator>>(std::istream &input, bin &outbin)
Input stream of bin.
Definition binary.cpp:42
Data header structure.
Definition itfile.h:98
std::string name
Data name.
Definition itfile.h:106
uint64_t hdr_bytes
Number of bytes of the header.
Definition itfile.h:100
uint64_t block_bytes
Number of bytes of the header + data.
Definition itfile.h:104
std::string type
Data type, e.g. int32, float32, etc. type = "" means deleted.
Definition itfile.h:108
std::string desc
Data description.
Definition itfile.h:110
uint64_t data_bytes
Number of bytes of the data.
Definition itfile.h:102
File header structure.
Definition itfile.h:115
char version
IT++ file format version.
Definition itfile.h:119
Data header structure.
Definition itfile.h:673
std::string type
data type, e.g. int32, float32, etc. type = "" means deleted
Definition itfile.h:683
std::string name
data name
Definition itfile.h:681
char endianity
0=little, 1=big
Definition itfile.h:675
File header structure.
Definition itfile.h:689
char version
ACTION: Add documentation.
Definition itfile.h:693
Templated Vector Class Definitions.

Generated on Tue Aug 17 2021 10:59:15 for IT++ by Doxygen 1.9.8