genericIO
genericFile.h
1 #ifndef GENERIC_FILE
2 #define GENERIC_FILE 1
3 #include <vector>
4 #include <assert.h>
5 #include "paramObj.h"
6 #include "hypercube.h"
7 #include <memory>
8 #include <complex.h>
9 
10 
11 namespace SEP {
12 enum usage_code {
13  usageIn,
14  usageOut,
15  usageInOut,
16  usageScr
17 };
18 enum dataType {
19  dataFloat,
20  dataByte,
21  dataShort,
22  dataInt,
23  dataComplex,
24  dataUndefined
25 };
26 
27 
28 class genericRegFile : public paramObj {
29 public:
31  _type=dataUndefined;
32 }
33 
34 virtual void putInt(const std::string &par, const int val);
35 virtual void putFloat(const std::string &par, const float val){
36  if(par=="" && val==0) {;}
37 }
38 virtual void putString(const std::string &par, const std::string val){
39  if(par=="" && val=="") {;}
40 }
41 virtual void putBool(const std::string &par, const bool val){
42  if(par=="" && val==0) {;}
43 }
44 virtual void putInts(const std::string &par, const std::vector<int> val){
45  if(par=="" && val[0]==0) {;}
46 }
47 virtual void putFloats(const std::string &par, const std::vector<float> val) {
48  if(par=="" && val[0]==0) {;}
49 }
50 virtual void readUCharStream(unsigned char *array,const long long npts){
51  if(npts==0 && array==0) {;}
52 }
53 virtual void readFloatStream(float *array,const long long npts){
54  if(npts==0 && array==0) {;}
55 }
56 virtual void writeFloatStream( const float *array,const long long npts){
57  fprintf(stderr,"in write float stream default \n");
58 
59  if(npts==0 && array==0) {;}
60 }
61 virtual void readUCharWindow(const std::vector<int>& nw, const std::vector<int>& fw,
62  const std::vector<int>& jw, unsigned char *array){
63  if(nw[0]==0 && fw[0]==0 && jw[0]==0 && array==0) {;}
64 }
65 virtual void seekTo(const long long iv,const int whence){
66  if(whence==iv) {;}
67 }
68 virtual void readComplexStream(float _Complex *array,const long long npts){
69  if(npts==0 && array==0) {;}
70 }
71 virtual void writeComplexStream( const float _Complex *array,const long long npts){
72  if(npts==0 && array==0) {;}
73 }
74 virtual void readComplexWindow(const std::vector<int> &nw, const std::vector<int> &fw,
75  const std::vector<int> jw, float _Complex *array){
76  if(nw[0]==0 && fw[0]==0 && jw[0]==0 && array==0) {;}
77 }
78 virtual void writeComplexWindow(const std::vector<int>& nw, const std::vector<int>& fw,
79  const std::vector<int>& jw, const float _Complex *array){
80  if(nw[0]==0 && fw[0]==0 && jw[0]==0 && array==0) {;}
81 }
82 virtual long long getDataSize(){
83  assert(1==2);
84 }
85 virtual void readFloatWindow(const std::vector<int> &nw, const std::vector<int>& fw,
86  const std::vector<int> &jw, float *array){
87  if(nw[0]==0 && fw[0]==0 && jw[0]==0 && array==0) {;}
88 }
89 virtual void writeFloatWindow(const std::vector<int> &nw, const std::vector<int> &fw,
90  const std::vector<int>& jw, const float *array){
91  if(nw[0]==0 && fw[0]==0 && jw[0]==0 && array==0) {;}
92 }
93 virtual void readDescription(){
94  ;
95 }
96 virtual void writeDescription(){
97  ;
98 }
99 virtual void close(){
100  ;
101 }
102 void setHyper(std::shared_ptr<SEP::hypercube> hyp){
103  _hyper=hyp;
104 }
105 dataType getDataType(){
106  return _type;
107 }
108 int getDataEsize();
109 void setDataType(dataType typ){
110  _type=typ;
111 }
112 std::string getDataTypeString();
113 const std::shared_ptr<SEP::hypercube> getHyper(){
114  if(!_hyper) error(std::string("Hypercube has not been setup"));
115  return _hyper;
116 }
117 protected:
118 std::shared_ptr<SEP::hypercube> _hyper;
119 dataType _type;
120 };
121 
122 union headerType {
123  int i;
124  short s;
125  long long l;
126  double d;
127  float f;
128 };
130 public:
132 }
133 virtual int getHeaderIndex(std::string keyname){
134  if(keyname==std::string("")) {;}
135  return 0;
136 }
137 virtual std::vector<headerType> getTraceHeader(long long index){
138  if(index==0) {;}
139  std::vector<headerType> x; return x;
140 }
141 virtual std::vector<std::string> getHeaderTypes(){
142  std::vector<std::string> a; return a;
143 }
144 
145 
146 };
147 
148 }
149 
150 #endif
Definition: genericFile.h:129
Definition: genericFile.h:122
Definition: genericFile.h:28
Definition: paramObj.h:8
Definition: axis.h:8