** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: array2dfile.cpp,v 1.6 2000/07/13 07:03:21 kevin Exp $
+** $Id: array2dfile.cpp,v 1.12 2000/12/04 03:42:00 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 "array2dfile.h"
#include <ctime>
+#ifndef WIN32
#include <sstream>
+#endif
using namespace std;
+const kuint16 Array2dFile::m_signature = ('I'*256+'F');
///////////////////////////////////////////////////////////////////////////
// CLASS IMPLEMENTATION
init();
}
-Array2dFileLabel::Array2dFileLabel(const char* const str, double ctime = 0.)
+Array2dFileLabel::Array2dFileLabel(const char* const str, double ctime)
: m_strLabel (str)
{
init();
m_calcTime = ctime;
}
-Array2dFileLabel::Array2dFileLabel(const int type, const char* const str, double ctime = 0.)
+Array2dFileLabel::Array2dFileLabel(const int type, const char* const str, double ctime)
: m_strLabel (str)
{
init();
{
freeArray ();
for (labelIterator l = m_labels.begin(); l != m_labels.end(); l++)
- delete *l;
+ delete *l;
}
Array2dFile::Array2dFile (void)
void
Array2dFile::setArraySize (int x, int y, int pixelSize, int pixelFormat)
{
- m_nx = x;
- m_ny = y;
m_pixelSize = pixelSize;
- m_arraySize = m_nx * m_ny * m_pixelSize;
m_pixelFormat = pixelFormat;
- allocArray ();
+ setArraySize (x, y);
}
void
if (NativeBigEndian()) {
for (unsigned int iy = 0; iy < m_ny; iy++) {
ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);
- fs.write (ptrColumn, m_pixelSize);
+ fs.write (reinterpret_cast<const char*>(ptrColumn), m_pixelSize);
ptrColumn += m_pixelSize;
}
} else
- fs.write (ptrColumn, columnSize);
+ fs.write (reinterpret_cast<const char*>(ptrColumn), columnSize);
}
return true;
unsigned char* ptrColumn = m_arrayData[ix];
if (NativeBigEndian()) {
for (unsigned int iy = 0; iy < m_ny; iy++) {
- fs.read (ptrColumn, m_pixelSize);
+ fs.read (reinterpret_cast<char*>(ptrColumn), m_pixelSize);
ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);
ptrColumn += m_pixelSize;
}
} else
- fs.read (ptrColumn, columnSize);
+ fs.read (reinterpret_cast<char*>(ptrColumn), columnSize);
}
return true;
}
void
-Array2dFile::labelAdd (const char* const lstr, double calc_time=0.)
+Array2dFile::labelAdd (const char* const lstr, double calc_time)
{
labelAdd (Array2dFileLabel::L_HISTORY, lstr, calc_time);
}
void
-Array2dFile::labelAdd (int type, const char* const lstr, double calc_time=0.)
+Array2dFile::labelAdd (int type, const char* const lstr, double calc_time)
{
Array2dFileLabel label (type, lstr, calc_time);