RegularGridBDataWriter.h
00001 #ifndef gridripper_io_RegularGridBDataWriter_h
00002 #define gridripper_io_RegularGridBDataWriter_h
00003
00004 #include <gridripper/tvalarray.h>
00005 #include <gridripper/lang/IllegalArgumentException.h>
00006 #include "BDataFlags.h"
00007 #include "DataOutputStream.h"
00008 #include "IOException.h"
00009 #include <iostream>
00010
00011 namespace gridripper { namespace io {
00012
00020 class RegularGridBDataWriter
00021 {
00022 private:
00023 bool initialized;
00024 bool write_called;
00025 DataOutputStream out;
00026 double minimumX;
00027 double deltaX;
00028 int numFields;
00029 int numGridPoints;
00030 string timeLabel;
00031 string xcoordLabel;
00032 string* fieldNames;
00033
00034 public:
00039 RegularGridBDataWriter(ostream& os);
00040
00042 ~RegularGridBDataWriter();
00043
00051 void init(int nfields, const string& tname, const string& xname,
00052 const string* fields) throw(IllegalArgumentException&);
00053
00062 void write(double t, double xmin, double dx, int npoints,
00063 const float* floatData)
00064 throw(IOException&, IllegalArgumentException&) {
00065 write(t, xmin, dx, npoints, floatData, NULL);
00066 }
00067
00076 void write(double t, double xmin, double dx, int npoints,
00077 const double* doubleData)
00078 throw(IOException&, IllegalArgumentException&) {
00079 write(t, xmin, dx, npoints, NULL, doubleData);
00080 }
00081
00082 private:
00083 void write(double t, double xmin, double dx, int npoints,
00084 const float* floatData, const double* doubleData)
00085 throw(IOException&, IllegalArgumentException&);
00086 };
00087
00088 } }
00089
00090 #endif