X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Farray2dfile.cpp;h=c450a0ec8389751a44187e32dd8b1c625181718c;hp=ca45d8b820eaea485272a6e6f824243c01ac0b89;hb=9b2bb510160bdb56f04847f5b55ab61dd8a47976;hpb=67a6c34b5a6f38d34e8cbe66091853f453fd2d7a diff --git a/libctsim/array2dfile.cpp b/libctsim/array2dfile.cpp index ca45d8b..c450a0e 100644 --- a/libctsim/array2dfile.cpp +++ b/libctsim/array2dfile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: array2dfile.cpp,v 1.22 2000/12/29 19:30:08 kevin Exp $ +** $Id: array2dfile.cpp,v 1.24 2001/01/02 05:34:57 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 @@ -137,23 +137,38 @@ Array2dFileLabel::operator= (const Array2dFileLabel& rhs) return (*this); } -void -Array2dFileLabel::print (std::ostream& os) const -{ - if (m_labelType == L_HISTORY) { - os << "History: " << std::endl; - os << " " << m_strLabel << std::endl; - os << " calc time = " << m_calcTime << " secs" << std::endl; - os << " Timestamp = " << getDateString() << std::endl; - } else if (m_labelType == L_USER) { - os << "Note: " << m_strLabel << std::endl; - os << " Timestamp = %s" << getDateString() << std::endl; - } else { - os << "Unknown (" << m_labelType << "): " << m_strLabel << std::endl; - os << " Timestamp = %s" << getDateString() << std::endl; - } -} - +void +Array2dFileLabel::print (std::ostream& os) const +{ + if (m_labelType == L_HISTORY) { + os << "History: " << std::endl; + os << " " << m_strLabel << std::endl; + os << " calc time = " << m_calcTime << " secs" << std::endl; + os << " Timestamp = " << getDateString() << std::endl; + } else if (m_labelType == L_USER) { + os << "Note: " << m_strLabel << std::endl; + os << " Timestamp = %s" << getDateString() << std::endl; + } else { + os << "Unknown (" << m_labelType << "): " << m_strLabel << std::endl; + os << " Timestamp = %s" << getDateString() << std::endl; + } +} + +void +Array2dFileLabel::printBrief (std::ostream& os) const +{ + if (m_labelType == L_HISTORY) { + os << "History ("; + if (m_calcTime > 0) + os << m_calcTime << " secs, "; + os << getDateString() << "): " << m_strLabel << std::endl; + } else if (m_labelType == L_USER) { + os << "Note (" << getDateString() << "): " << m_strLabel << std::endl; + } else { + os << "Unknown (" << getDateString() << "): " << m_strLabel << std::endl; + } +} + /////////////////////////////////////////////////////////////////////////// // CLASS IMPLEMENTATION @@ -410,7 +425,7 @@ Array2dFile::headerRead (frnetorderstream& fs) return false; } - return true; + return ! fs.fail(); } @@ -448,7 +463,7 @@ Array2dFile::headerWrite (frnetorderstream& fs) fs.seekp (0); fs.writeInt16 (m_headersize); - return true; + return ! fs.fail(); } @@ -660,17 +675,27 @@ Array2dFile::arrayDataClear (void) } } -void -Array2dFile::printLabels (std::ostream& os) const -{ - for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) { - const Array2dFileLabel& label = **l; - - label.print (os); - os << std::endl; - } -} - +void +Array2dFile::printLabels (std::ostream& os) const +{ + for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) { + const Array2dFileLabel& label = **l; + + label.print (os); + os << std::endl; + } +} + +void +Array2dFile::printLabelsBrief (std::ostream& os) const +{ + for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) { + const Array2dFileLabel& label = **l; + + label.printBrief (os); + } +} + const Array2dFileLabel& Array2dFile::labelGet (int i) const