** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: array2dfile.h,v 1.10 2000/12/16 02:44:26 kevin Exp $
+** $Id: array2dfile.h,v 1.16 2001/01/02 06:29:23 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
#include "fnetorderstream.h"
#include "array2d.h"
-using namespace std;
-
class Array2dFileLabel
{
public:
~Array2dFileLabel();
- const string& getLabelString (void) const
+ const std::string& getLabelString (void) const
{ return m_strLabel; }
kfloat64 getCalcTime (void) const
int getLabelType (void) const
{ return m_labelType; }
- string& setLabelString (const char* const str)
+ std::string& setLabelString (const char* const str)
{ m_strLabel = str; return (m_strLabel); }
- string& setLabelString (const string& str)
+ std::string& setLabelString (const std::string& str)
{ m_strLabel = str; return (m_strLabel); }
void setDateTime (int year, int month, int day, int hour, int minute, int second);
void getDateTime (int& year, int& month, int& day, int& hour, int& minute, int& second) const;
- const string& getDateString () const;
+ const std::string& getDateString () const;
void print (std::ostream& os) const;
+ void printBrief (std::ostream& os) const;\r
Array2dFileLabel (const Array2dFileLabel& rhs);
kuint16 m_hour;
kuint16 m_minute;
kuint16 m_second;
- string m_strLabel;
+ std::string m_strLabel;
kfloat64 m_calcTime;
- mutable string m_strDate;
+ mutable std::string m_strDate;
};
PIXEL_FLOAT32 = 7,
PIXEL_FLOAT64 = 8,
};
-
- Array2dFile (int nx, int ny, int pixelSize, int pixelFormat = PIXEL_INVALID);
+\r
+ enum {\r
+ DATA_TYPE_INVALID = 0,\r
+ DATA_TYPE_REAL,\r
+ DATA_TYPE_COMPLEX,\r
+ };\r
+
+ Array2dFile (int nx, int ny, int pixelSize, int pixelFormat = PIXEL_INVALID, int dataType = DATA_TYPE_REAL);
Array2dFile (void);
~Array2dFile ();
- void setArraySize (int nx, int ny, int pixelSize, int pixelFormat = PIXEL_INVALID);
+ void setArraySize (int nx, int ny, int pixelSize, int pixelFormat = PIXEL_INVALID, int dataType = DATA_TYPE_REAL);
void setArraySize (int nx, int ny);
void labelAdd (int type, const char* const m_strLabel, double calc_time=0.);
- void labelsCopy (Array2dFile& file, const char* const idStr = NULL);
+ void labelsCopy (const Array2dFile& file, const char* const idStr = NULL);
void setPixelFormat (int type)
{ m_pixelFormat = type; }
kuint32 ny (void) const
{ return m_ny; }
+\r
+ bool isComplex() const\r
+ { return m_dataType == DATA_TYPE_COMPLEX; }\r
+\r
+ bool isReal() const\r
+ { return m_dataType == DATA_TYPE_REAL; }\r
+\r
+ int dataType () const\r
+ { return static_cast<int>(m_dataType); }\r
+\r
+ void setDataType (int dataType)\r
+ { m_dataType = dataType; }\r
void setAxisIncrement (double axisIncX, double axisIncY);
- void setAxisExtent (double minX, double maxX, double minY, double maxY);
+ bool reallocRealToComplex ();\r
+\r
+ bool reallocComplexToReal ();\r
- void getPixelValueRange (double& pvmin, double& pvmax) const;
+ void getPixelValueRange (double& pvmin, double& pvmax) const;\r
+ void setAxisExtent (double minX, double maxX, double minY, double maxY);
void doPixelOffsetScale (double offset, double scale);
bool fileRead (const char* const filename);
- bool fileRead (const string& filename);
+ bool fileRead (const std::string& filename);
bool fileWrite (const char* const filename);
- bool fileWrite (const string& filename);
+ bool fileWrite (const std::string& filename);
- const string& getFilename (void) const
+ const std::string& getFilename (void) const
{ return m_filename; }
- void printLabels (ostream& os) const;
+ void printLabels (std::ostream& os) const;\r
+ void printLabelsBrief (std::ostream& os) const;\r
+\r
+ unsigned int nLabels() const\r
+ { return m_labels.size(); }\r
- typedef vector<Array2dFileLabel*>::iterator labelIterator;
- typedef vector<Array2dFileLabel*>::const_iterator constLabelIterator;
+ typedef std::vector<Array2dFileLabel*>::iterator labelIterator;
+ typedef std::vector<Array2dFileLabel*>::const_iterator constLabelIterator;
protected:
- typedef vector<Array2dFileLabel*> labelContainer;
+ typedef std::vector<Array2dFileLabel*> labelContainer;
static const kuint16 m_signature;
kuint16 m_headersize;
- string m_filename;
+ std::string m_filename;
kuint16 m_pixelSize;
kuint16 m_pixelFormat;
kuint32 m_ny;
kuint32 m_arraySize;
labelContainer m_labels;
- kuint16 m_numFileLabels;
+ kuint16 m_numFileLabels;\r
+ kuint16 m_dataType;
unsigned char** m_arrayData;
+ unsigned char** m_imaginaryArrayData;\r
private:
void init (void);
bool labelSeek (int label_num);
- void allocArray (void);
-
- void freeArray (void);
+ void allocArrays ();
+ void freeArrays ();
+\r
+ void allocArray (unsigned char**& rppData);\r
+ void freeArray (unsigned char**& rppData);\r
Array2dFile (const Array2dFile& rhs); // copy constructor
Array2dFile& operator= (const Array2dFile&); // assignment operator